Skip to content

Commit

Permalink
Add more samples as per #23
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeltris committed May 13, 2020
1 parent 8089532 commit 172b754
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 7 deletions.
File renamed without changes.
16 changes: 16 additions & 0 deletions Build/Data/Updating.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
NOTE: Since V6.0.0.6 (2019-04-23) they have had a release schedule about 1-2 times a month.

0.json <---- contains keys.json ("mode-layer-temp-switch")
index.html
index.js <---- contains lang data ("macro_cate_already_exist")
manifest.js
vendor.js

- Download the official software
- Format the above files (0.json / index.js) and use them to update the following:

- Find string such as "macro_cate_already_exist" and update /Build/Data/i18n/langs/zh.jon/en.json
- Update keys.json by searching for "mode-layer-temp-switch"
- Copy all files from /driver/device/ to /Build/Data/device/ (rename the chinese named folder)
- In Program.cs call CMFile.DumpLighting() with "/driver/res/data/le/" as the path. Copy the dumped files from the created "dump" folder.
- Use https://jsonformatter.curiousconcept.com/ where applicable to fix up quotation marks on files (lang, keys.json is a manual fix)
52 changes: 47 additions & 5 deletions Build/UserData/Sample.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# To see a list of the available keys see https://github.com/pixeltris/GK6X/blob/81761765f020962ed04ad68f8f0837facda7a1fa/GK6X/KeyValues.cs#L269

##################################################################
# Mapping keys
##################################################################

# On GK84 boards the top right key is 'pause'. This sets all layers (and Fn) to change this to 'delete'.
[Base,Layer1,Layer2,Layer3,FnLayer1,FnLayer2,FnLayer3]
Pause:Delete

# This is an example of a macro which types 'abcabc' and is bound to the Fn+B of layer1
# The macro name is "MyMacro" which is defined below.
[FnLayer1]
B:Macro(MyMacro)
# This will map Fn+W to LCtrl+LAlt+Delete on layer3
[FnLayer3]
W:LCtrl+LAlt+Delete

# This will map Backspace to LAlt+Tab on layer1 and layer2
[Layer1,Layer2]
Backslash:LAlt+Tab

##################################################################
# Creating / mapping macros
##################################################################

# MyMacro = the name of the macro
# 0 = milliseconds between each key action
Expand All @@ -24,6 +35,24 @@ B:Macro(MyMacro)
[Macro(MyMacro,0,RepeatXTimes,2)]
Press:A+B+C

# This is an example of a macro which types 'abcabc' and is bound to the Fn+B of layer1
# The macro name is "MyMacro" which is defined below.
[FnLayer1]
B:Macro(MyMacro)

# This macro will do a cut/paste
[Macro(QuickCutSave)]
Press:LCtrl+X
Press:LCtrl+S

# Assign the macro to Fn+Q on layer3
[Layer3]
Q:Macro(QuickCutSave)

##################################################################
# Lighting
##################################################################

# You can use up to 32 lighting effects / static lighting on the base layer.
# Other layers are limited to one lighting effect only (unless someone knows how to change the active lighting effect on other layers).
# The following example sets the "Windmill", "Red light respiration", and "Starlish" lighting effects on the base layer.
Expand All @@ -36,4 +65,17 @@ Press:A+B+C
[Lighting(WASD static,Layer1)]

# If you're confused about the codes/numbers in the lighting effect files, use the command "dumpkeys null ex" to see the codes for your keyboard keys.
# When creating your own lighting effects you can use the names of the keys as seen in the link at the top of this file.
# When creating your own lighting effects you can use the names of the keys as seen in the link at the top of this file.

##################################################################
# Alternative key names for duplicate keys
##################################################################

# Some keyboard have duplicate keys (multiple Space keys, multiple Backspace keys, etc). This causes issues with
# mapping keys by name. You need to use the "dumpkeys" command to see the unique name for those duplicate keys.
# Duplicate keys will be given a name such as "Space_2". You can create alternative names for such keys to clarify
# which key is which.
#
# The following creates a key alias (alternative name) for "Space_2" called "RightSpace", allowing you to use "RightSpace" in mappings
[KeyAlias]
RightSpace:Space_2
4 changes: 2 additions & 2 deletions GK6X/KeyboardDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,9 @@ public void SetMacros(KeyboardLayer layer, UserDataFile userData)

if (i < macro.Actions.Count - 1 || (macro.UseTrailingDelay && i == macro.Actions.Count - 1))
{
packet.WriteUInt16(action.Delay);
packet.WriteUInt16(action.Delay);//TODO: Investigate! (ushort)(action.Delay == 0 ? 0 : action.Delay / 2));// Delay seems to be doubled?
packet.WriteByte(0);// Always 0?
packet.WriteByte(3);// Always 3?
packet.WriteByte(3);// Always 3? (1/2 use no delay, 0/4 (and maybe others) seem to never stop pressing the key)
}
else
{
Expand Down
5 changes: 5 additions & 0 deletions GK6X/UserDataFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,11 @@ private void Load(KeyboardState keyboard, string file, params GroupType[] groups
states = new MacroKeyState[] { MacroKeyState.Up };
break;
}
if (states == null)
{
Program.Log("Badly formatted macro " + (currentMacro == null ? "(null)" : currentMacro.Name) + " line(" + i + "): '" + line + "'");
break;
}
for (int j = 0; j < states.Length; j++)
{
MacroKeyState state = states[j];
Expand Down

0 comments on commit 172b754

Please sign in to comment.