I use a usb keyboard with my laptop. It has a layout that's different from
the builtin, so I have script to switch between them. But if I forget to switch before unplugging, I have no super. Now I'm in a different room, and I can't be bothered to get my keyboard. I can't get to a terminal in this x session without super, but I can switch to a different console. But if I try to execute the script there, it says cannot open display 'default display'. Can I run it for the open x session from the console?
PS: the script:
#!/bin/bash
killall xcape
if lsusb | grep HHKB ; then {
setxkbmap us,gr \
-variant carpalx-plus-intl,daedalus \
-option grp:win_space_toggle \
-option lv3:rwin_switch \
-option altwin:meta_alt \
-option shift:breaks_caps \
-option lv5:lsgt_switch_lock
xmodmap ~/.xmodmap/hh
xcape -e "Shift_L=F13;Shift_R=F13;Super_L=Prior;Hyper_L=Prior"
} &
else {
setxkbmap us,gr \
-variant carpalx-plus-intl,daedalus \
-option grp:win_space_toggle \
-option lv3:ralt_switch \
-option altwin:meta_alt \
-option shift:breaks_caps -option lv5:lsgt_switch_lock
xmodmap ~/.xmodmap/apple
xcape -e "Control_L=Escape;Shift_L=F13;Shift_R=F13;Alt_L=Escape;Alt_R=Escape"
} &
fi