I am a KDE user thinking about moving to Unity. Due to manual disability, I use sticky keys and in KDE I have an applet in the system panel which shows which modifier keys are active. I remember that Gnome had this feature as well, so do Windows and OS X.
How does one ad the keyboard modifier state applet to the panel in Unity?
Clarification: I have already enabled sticky keys. I am asking how to add an applet which indicates the state of the modifier keys. This indicator would show when the Shift key is depressed, when the Alt key is depressed, when the Tux key is depressed, and when the Ctrl key is depressed. This applet exists in all major desktop environments (KDE, Windows, Mac OSX, and Gnome). It is necessary for accessibility of the desktop.
Here is an image of the keyboard modifier state applet, next to the keyboard layout indicator applet. The modifiers represented are, from left to right, Shift
, Ctrl
, Alt
, I-dont-know-this-one
, Tux/Win
, NumLock
, and CapsLock
. It can be seen that the NumLock key is active.
This is an outstanding issue in Unity:
The code below has been updated, now it can use icons to show state. But it may get slow sometime as I has to update icon file on hard drive then reload it again. (See notes about this issue/limitation in
libappindicator
)A well packaged release was made available on webupd8 ppa (Thanks goes to Alin Andrei /Andrew/)
Reference: Keyboard Modifiers State indicator For Ubuntu: Xkbmod Indicator
Original Answer:
This is not attended to be a canonical answer to the question. It could be counted as a work around. Hopping someone writes sophisticated solution for it.
This a simple prototype keyboard modifiers indicator for Unity.
Image starting from left: Icon, Shift, Locked Caps, Ctrl, Alt, Super, Locked AltGr (Small circle to indicate locked state)
Source file
unity-xkbmod.c
:Installing needed headers/libs: (Not sure if I miss any)
Compiling:
Run:
Note:
libappindicator
used for Unity indicators lack an important feature which make easy to ports other desktops indicators. See Bug #812067 API needed: pixbuf icon setting supportWithout this feature, let's say we need (Shift, Ctrl, Alt, AltGr, Super) with sticky keys active; we have 3 main status for each (Off, On/Latched, Locked). So 3^5 combined icons should be generated. (Where normal case just 3x5 single icons)
That's why I used indicator label with symbols from DejaVu Sans font.
To put an icon, place it in same folder and name it
icon.*
. Accepted formats: png, svg, ico, xpm ...If you don't like any icon, just create a 1x1 px image instead.
References:
xkbwatch
&plasma-widget-kbstate
Another solution which is not perfect, but some may find it useful as it is possible to have full functionality as in KDE like activating a mod with a click.
install
kbstate
appletRun it in
plasma-windowed
playerRegular window
Borderless window
I didn't have much time to play with, but
wmctrl
may help to position, resize and make it on top at launch.Reference: What command to launch a kde plasmoid and the kickstart menu
I did a search for Ubuntu sticky keys monitor and found something which may be helpful here: http://code.google.com/p/key-mon/
Try running
key-mon --sticky
for Support for sticky keys.Reference: http://code.google.com/p/key-mon/
Note that the version available through the software center is 1.6-0ubuntu1. Released June of 2011 which does not support the --sticky switch. If the indicator looks exactly like the above you have the older version Try the latest version at http://code.google.com/p/key-mon/ as of this writing it is keymon_1.17-1_all.deb 229 KB Released Jan 3 2014. Support for --sticky switch tested and confirmed.