Other Help Topics :: macro keys in fluxbox



I was looking at replacing fluxbox with another window manager.  Not so much because there is anything wrong with fluxbox, but because I was looking for something new and different.  I was looking at keyboard binding, so I thought I'd give the keyboard binding in fluxbox a go and see what could be done.

The two things I wanted to do were:

1) Using the "Print Screen" key on my keyboard to take a snapshot of the whole screen without having to select anything

2) set up the windows keys to act something like the alt and control keys do, so that I could type <Windows> B and have a beaver application open.

The first thing I did was use a program called xev to find out if those keys were set to symbols already.  When you type a character you get all sorts of info about a key, including it's name (if any) and its numeric value.  You can see that the return key has the symble "Return" but the print screen and windows keys do not.  Take a look at the output from the following to find unbound keys you can use:

cat /usr/X11R6/lib/X11/XKeysymDB | more

I chose SunPrint_Screen for my print screen button and IA1 and IA2 for the left an right windows keys.  Next you need to make an input file for xmodmap, which will remap keys and set up the symbles for keys.  Mine was called .Xmodmap and looked like this:

Code Sample
keycode 107 = SunPrint_Screen
keycode 133 = IA1
keycode 134 = IA2
add mod5 = IA1 IA2


run xmodmap .Xmodmap (I did it from a terminal window in X).  This sets the symble for 107 to SunPrint_Screen, and sets the two windows keys to return the symble mod5.

Now the easy part is making the keybinding in fluxbox.  I added these lines to the front of my ~/.fluxbox/keys file:

Code Sample
None SunPrint_Screen :ExecCommand xwd -root > output.xwd
Mod5 b :ExecCommand beaver
Mod5 e :ExecCommand emelfm
Mod5 t :ExecCommand rxvt -rv -fn fixed -cr yellow  -T "Bash" -e /bin/bash


Choose restart from the window manager menu, and your keys are ready for use.

This should be added to the docs. :cool:
Thanks for this Clacker - it'll be interesting to play around with this.
Hello clacker!

Thanks a lot for this post clacker. Now I might be able to get my Alt Gr key to work in Firefox (perhaps). I have a swedish keyboard and it seems that all the scandinavian keyboard-layouts suffer from this problem.

Have fun,
meo

EDIT: changed it around to work and make sense

meo, perhaps you can!  I got the umlaut to work on my american keyboard, so maybe something like this will work for you.

Fist, I looked at the output of xmodmap -pke for Mode-switch which is the alt gr key.  On my keyboard, it was mapped to the right alt key.  Yours might be mapped there, somewhere else, or not at all.  Then I made the following .Xmodmap file and pressing my right alt button and u gave me a ü in rxvt but not in firefox.

Code Sample
keycode 12 = 3 numbersign threesuperior sterling
keycode 38 = a A adiaeresis Adiaeresis
keycode 30 = u U udiaeresis Udiaeresis
keycode 32 = o O odiaeresis Odiaeresis


I think what happens in Firefox is that it grabs both alt keys.  I made this .Xmodmap and now I could type a u with an umlaut in Firefox by hitting <right alt>u

Code Sample
keycode 12 = 3 numbersign threesuperior sterling
keycode 38 = a A adiaeresis Adiaeresis
keycode 30 = u U udiaeresis Udiaeresis
keycode 32 = o O odiaeresis Odiaeresis
remove Mod4 = Mode_switch
add Mod5 = Mode_switch

You might not need the lines beside the two that move the Mode_switch.

now you can umlaut till you drop.

äÄüüöÖ

Next Page...
original here.