Thursday, April 12, 2018

linux - Sxhkd not recognising percent key (bspwm)



So I want to create a keybinding using my sxhkd that functions like the binding to create panes in tmux.



I have created bindings before so I know that I can use xev to print out key names, here is the output when pressing % then " :




KeyPress event, serial 32, synthetic NO, window 0x2200001,

root 0x9f, subw 0x0, time 8068709, (324,604), root:(325,624),
state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False



KeyPress event, serial 32, synthetic NO, window 0x2200001,
root 0x9f, subw 0x0, time 8069165, (324,604), root:(325,624),
state 0x1, keycode 14 (keysym 0x25, percent), same_screen YES,
XLookupString gives 1 bytes: (25) "%"

XmbLookupString gives 1 bytes: (25) "%"
XFilterEvent returns: False



KeyRelease event, serial 32, synthetic NO, window 0x2200001,
root 0x9f, subw 0x0, time 8069236, (324,604), root:(325,624),
state 0x1, keycode 14 (keysym 0x25, percent), same_screen YES,
XLookupString gives 1 bytes: (25) "%"
XFilterEvent returns: False



KeyRelease event, serial 32, synthetic NO, window 0x2200001,

root 0x9f, subw 0x0, time 8069615, (324,604), root:(325,624),
state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False



KeyPress event, serial 32, synthetic NO, window 0x2200001,
root 0x9f, subw 0x0, time 8090326, (324,604), root:(325,624),
state 0x0, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:

XFilterEvent returns: False



KeyPress event, serial 32, synthetic NO, window 0x2200001,
root 0x9f, subw 0x0, time 8090442, (324,604), root:(325,624),
state 0x1, keycode 48 (keysym 0x22, quotedbl), same_screen YES,
XLookupString gives 1 bytes: (22) """
XmbLookupString gives 1 bytes: (22) """
XFilterEvent returns: False



KeyRelease event, serial 32, synthetic NO, window 0x2200001,

root 0x9f, subw 0x0, time 8090593, (324,604), root:(325,624),
state 0x1, keycode 48 (keysym 0x22, quotedbl), same_screen YES,
XLookupString gives 1 bytes: (22) """
XFilterEvent returns: False



KeyRelease event, serial 32, synthetic NO, window 0x2200001,
root 0x9f, subw 0x0, time 8090652, (324,604), root:(325,624),
state 0x1, keycode 62 (keysym 0xffe2, Shift_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False





So in my ~/.config/sxhkd/sxhkdrc I have put:



super + percent
bspc window -p right && urxvt
super + quotedbl
bspc window -p down && urxvt



Now when I restart sxhkd and press super + % keys nothing happens, but the other binding works perfectly.




  • Why is sxhkd not recognising the percent key?

  • Does sxhkd identify the percent key as a different name from the one given by xev?






Edit: I did some more searching in the sxhkd git repo and found the file which stores the keysym numbers for each key.




In parse.c:



{"percent"                     , 0x0025}


I tried changing it to 0x25 and recompiling but still no luck. :(


Answer



So after alot of testing I have come up with some solutions of my own.




It turns out the percent key is recognised just fine but just doesnt work together with the super key



Option 1) Add @ infront of the key



 @super + percent
bspc window -p right && urxvt


This works but only functions after you release a key




Option 2) Replace super with any other key



I decided to go with option 2 and replace super with ctrl



ctrl + {percent,quotedbl}
bspc window -p {right,down} && urxvt

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...