In this topic user @greengeek discovered that he -seemingly - can create JWM shortcuts using an Alt+<key> combination that would work only when the right Alt_R+<key> is pressed. Unfortunately doesn't work this way. For JWM and ROX all Alt keys work the same.. mostly (for certain keyboard maps the right Alt key will not work at all)
Wouldn't it be nice if JWM could distinguish between the 2 available Alt keys? Well, it is possible with a trick and - at least for me - it works nicely.
So far I used to invoke my favorite console rxvt with the shortcut Alt+C. My file /root/.jwm/jwmrc-personal contained the line
Code: Select all
<Key key="C" mask="A">exec:rxvt</Key>
Instead of calling rxvt directly, I now call a script, which I named key_ALT_C:
Code: Select all
<Key key="C" mask="A">exec:/path/to/key_ALT_C</Key>
The script:
Code: Select all
#!/bin/ash
# to be invoked with Alt+C shortcut (JWM or ROX)
# or by clicking on ROX icon with Alt key(s) pressed
for ID in $(xinput | sed -r '/slave *keyboard/!d;/hotkeys|webcam|button|virtual|video/Id;s/.*=([0-9]+).*/\1/'); do
case $(xinput query-state $ID | grep '=down') in
*64*108*) exec lxterminal ;; # Alt_L+Alt_R
*64*) exec rxvt ;; # Alt_L
*108*) exec urxvt ;; # Alt_R
esac
done
# Default if run by clicking on ROX icon without pressing any Alt key:
exec defaultterminal
The script tries to find out the ID of my keyboard (discussed in viewtopic.php?t=10250 ), then checks if the left Alt key (keycode 64), the right Alt key (keycode 108) or both are pressed. This means I can run 3 different terminal emulators, depending on which Alt key I pressed, and use only 1 JWM shortcut.
The script works the same when creating a ROX desktop icon for it. In this case I could run even 4 different commands because clicking on the icon without pressing any Alt key provides another option.