Skip to content

Instantly share code, notes, and snippets.

@peterotool
Last active July 12, 2023 18:26
Show Gist options
  • Save peterotool/ef1147eed4f42dbb33b0672245984dda to your computer and use it in GitHub Desktop.
Save peterotool/ef1147eed4f42dbb33b0672245984dda to your computer and use it in GitHub Desktop.
Nuphy keymaps Linux

Linux keymaps Commands

xev command

❯ tldr xev

  xev

  Print contents of X events.
  More information: https://gitlab.freedesktop.org/xorg/app/xev.

  - Monitor all occurring X events:
    xev

  - Monitor all X events of the root window instead of creating a new one:
    xev -root

  - Monitor all X events of a particular window:
    xev -id window_id

  - Monitor X events from a given category (can be specified multiple times):
    xev -event event_category

xev - print contents of X events

xev | awk -F'[ )]+' '/^KeyPress/ { a[NR+2] } NR in a { printf "%-3s %s\n", $5, $8 }'

xmodmap command

tldr xmodmap

  xmodmap

  Utility for modifying keymaps and pointer button mappings in X.
  More information: https://manned.org/xmodmap.

  - Swap left-click and right-click on the pointer:
    xmodmap -e 'pointer = 3 2 1'

  - Reassign a key on the keyboard to another key:
    xmodmap -e 'keycode keycode = keyname'

  - Disable a key on the keyboard:
    xmodmap -e 'keycode keycode ='

  - Execute all xmodmap expressions in the specified file:
    xmodmap path/to/file

xmodmap -e <KEYCODE> <MODIFIER> = <behaviour> <behaviour_with_modifier>

Swapped keys Multi_key (Left Side) & Super_R (Right Side)

  • Get current key configuration
xmodmap -pke | grep -Pw "37|134" 
  • output (Capture keys number 37 & 134 )
keycode  37 = Multi_key NoSymbol Multi_key 
keycode 134 = Super_R NoSymbol Super_R
  • Swap key configuration: Create $HOME/.Xmodmap file
keycode 37   = Super_R NoSymbol Super_R
keycode 134  = Multi_key NoSymbol Multi_key 

Nuphy Keyboard Configuration

cat << EOF > ~/.Xmodmap
keycode 37   = Super_R NoSymbol Super_R
keycode 134  = Multi_key NoSymbol Multi_key
keycode 105  = Control_R NoSymbol Control_R # reponiendo el keycode original <CTRL> del lado derecho
EOF
cat << EOF > ~/.zshrc
[[ -f ~/.Xmodmap ]] && xmodmap ~/.Xmodmap
EOF

Shortcuts Latin Accents and symbols

https://gist.github.com/kljohann/67cb8c78758af17f0710693f35dc8888

cat << EOF > ~/.XCompose
<Multi_key> <n> : "ñ"
<Multi_key> <N> : "Ñ"
<Multi_key> <a> : "á"
<Multi_key> <A> : "Á"
<Multi_key> <e> : "é"
<Multi_key> <E> : "É"
<Multi_key> <i> : "í"
<Multi_key> <I> : "Í"
<Multi_key> <o> : "ó"
<Multi_key> <O> : "Ó"
<Multi_key> <u> : "ú"
<Multi_key> <U> : "Ú"
EOF

TODO

Add Custom Shortcut :: bind screenshots with "keysym 4"

/snap/bin/flameshot gui      

keysym 4 = 4 dollar   EuroSign      NoSymbol
keysym space = space  NoSymbol      nobreakspace NoSymbol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment