0

I just setup Ubuntu 15.04 on my Asus G74Sx laptop. This laptop does not have a physical NumLock key.

My Numpad works fine in Windows 8.1, the SSTYs, as well as lightdm (I can enter numbers via the numpad into the password input).

After logging into Unity it only works for a short time. I succeeded once opening up a terminal and inputting a few numbers, before it got disabled. If I logout it no longer works in lightdm either. I can enable it using numlockx on.

I already tried adding numlockx on to my autostart programs (which did not work) and also using dconf-editor to change org → gnome → settings-daemon → peripherals → keyboard according to a tutorial on German Ubuntuusers (which gets reset after reboot).

The accessibility feature to move the mouse via the numpad is not enabled.

It looks like something disables the numpad after logging into Unity. Any idea?

2
  • If you set it with numlockx on, does it stick? Jun 12, 2015 at 21:26
  • @JacobVlijm Not across reboots. But it always works on the first lightdm after a reboot.
    – TimWolla
    Jun 12, 2015 at 22:04

2 Answers 2

1

Adding the command numlockx on to Startup Applications

Some commands break if you add them to startup applications, because the command needs a fully loaded desktop to run successfully, and Startup Applications runs the commands too early.

If the command

numlockx on

works once you are logged in, I am pretty sure it is a matter of timing to make it work as a startup application. You can add a little break to make it work.

Since Startup Applications creates a .desktop file in ~/.config/autostart to run the startup command, you need the "regular" syntax to add a complicated command (including the break) to be used in a .desktop file, which is in this case:

/bin/bash -c "sleep 15&&numlockx on"

Possibly, you need to play a little with the sleep 15 to optimize.

Edit

An alternative method to run the command at startup is mentioned here, but the result is the same.

EDIT

If your startup procedure (-time) is unpredictable for some reason and/or the numpad is set to off repeatedly by some process during startup, you can make sure it works correctly by adding the script below to your Startup Applications

It keeps an eye on the Numpad, to be set on during the first minute after startup (log in):

#!/bin/bash

n=1
while [ "$n" -ne 60 ]; do
if [ "$( numlockx status )" != "Numlock is on" ]; then
  numlockx on
fi
sleep 1
n=$((n+1))
done

Add to Startup Applications: Dash > Startup Applications > Add, add the command:

/bin/bash /path/to/script.sh
5
  • While that solution works it feels like pretty hacky fixing of the symptoms, instead of the cause (something's disabling the Numpad after Login). I remember having this issue before, but IIRC I managed to get it working without that special start command. Unfortunatly I had to reimage my computer.
    – TimWolla
    Jun 12, 2015 at 22:50
  • @TimWolla Would you, also for clarity reasons, consider accepting the answer? As explained in the link help.ubuntu.com/community/NumLock (official Ubuntu help pages), enabling the Numpad on log in / start up is the appropriate procedure, and you mentioned already it works. Jun 16, 2015 at 11:37
  • I am aware of the accept button. It's just that the solution randomly "stopped working" one boot. I'll monitor this at least a few more days.
    – TimWolla
    Jun 16, 2015 at 11:40
  • @TimWolla see my updated answer Jun 16, 2015 at 12:40
  • Thanks for your further efforts! By chance I found the solution I probably used about 2 or 3 years ago, which completely fixes the situation for me and does not have that race condition (see my answer).
    – TimWolla
    Jun 17, 2015 at 16:01
1

I solved my issue by using gnome-tweak-tool to access the now unavailable keyboard settings of former Gnome / Ubuntu versions.

As I stated my in question my keyboard does not have a physical num lock key. The keys do not have any print for the other functions either:

photo of my numpad

A thread in BackTrack Linux forum suggested to check “Numeric keypad keys work as with Mac”. Further searching revealed this screen shot from an older Gnome version:

which can be found in this answer: https://askubuntu.com/a/130213/27683.

I “ignored” this answer, as the menu is gone in newer Ubuntu versions. Fortunatly I also wanted to disable Caps Lock. Searching revealed that one has to use gnome-tweak-tool to disable Caps Lock. gnome-tweak-tool basically brings back that old menu. Therefore I could also enable the setting to fix my num pad.

gnome-tweak-tool the hero

According to launchpad bug tracker this is the recommended way to enable those additional settings: https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/1245199/comments/6

5
  • Since the question was about enabling numpad on startup, installing a complete gui application seems a bigger load than adding a simple command or a script of a few lines to startup applications. Jun 17, 2015 at 21:06
  • @JacobVlijm I was able to remove the application afterwards. I'm pretty sure there also is a command line interface to that settings.
    – TimWolla
    Jun 17, 2015 at 21:29
  • I am pretty sure it adds some kind of a command to the startup procedure, exactly like the option in the answer or in the mentioned link. Jun 17, 2015 at 21:39
  • 1
    @JacobVlijm It does not. I just downloaded the source code. As I expected it modifies Gnomes configuration using the gsettings command line interface which is part of libglib2.0-bin, which is a dependency of unity. I can fetch the changed configuration using: gsettings get org.gnome.desktop.input-sources xkb-options which in turn spits out: ['caps:none', 'numpad:mac'].
    – TimWolla
    Jun 17, 2015 at 21:54
  • Wow, good research! gsettings set org.gnome.desktop.input-sources xkb-options "['caps:none', 'numpad:mac']" would then have done the job. You might want to add that to your answer :). Jun 18, 2015 at 5:42

You must log in to answer this question.

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