Skip to content

Commit

Permalink
add basic keycode files
Browse files Browse the repository at this point in the history
  • Loading branch information
vcaesar committed Nov 23, 2021
1 parent 75e44bd commit 7d602ed
Show file tree
Hide file tree
Showing 8 changed files with 252 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Contributing to cedar

24 changes: 24 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
1. Please **speak English**, this is the language everybody of us can speak and write.
2. Please ask questions or config/deploy problems on our Gitter channel: https://gitter.im/go-ego/ego
3. Please take a moment to search that an issue **doesn't already exist**.
4. Please give all relevant information below for bug reports, incomplete details will be handled as an invalid report.

**You MUST delete the content above including this line before posting, otherwise your issue will be invalid.**

- Cedar version (or commit ref):
- Go version:
<!-- - Gcc version: -->
- Operating system and bit:
- Can you reproduce the bug at [Examples](https://github.com/vcaesar/cedar/tree/master/examples):
- [ ] Yes (provide example code)
- [ ] No
- [ ] Not relevant
- Provide example code:
```Go

```
- Log gist:

## Description

...
23 changes: 23 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The pull request will be closed without any reasons if it does not satisfy any of following requirements:

1. Make sure you are targeting the `master` branch, pull requests on release branches are only allowed for bug fixes.
2. Please read contributing guidelines: [CONTRIBUTING](https://github.com/vcaesar/cedar/blob/master/CONTRIBUTING.md)
3. Describe what your pull request does and which issue you're targeting (if any and Please use English)
4. ... if it is not related to any particular issues, explain why we should not reject your pull request.
5. The Commits must **use English**, must be test and No useless submissions.

**You MUST delete the content above including this line before posting, otherwise your pull request will be invalid.**

**Please provide Issues links to:**

- Issues: #1

**Provide test code:**

```Go
```

## Description

...
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go
on: [push]
jobs:
test:
strategy:
matrix:
# go: [1.16.x, 1.17.x]
os: [macOS-latest, windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}

steps:
- name: Set up Go 1.17
uses: actions/setup-go@v1
with:
go-version: 1.17
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v1

- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Build
run: go build -v .
- name: Test
run: go test -v .
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Object files
.DS_Store
.vscode
.idea

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
15 changes: 15 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

jobs:
build:
docker:
- image: golang:1.17.3
working_directory: /gopath/src/github.com/vcaesar/keycode
steps:
- checkout
# specify any bash command here prefixed with `run: `
- run: go get -v -t -d ./...
- run: go test -v ./...
# codecov.io
- run: go test -v -covermode=count -coverprofile=coverage.out
- run: bash <(curl -s https://codecov.io/bash)
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/vcaesar/keycode

go 1.17
152 changes: 152 additions & 0 deletions keycode.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
// Copyright 2016 The go-vgo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://github.com/go-vgo/robotgo/blob/master/LICENSE
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

package keycode

// UMap type map[string]uint16
type UMap map[string]uint16

// MouseMap robotgo hook mouse's code map
var MouseMap = UMap{
"left": 1,
"right": 2,
"center": 3,
"wheelDown": 4,
"wheelUp": 5,
"wheelLeft": 6,
"wheelRight": 7,
}

// Keycode robotgo hook key's code map
var Keycode = UMap{
"`": 41,
"1": 2,
"2": 3,
"3": 4,
"4": 5,
"5": 6,
"6": 7,
"7": 8,
"8": 9,
"9": 10,
"0": 11,
"-": 12,
"=": 13,
//
"_": 12,
"+": 13,
//
"q": 16,
"w": 17,
"e": 18,
"r": 19,
"t": 20,
"y": 21,
"u": 22,
"i": 23,
"o": 24,
"p": 25,
"[": 26,
"]": 27,
"\\": 43,
//
"{": 26,
"}": 27,
"|": 43,
//
"a": 30,
"s": 31,
"d": 32,
"f": 33,
"g": 34,
"h": 35,
"j": 36,
"k": 37,
"l": 38,
";": 39,
"'": 40,
//
":": 39,
`"`: 40,
//
"z": 44,
"x": 45,
"c": 46,
"v": 47,
"b": 48,
"n": 49,
"m": 50,
",": 51,
".": 52,
"/": 53,
//
"<": 51,
">": 52,
"?": 53,
//
"f1": 59,
"f2": 60,
"f3": 61,
"f4": 62,
"f5": 63,
"f6": 64,
"f7": 65,
"f8": 66,
"f9": 67,
"f10": 68,
"f11": 69,
"f12": 70,
// more
"esc": 1,
"delete": 14,
"tab": 15,
"enter": 28,
"ctrl": 29,
"control": 29,
"shift": 42,
"rshift": 54,
"space": 57,
//
"alt": 56,
"ralt": 3640,
"cmd": 3675,
"command": 3675,
"rcmd": 3676,
//
"up": 57416,
"down": 57424,
"left": 57419,
"right": 57421,
}

// Special is the special key map
var Special = map[string]string{
"~": "`",
"!": "1",
"@": "2",
"#": "3",
"$": "4",
"%": "5",
"^": "6",
"&": "7",
"*": "8",
"(": "9",
")": "0",
"_": "-",
"+": "=",
"{": "[",
"}": "]",
"|": "\\",
":": ";",
`"`: "'",
"<": ",",
">": ".",
"?": "/",
}

0 comments on commit 7d602ed

Please sign in to comment.