Amarok/Archives/Howto use Capslock the right way

From KDE Community Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

This Howto describes howto start amarok, send amarok to tray and maximize it with your Capslock button.

Verify your Keycode

Every Key on your Keyboard has a unique Keycode. Generally speaking Capslock has the Keycode 66.
To verify this information, there is a tool called "xev".

$ xev

now a little window pops up and lots of information will fill your terminal. When you move your mouse, xev will post even more Information. So best focus the window popped up earlier and do not touch your mouse.
You just have to press the Key on your Keyboard to gain the information you need.

Press the Capslock Key and some Text should appear in your terminal, that looks a little like this one:

KeyPress event, serial 27, synthetic NO, window 0x1200001,

   root 0x3f, subw 0x0, time 53368, (89,13), root:(180,178),
   state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
   XLookupString gives 0 bytes: 
   XmbLookupString gives 0 bytes: 
   XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0x1200001,

   root 0x3f, subw 0x0, time 53471, (89,13), root:(180,178),
   state 0x2, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
   XLookupString gives 0 bytes:

You can stop xev by typing "ctrl c" in the terminal, that runs xev.

Modmaps

Xorg handles your Keyboard by Modmaps. In these Modmaps every Key has a unique Keycode and it is ensured that one Key fullfills one task.
To re-define your Capslock you have to make your own Modmap.
There are Usermodmaps ( ~/.Xmodmap) and Sysmodmaps (/usr/X11R6/lib/X11/xinit/.Xmodmap).

The Xserver is checking for these Modmaps on every startup. So you just have to make one of these files to change the behaviour of your Capslock button.

Howto Change Capslock in OpenSuSE

If you use Suse, the best way is to make a Usermodmap.

$ touch ~/.Xmodmap
$ youreditorhere ~/.Xmodmap

then put these two lines in the .Xmodmap file:
remove Lock = Caps_Lock
keycode 66 = F21

When you restart X Capslock has the shortcut F21.

Howto Change Capslock in Gentoo

The Usermodmap does not work in case you use KDM or WDM as your Displaymanager. (if it works for you i'd appreciate a feedback.thx.)
So we have to make a Sysmodmap.

$ touch /usr/X11R6/lib/X11/xinit/.Xmodmap

This modmap is loaded by default.

$ youreditorhere /usr/X11R6/lib/X11/xinit/.Xmodmap

Now put these two lines in your .Xmodmap file:

remove Lock = Caps_Lock
keycode 66 = F21

$ restartx

Set your shortcut for amarok

The Capslock Key is now defined as Key F21.
Set your Shortcut for Amarok to F21 and you can start Amarok, send it to tray and remaximize it by just pressing capslock.

In Kde you can set your Shortcuts by opening Kcontrol -> Regional & Accessibility -> Keyboard shortcuts -> Command Shortcuts -> Multimedia -> Amarok

The easiest way to set your Shortcut in Wmaker is to add Amarok to your right-click-menu. You can set your shortcut with WPrefs.