On Sun, Mar 20, 2011 at 01:20:13PM -0400, Gregory Seidman wrote: > On Sun, Mar 20, 2011 at 02:58:33PM +0100, lee wrote: > > I would like to use the scroll key to switch the function of the Del > > key on the numpad so that pressing the Del key on the numpad either > > produces a comma (",") or a colon ("."), depending on the state of the > > Scroll key. There?s even a LED on the keyboard to display the state of > > the Scroll key, the LED doesn?t light when pressing the Scroll key. > > > > How would I do this? > > You'll need some way of triggering execution on a keypress.
Ok, I´ve made the following script and bound it to the Scroll_Lock key: #!/bin/sh # # switch keyboard layout between comma and period... # INDICATOR="/home/lee/tmp/.keyboard-state" if [ ! -e $INDICATOR ]; then echo "0" > $INDICATOR else STATE=$(cat $INDICATOR) fi if [ $STATE -eq "0" ]; then xmodmap -e "keycode 91 = KP_Delete KP_Separator KP_Delete KP_Separator" echo "1" > $INDICATOR xset led 3 else xmodmap -e "keycode 91 = KP_Delete KP_Decimal KP_Delete KP_Decimal" echo "0" > $INDICATOR xset -led 3 fi You can modify this to change several keys at the same time or to switch the whole keyboard layout by loading different Xmodmaps. By writing different states (1, 2, 3 ...) to the INDICATOR file, you can modify it to switch between as many layouts as you like. You may need to use different LED numbers with xset, depending on your hardware (and probably your keyboard layout). In my case, no. 3 seems the be the only LED xset can set (perhaps I don´t have Caps_Lock at all in my layout). Perhaps someone besides me has use for this :) Still, I´d like a more elegant solution than this ... -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20110322010808.ge3...@yun.yagibdah.de