Skip to content

Instantly share code, notes, and snippets.

@dluciv
Last active January 23, 2023 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dluciv/bbd9674dd6d876bfe65345e06cea5c75 to your computer and use it in GitHub Desktop.
Save dluciv/bbd9674dd6d876bfe65345e06cea5c75 to your computer and use it in GitHub Desktop.
ShitPad

ShitPad

Turns any cup of coffee priced numpad into a macro-keyboard.

  1. Put or link shitpad file to ~/.config/xkb/symbols, $ ln -s /usr/share/X11/xkb/keycodes/evdev ~/.config/xkb/symbols/shitpad

  2. Config sway as below

    input "1133:49948:Logitech_USB_Keyboard or whatever you plug" {
      xkb_model shitpad
      xkb_layout "shitpad(fxx)"
    }
    

    Separate keyboard model is used for the case when you have your own customizations for evdev, thunkpad or whatever you use as your primary keyboard.

    For Gnome on Wayland, no idea about how to config keyboards separately. For XOrg/X11 (any environment), $ man setxkbmap.

  3. Edit it as you wish. First symbol is generated when NumLock is off, second — when NumLock is on, third — when NumPad Delete (dot/comma) is pressed.

License — CC: BY-NC-SA, Dmitry V. Luciv, <dluciv at dluciv.name>

hidden partial keypad_keys
xkb_symbols "fxx" {
key <NMLK> { [ Num_Lock ] };
key.type[Group1]="FOUR_LEVEL_MIXED_KEYPAD" ;
key <KPDL> {
type[Group1]="THREE_LEVEL",
symbols[Group1] = [ ISO_Level3_Shift, ISO_Level3_Shift ]
};
// RAW NumLock ON Del Pressed
key <KP0> { [ Help, F20, F30 ] };
key <KP1> { [ XF86Macro1, XF86Macro11, F21 ] };
key <KP2> { [ XF86Macro2, XF86Macro12, F22 ] };
key <KP3> { [ F13, F13, F23 ] }; // F13 -- F15 are commonly used,
key <KP4> { [ F14, F14, F24 ] }; // so let them be
key <KP5> { [ F15, F15, F25 ] }; // in 1 and 2 modes.
key <KP6> { [ XF86Macro6, F16, F26 ] };
key <KP7> { [ Undo, F17, F27 ] };
key <KP8> { [ Redo, F18, F28 ] };
key <KP9> { [ XF86Macro9, F19, F29 ] };
key <KPDV> { [ XF86Cut, XF86Cut, XF86Cut ] }; // /
key <KPMU> { [ XF86Copy, XF86Copy, XF86Copy ] }; // *
key <KPSU> { [ XF86Paste, XF86Paste, XF86Paste] }; // -
key <KPAD> { [ XF86Macro3, XF86Macro13, XF86Macro23 ] }; // +
key <BKSP> { [ XF86Macro4, XF86Macro14, XF86Macro24 ] }; // Delete
// Language switch button, similar to "Rus/Lat" or "Alph"
// on Soviet keyboards.
// ISO_Next_Group is generated by XKB itself
// generating it programmatically does not do ok
key <KPEN> { [ ISO_Prev_Group, ISO_Prev_Group, ISO_Prev_Group ] }; // Enter
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment