Hi everybody,
just finished a small launcher script. It will load a custom xmodmap keymap if available, start the application and reset the keymap if the app quits.
#!/bin/bash
KBMODDIR=/etc/X11/kb
DEFAULT=$KBMODDIR/corgi.xmodmap
USERFILE=$KBMODDIR/$1.xmodmap
CUSTOMKEYMAP=0
if [ -e $USERFILE ]; then
echo "using available custom keymap $USERFILE"
xmodmap $USERFILE
CUSTOMKEYMAP=1
fi
$1 $2 $3 $4 $5 $6 $7 $8 $9
if [ $CUSTOMKEYMAP -eq 1 ]; then
echo "resetting keymap"
xmodmap $DEFAULT
fi
Just name it launch, put it into /usr/local/bin and make it executable via chmod 755 /usr/local/bin/launch.
It will look into /etc/X11/kb for application-specific keymaps.
For example, if I wanted to launch gqview I would start it by
launch gqview
The script would look into /etc/X11/kb for a file named gqview.xmodmap.
If it\'s found it will be loaded.
Here is the gqview.xmodmap example:
! map scrollwheel up/right to "next picture"
keycode 134 = n
! map scrollwheel down/left to "previous picture"
keycode 133 = b
!map Cancel side-button to "Fullscreen"
keycode 132 = f
!map OK side-button to "Rotate clockwise"
keycode 131 = bracketleft
Just put this file into /etc/X11/kb/
In order to start gqview with this keymapping each time, one would have to change the line
Exec=gqview
to
Exec=launch gqview
in the file
/usr/share/applications/gqview.desktop
You can adjust other applications links accordingly.
You\'ll need to restart either matchbox or the whole X11. Simplest way is pressing CTRL-ALT-Backspace and just restarting the X11 Server via startx.
Please note, that this keymapping is still global for the whole X11 server, so every other application will also have the same key maps. But I think, it\'s still a decent way.
I hope this is usefull to somebody.
Regards,
evilJazz