Commit | Line | Data |
---|---|---|
fc1c0791 AIL |
1 | # indicator-keyboard-led - simulate keyboard lock keys LED |
2 | ||
3 | This is a Unity application indicator designed for keyboards without lock | |
4 | keys LED. It allows the user to check the state of the three locks (Caps lock, | |
5 | Num lock and Scroll lock) without requiring any mouse or keyboard action. It | |
6 | also allows the lock keys to be toggled with mouse clicks, which could be | |
7 | useful for keyboards without Scroll lock keys or malfunctioning keyboards. | |
8 | ||
9 | ## Screenshots | |
10 | ||
9900bce1 | 11 | ![indicator default][sc1] |
fc1c0791 AIL |
12 | Default appearance of the indicator with Num lock on and Caps and Scroll locks |
13 | off. | |
14 | ||
9900bce1 | 15 | ![indicator menu][sc2] |
fc1c0791 AIL |
16 | Menu of the indicator, shown on click. The locks can be toggled by clicking |
17 | the respective item in the menu. | |
18 | ||
9900bce1 | 19 | ![indicator short][sc3] |
fc1c0791 AIL |
20 | Alternative (short) appearance of the indicator. |
21 | ||
fc1c0791 AIL |
22 | ## Dependencies |
23 | - Python 3 (*) | |
24 | - GTK+ 3 (*) | |
25 | - AppIndicator 3 (*) | |
26 | - Python 3 GObject introspection (python3-gi) | |
27 | - xdotool | |
28 | ||
29 | Those marked with (*) are probably installed by default in recent Ubuntu | |
30 | distributions. To install the rest, run: | |
31 | ||
32 | sudo apt-get install python3-gi xdotool | |
33 | ||
34 | ## Usage | |
35 | ||
36 | 1. Install the dependencies listed above. | |
37 | 2. Clone this repository. | |
38 | 3. Add the script as a startup application. (Use option `--short` for short | |
170ff396 AIL |
39 | appearance; use option `--order` to customize the order of the locks |
40 | displayed. See [Examples](#examples)) | |
fc1c0791 AIL |
41 | 4. Run the script manually for the first time. (Alternatively, log out |
42 | and log in again.) | |
43 | 5. The indicator should be shown at the top right corner, with a filled circle | |
44 | representing a lock turned on and an unfilled circle representing a lock | |
45 | turned off. | |
46 | 6. Clicking on the indicator should result in a menu with the three locks. | |
47 | Clicking on the menu item would cause the corresponding lock to toggle. | |
48 | ||
170ff396 AIL |
49 | ## Examples |
50 | ||
51 | ![indicator default][sc1] | |
52 | Default appearance. `python3 indicator-keyboard-led.py` | |
53 | ||
54 | ![indicator short][sc3] | |
55 | Short appearance. `python3 indicator-keyboard-led.py --short` | |
56 | ||
57 | ![indicator CNS][sc4] | |
58 | Order changed to Caps Num Scroll. | |
59 | `python3 indicator-keyboard-led.py --order CNS` | |
60 | ||
61 | ![indicator NC][sc5] | |
62 | Hide Scroll lock. `python3 indicator-keyboard-led.py --order NC` | |
63 | ||
a4c6e387 | 64 | ![indicator C short][sc6] |
170ff396 AIL |
65 | Show Caps lock only, short appearance. |
66 | `python3 indicator-keyboard-led.py --short --order C` | |
67 | ||
68 | [sc1]: screenshots/sc1.png | |
69 | [sc2]: screenshots/sc2.png | |
70 | [sc3]: screenshots/sc3.png | |
71 | [sc4]: screenshots/sc4.png | |
72 | [sc5]: screenshots/sc5.png | |
73 | [sc6]: screenshots/sc6.png | |
74 | ||
9900bce1 AIL |
75 | ## Known bugs |
76 | ||
77 | It seems to be a common problem that Scroll Lock is not usable in Ubuntu. | |
78 | To solve this, do the following (assuming US keyboard): | |
79 | ||
80 | > # backup your symbols file | |
81 | > sudo cp /usr/share/X11/xkb/symbols/us{,.distribution} | |
82 | > | |
83 | > Add the following line in the `xkb_symbols "basic" {` section. Do not worry | |
84 | > if that second line is not there, it is only there for some languages and | |
85 | > was not there for us on my system. | |
86 | > | |
87 | > ... | |
88 | > modifier_map Mod3 { Scroll_Lock }; <==<< Add this line | |
89 | > | |
90 | > include "level3(ralt_switch)" <==<< before this line | |
91 | > }; | |
92 | > | |
93 | > | |
94 | > You may have to do the same in your other layouts if you switch between | |
95 | > languages. | |
96 | > | |
97 | > Also, there is a cache where xkb layouts live. You should clear it before | |
98 | > restarting your X server to check the new keyboard symbol file(s). | |
99 | > | |
100 | > sudo dpkg-reconfigure xkb-data | |
101 | ||
102 | *By Pykler and Giovanni Toraldo on AskUbuntu.* [Source][quotesrc]. Slightly | |
103 | modified. [Original source][origsrc] by dm+ on PCLinuxOS-Forums. | |
104 | ||
105 | [origsrc]: http://www.pclinuxos.com/forum/index.php/topic,125690.msg1052201.html?PHPSESSID=2qsv83lve6dgd0ivq14bfcjc30#msg1052201 | |
106 | [quotesrc]: http://askubuntu.com/a/597757/274080 | |
107 | ||
108 | ||
fc1c0791 AIL |
109 | ## License |
110 | ||
111 | The program "indicator-keyboard-led.py" is released under the MIT License. | |
112 | Please refer to the file for the full text of the license. | |
113 | ||
114 | The icon "icon.svg" is released to the public domain. | |
115 | ||
116 | ## Credits | |
117 | ||
118 | I would like to thank [Tobias Schlitt](https://github.com/tobyS), who wrote | |
119 | [indicator-chars](https://github.com/tobyS/indicator-chars) which I used | |
120 | as a reference when writing this software. | |
121 | ||
122 | The icon used in the indicator (icon.svg) is modified from the file | |
123 | "emblem-readonly.svg" by [Jakub Steiner](http://jimmac.musichall.cz) | |
124 | who released it to the public domain for the | |
125 | [Tango Icon Library](http://tango.freedesktop.org/Tango_Icon_Library). | |
126 | ||
127 | --- | |
128 | ||
129 | ## Motivation | |
130 | ||
131 | I was a user of [indicator-keylock][ind-kl], but only one key lock can be shown | |
132 | on the panel. I didn't like the Notify OSD events either. | |
133 | ||
134 | I then came across [lks-indicator][lks] and [indicator-xbdmod][xbdmod], but | |
135 | I didn't like the fact that they refresh the indicator on a regular time | |
136 | interval (every *x* milliseconds) rather than on state changes (only when | |
137 | the locks are toggled). | |
138 | ||
139 | I also thought it would be fun to be able to toggle the locks on-screen. | |
140 | ||
141 | [ind-kl]: https://launchpad.net/~tsbarnes/+archive/ubuntu/indicator-keylock | |
142 | [lks]: https://github.com/SergKolo/lks-indicator | |
143 | [xbdmod]: https://github.com/sneetsher/indicator-xkbmod |