5

I own a notebook running Ubuntu 16.04 with Unity DE that does not have any keyboard LEDs to indicate NUM-Lock or CAPS-Lock states.

It would be useful for me to see them anyway, ideally through an indicator in Unity's panel.

Please note that I only want to see the states of NUM-Lock, CAPS-Lock and optionally Scroll-Lock. I do not want to see whether any other modifier keys like Shift, Ctrl, Alt, Super etc. are currently pressed. I only want a replacement for my missing LEDs.

Are there any working indicators available?


I already have read How to add a keyboard modifier state applet to Unity panel?, but it does not suit my needs. indicator-xkbmod only displays a wrong icon but does not react on keyboard NUM-/CAPS-Lock status changes, kbstate is for KDE only and key-mon does not show the NUM-/CAPS-Lock states but indicates key presses to modifier keys.

1
  • If you can find a terminal command(s) that will give you the status of CAPS/NUM/SCROLL lock, you could install indicator-sysmonitor and add custom script which obtains the status information (using the aformentioned terminal command(s)). Refer to this answer and follow the trail. Jul 16, 2016 at 3:24

3 Answers 3

7

Introduction

Disclaimer: I am the author of this indicator

The lks-indicator allows showing the status of all the lock keys , such as Caps, Num, and Scroll lock. By default it shows green icon when no keys are engaged, and switches to red if one or more is engaged, while also showing text representation of which key is active.

Usage:

As shown by -h option:

usage: lks-indicator [-h] [--show-all] [-m]
                     [--ignore-keys IGNORE_KEYS [IGNORE_KEYS ...]]

lks-indicator - Indicates on/off status of Lock keys.

optional arguments:
  -h, --help            show this help message and exit
  --show-all            Show all keys in label
  -m, --monochrome      Use monochrome icon
  --ignore-keys IGNORE_KEYS [IGNORE_KEYS ...]
                        Ignore specified keys (C, N or S)

Starting the indicator via command line is simple:

python lks-indicator

Users can specify which keys to ignore , with multiple keys separated by spaces. For example,

python lks-indicator --ignore-keys N S

By default , indicator only shows text representation of keys when they are engaged. If you want to always show them use --show-all option.

enter image description here

Please use, Quit button to close the indicator, as Ctrl+C shortcut via command line doesn't work well with app-indicators

The indicator by default works with color icons, red and green, but there's also -m option to use monochrome icon.

enter image description here

Installation

git approach

For those who have git installed:

  1. cd /opt
  2. sudo git clone https://github.com/SergKolo/lks-indicator.git
  3. chmod -R +x /opt/lks-indicator/

git will also allow keeping it updated easily with cd /opt/lks-indicator ; git pull , so I strongly recommend using this method.

Zip package approach:

Alternatively, you can download zip package and extract it where you see fit. Debian package is also available in the repository.

To make it start on every login into Unity , please consult this post: How do I start applications automatically on login?

Gnome Users : you will need AppIndicator Support installed , and optionally Gnome Tweak Tool. Otherwise the bracketed text wont be displayed, only red/green icon.

The indicator also has been tested in MATE and Ubuntu Kylin.

13
  • Nice, but can you make the output a bit more clear? I would like something like e.g. N C S for all off and [N] [C] [S] for all on.
    – Byte Commander
    Jul 16, 2016 at 9:36
  • @ByteCommander Will be done. It's a simple task of parsing text. Will ping you once I have updated version Jul 16, 2016 at 9:39
  • @SergiyKolodyazhnyy - This doesn't work anymore on Ubuntu 17.04. Only the monochrome or red icon appears. The icons for Caps, Num, etc. doesn't appear.
    – Raphael
    Jul 16, 2017 at 2:31
  • @Raphael You have to start the indicator with command-line switches to see the letters for keys. Did you try that ? Jul 16, 2017 at 2:34
  • @SergiyKolodyazhnyy - This is what I used: lks-indicator --show-all -m
    – Raphael
    Jul 16, 2017 at 2:40
3

I have also written an application indicator which, in my opinion, looks better.

indicator-keyboard-led

It shows the state of the locks using filled/unfilled circles.

indicator default
Default appearance of the indicator with Num lock on and Caps and Scroll locks off.

indicator menu
Menu of the indicator, shown on click. The locks can be toggled by clicking the respective item in the menu.

indicator short
Alternative (short) appearance of the indicator.

indicator CNS indicator NC indicator C short
You can also change which locks are displayed and in what order.

Installation:

sudo add-apt-repository ppa:adrianiainlam/indicator-keyboard-led
sudo apt-get update
sudo apt-get install indicator-keyboard-led

After installation the postinst script will prompt you for preferences configuration. Visit the GitHub repo for full explanation on these settings.

Usage:

The indicator will be configured to autostart on log-in. To start using the indicator after installation, log-out and log-in again, or manually start the indicator (search for "indicator-keyboard-led" in the dash).

The indicator should be shown at the top right corner, with a filled circle representing a lock turned on and an unfilled circle representing a lock turned off.

Clicking on the indicator should result in a menu with the three locks. Clicking on the menu item would cause the corresponding lock to toggle.

Bug reports and feature requests welcome.

5
  • Looks great, will test it soon.
    – Byte Commander
    Aug 28, 2016 at 17:26
  • Cool thing. However, I have two feature requests: 1) Could you please add a "Quit" menu entry to your indicator, and 2) could you please add an option (e.g. command-line parameter) that allows to hide all Scroll Lock related stuff as this seems not to be supported correctly by Ubuntu... Thanks!
    – Byte Commander
    Aug 29, 2016 at 1:10
  • @ByteCommander Done and done. See edited post (or README).
    – user12205
    Aug 29, 2016 at 4:21
  • @ace - This doesn't work anymore on Ubuntu 17.04. Only the lock icon appears. The icons for Caps, Num, etc. doesn't appear.
    – Raphael
    Jul 16, 2017 at 2:31
  • @Raphael No repro on a Live CD. (Screenshot). If it still doesn't work then perhaps you can try something similar to this? Also please try running it from a terminal and see if any errors or warnings show up.
    – user12205
    Jul 16, 2017 at 17:19
0

I personally use indicator-keylock, it's one the first apps I install when I setup my Ubuntu system. It is included in ubuntu oficial repos for quite some time, works great and looks pretty.

To install, simply: sudo apt install indicator-keylock

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .