Created
July 29, 2025 21:37
-
-
Save wd5gnr/19fb69301cf9cd5027b7d6c302b3f4cb to your computer and use it in GitHub Desktop.
Macropad configuration script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LAYER=${1:-1} | |
LAYER1=wd5gnr-macro | |
LAYER2=wd5gnr-macro2 | |
LAYER3=wd5gnr-macro3 | |
SELECTED="LAYER$LAYER" | |
FN="/usr/local/share/macropad/${!SELECTED}.yaml" | |
if [ -f "$FN" ] | |
then | |
echo Loading $FN to macropad | |
# for display purposes | |
echo "Layer $LAYER" >/tmp/macropad-current-layer | |
sudo macropad-tool upload "$FN" # note I renamed the command | |
exit 0 | |
else | |
echo Unknown definition "$1" "($FN)" | |
exit 1 | |
fi | |
[/code] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Normal keyboard orientation is when | |
# buttons are on the left side and knobs are on the right. | |
# However, you may want to use the keyboard in another orientation. | |
# To avoid remapping button positions in your head, just set it here. | |
# Possible values are: | |
# (horizontal) | |
# - 'normal': buttons on the left, knobs on the right | |
# - 'upsidedown': buttons on the right, knobs on the left | |
# (vertical) | |
# - 'clockwise': buttons on the top, knobs on the bottom | |
# - 'counterclockwise': buttons on the bottom, knobs on the top | |
orientation: counterclockwise | |
# Different keyboard models have different numbers of buttons and knobs. | |
# Set it here for proper handling. | |
# Count rows and columns with the keyboard in normal orientation (knobs on the right) | |
rows: 3 | |
columns: 4 | |
knobs: 2 | |
# Layers are sets of alternative key mappings. | |
# The current layer is changed using a button on the side of the keyboard | |
# and displayed with LEDs on top (only for the moment of changing). | |
# All keyboards I saw had three layers, but I suppose other variants exist. | |
layers: | |
- buttons: | |
# Array of buttons. | |
# In horizontal orientations it's `rows` rows `columns` buttons each. | |
# In vertical: `columns` rows `rows` buttons each. | |
# Each entry is either a sequence of 'chords' or a mouse event. | |
# A chord is a combination of one key with optional modifiers, | |
# like 'b', 'ctrl-alt-a' or 'win-rctrl-backspace'. | |
# It can also be just modifiers without a key: 'ctrl-alt'. | |
# You may combine up to 5 chords into a sequence using commas: 'ctrl-v,ctrl-c'. | |
# Arbitrary HID usage codes (decimal) may be given like this: '<101>'. | |
# See https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf (section 10) | |
# for HID usage code list. | |
- ["ctrl-alt-shift-a", "ctrl-alt-shift-b", "ctrl-alt-shift-c"] | |
- ["ctrl-alt-shift-d", "ctrl-alt-shift-e", "ctrl-alt-shift-f"] | |
- ["ctrl-alt-shift-g", "ctrl-alt-shift-h", "ctrl-alt-shift-i"] | |
- ["ctrl-alt-shift-j", "ctrl-alt-shift-k", "ctrl-alt-shift-l"] | |
knobs: | |
# Knobs are listed from left to right if horizontal. | |
# Knobs are listed from top to bottom if vertical. | |
# Knobs can be rotated counter-clockwise (ccw) or clockwise (cw) | |
# and pressed down. | |
- ccw: "volumedown" | |
press: "mute" | |
cw: "volumeup" | |
- ccw: "prev" | |
press: "play" | |
cw: "next" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment