[v1.2] New re-design with icons only instead of labels.
[indicator-keyboard-led.git] / README.md
CommitLineData
fc1c0791
AIL
1# indicator-keyboard-led - simulate keyboard lock keys LED
2
3This is a Unity application indicator designed for keyboards without lock
4keys LED. It allows the user to check the state of the three locks (Caps lock,
5Num lock and Scroll lock) without requiring any mouse or keyboard action. It
6also allows the lock keys to be toggled with mouse clicks, which could be
7useful for keyboards without Scroll lock keys or malfunctioning keyboards.
8
9## Screenshots
10
9900bce1 11![indicator default][sc1]
fc1c0791
AIL
12Default appearance of the indicator with Num lock on and Caps and Scroll locks
13off.
14
9900bce1 15![indicator menu][sc2]
fc1c0791
AIL
16Menu of the indicator, shown on click. The locks can be toggled by clicking
17the respective item in the menu.
18
017d8bd1 19## Installation from Ubuntu PPA
fc1c0791 20
947c2183
AIL
21 sudo add-apt-repository ppa:adrianiainlam/indicator-keyboard-led
22 sudo apt-get update
23 sudo apt-get install indicator-keyboard-led
fc1c0791 24
017d8bd1
AIL
25After installation the postinst script will prompt you for preferences
26configuration. These config are explained here:
fc1c0791 27
017d8bd1 28### Order
170ff396 29
017d8bd1
AIL
30This option allows you to reorder the locks and also to hide
31some locks if you don't need them.
170ff396 32
017d8bd1
AIL
33Use a string consisting of zero or one occurrence of the
34characters 'N', 'C' and 'S' to set this option.
170ff396 35
017d8bd1 36For exampe, the default order is "Num Caps Scroll".
43e5a6e7 37![Num Caps Scroll][sc1]
170ff396 38
017d8bd1 39**CNS** changes this to "Caps Num Scroll".
43e5a6e7 40![Caps Num Scroll][sc4]
170ff396 41
017d8bd1 42**NC** hides Scroll lock from the default appearance.
43e5a6e7 43![Num Caps][sc5]
f462ecb9 44
170ff396
AIL
45[sc1]: screenshots/sc1.png
46[sc2]: screenshots/sc2.png
170ff396
AIL
47[sc4]: screenshots/sc4.png
48[sc5]: screenshots/sc5.png
017d8bd1
AIL
49
50### xdotool
51
52`xdotool` is used to emulate key strokes to set/unset locks on mouse clicks.
53If you installed xdotool at a non-default location, please provide its full
54path (e.g. /home/user/bin/xdotool) with this option.
55
56If it is installed in your $PATH environment variable, or not installed at
57all, leave this option blank.
58
59### Changing your mind
60
61If you want to change these settings afterwards, simply run
62
63 sudo dpkg-reconfigure indicator-keyboard-led
64
65and you will be prompted again.
66
67## Usage
68
cd02f43e
AIL
69The indicator will be configured to autostart on log-in. To start using the
70indicator after installation, log-out and log-in again, or manually start
71the indicator (search for "indicator-keyboard-led" in the dash).
72
017d8bd1
AIL
73The indicator should be shown at the top right corner, with a filled circle
74representing a lock turned on and an unfilled circle representing a lock
75turned off.
76
77Clicking on the indicator should result in a menu with the three locks.
78Clicking on the menu item would cause the corresponding lock to toggle.
170ff396 79
94a2b01e 80## Known bugs / Troubleshooting
9900bce1 81
9429819b
AIL
82### Indicator label does not show on Xfce / XUbuntu
83
84See [#6](https://github.com/adrianiainlam/indicator-keyboard-led/issues/6).
85
73e49461
AIL
86### Pressing Scroll Lock does nothing
87
9900bce1
AIL
88It seems to be a common problem that Scroll Lock is not usable in Ubuntu.
89To solve this, do the following (assuming US keyboard):
90
91 > # backup your symbols file
43e5a6e7 92 > sudo cp /usr/share/X11/xkb/symbols/us{,.distribution}
9900bce1
AIL
93 >
94 > Add the following line in the `xkb_symbols "basic" {` section. Do not worry
95 > if that second line is not there, it is only there for some languages and
96 > was not there for us on my system.
97 >
98 > ...
99 > modifier_map Mod3 { Scroll_Lock }; <==<< Add this line
43e5a6e7 100 >
9900bce1
AIL
101 > include "level3(ralt_switch)" <==<< before this line
102 > };
103 >
104 >
105 > You may have to do the same in your other layouts if you switch between
106 > languages.
107 >
108 > Also, there is a cache where xkb layouts live. You should clear it before
109 > restarting your X server to check the new keyboard symbol file(s).
110 >
111 > sudo dpkg-reconfigure xkb-data
112
113*By Pykler and Giovanni Toraldo on AskUbuntu.* [Source][quotesrc]. Slightly
114modified. [Original source][origsrc] by dm+ on PCLinuxOS-Forums.
115
116[origsrc]: http://www.pclinuxos.com/forum/index.php/topic,125690.msg1052201.html?PHPSESSID=2qsv83lve6dgd0ivq14bfcjc30#msg1052201
117[quotesrc]: http://askubuntu.com/a/597757/274080
f462ecb9 118
94a2b01e 119### Scroll lock does not appear on indicator
73e49461 120
94a2b01e 121Your installed GTK+ version is probably older than 3.18, which
017d8bd1
AIL
122does not support [`gdk_keymap_get_scroll_lock_state ()`][gtkdoc-scroll].
123The earliest Ubuntu release that supports GTK+ 3.18 is 16.04 (Xenial).
124If you use an older version, Scroll lock functionality will be disabled.
125Please consider upgrading your system if you really want Scroll lock.
73e49461 126
94a2b01e 127If your installed GTK+ is 3.18+ then please file a bug report.
73e49461 128
017d8bd1
AIL
129[gtkdoc-scroll]: https://developer.gnome.org/gdk3/stable/gdk3-Keyboard-Handling.html#gdk-keymap-get-scroll-lock-state
130
94a2b01e
AIL
131### Drop-down menu only has "Quit", the clickable locks do not appear
132
133Please verify that xdotool is installed in your PATH with the executable
134bit set. If you provided a custom path to xdotool please verify that it
135is correct and is an executable regular file.
73e49461 136
f462ecb9
AIL
137## Localization
138
43e5a6e7
AIL
139Unfortunately, in order to work-around labels not being shown on newer
140non-Unity-based Ubuntus, I have re-designed the indicators to be based
141purely on icons instead. This means there will no longer be labels to
142localize, and I instead have hardcoded icons.
143
144The icons are SVGs so you can still manually edit them if you want.
145Look for the `<text>` tag at the end of the SVGs.
146
147The menu items shown on click are still localized.
148
149I have included a screenshot below to show the old design (version 1.1)
150which you can still install manually if you wish.
9900bce1 151
43e5a6e7
AIL
152> As motivated by Issue #1, this script has been localized to French (with
153> the assistance of Wikipedia and Google Translate). Corrections to the
154> translation, as well as translations to other languages, are welcome.
155> Feel free to create a pull request or open an issue.
156>
157> ![indicator default, French locale][sc7]
158> Default appearance in a French locale.
017d8bd1
AIL
159
160[sc7]: screenshots/sc7.png
161
fc1c0791
AIL
162## License
163
164The program "indicator-keyboard-led.py" is released under the MIT License.
165Please refer to the file for the full text of the license.
166
43e5a6e7 167The icons "indicator-keyboard-led*.svg" are released to the public domain.
fc1c0791
AIL
168
169## Credits
170
171I would like to thank [Tobias Schlitt](https://github.com/tobyS), who wrote
172[indicator-chars](https://github.com/tobyS/indicator-chars) which I used
173as a reference when writing this software.
174
43e5a6e7 175The icons used in the indicator (indicator-keyboard-led*.svg) are modified
017d8bd1
AIL
176from the file "emblem-readonly.svg" by
177[Jakub Steiner](http://jimmac.musichall.cz)
fc1c0791
AIL
178who released it to the public domain for the
179[Tango Icon Library](http://tango.freedesktop.org/Tango_Icon_Library).
180
181---
182
183## Motivation
184
185I was a user of [indicator-keylock][ind-kl], but only one key lock can be shown
186on the panel. I didn't like the Notify OSD events either.
187
188I then came across [lks-indicator][lks] and [indicator-xbdmod][xbdmod], but
189I didn't like the fact that they refresh the indicator on a regular time
190interval (every *x* milliseconds) rather than on state changes (only when
191the locks are toggled).
192
193I also thought it would be fun to be able to toggle the locks on-screen.
194
195[ind-kl]: https://launchpad.net/~tsbarnes/+archive/ubuntu/indicator-keylock
196[lks]: https://github.com/SergKolo/lks-indicator
197[xbdmod]: https://github.com/sneetsher/indicator-xkbmod