2

I want numlock enabled everytime when Ubuntu starts. Here I found a guide how to do it, I just can not get into "Keyboard Preferences". When I go into "Keyboard" there are just "Typing" and "Shortcuts" tabs. In "Text Entry", there is nothing ragarding layout or preferences too. Or is that screenshot from older version and todays version doesnt contain these settings?

PKM
  • 839

4 Answers4

4

If you want numlock to be enabled before getting to the login screen

sudo apt-get install numlockx

Then edit the file /etc/lightdm/lightdm.conf

And add this line to the bottom:

greeter-setup-script=/usr/bin/numlockx on

This will enable the numlock before you login as opposed to something like indicator-keylock which only loads with the desktop. It's handy if you have numbers in your username or password and you want to use the number pad.

If you're not using lightdm and don't have the above mentioned file or directory, then put this into terminal:

sudo sed -i 's|^exit 0.*$|# Numlock enable\n[ -x /usr/bin/numlockx ] \&\& numlockx on\n\nexit 0|' /etc/rc.local

This will enabled it on boot, but in a different way.

Delorean
  • 11,563
1

Personally I find the guide you mentioned unnecessarily complicated. The official Ubuntu Desktop Guide explains it clearer:

https://help.ubuntu.com/stable/ubuntu-help/numeric-keypad.html

However, the recommended command to make it work also on the login screen is about to be changed from using /usr/share to using /etc. Hence it will be:

sudo sh -c 'printf "[Seat:*]\ngreeter-setup-script=numlockx on\n" >/etc/lightdm/lightdm.conf.d/50-numlock.conf'

Note: Before this change has made it into Xenial, you need to first create the directory:

sudo mkdir /etc/lightdm/lightdm.conf.d
0

I'm a Linux newbe, I am always used to having numlock on. I dug for hours but finally developed the following solution:

  1. Create a shell script containing: "setleds -D +num < /dev/tty1"

  2. Add to crontab "@reboot /folder/numlock.sh"

That worked for me on Ubuntu Server 22.04.4

GrantJ
  • 1
0

Open a Terminal window and type:

sudo add-apt-repository ppa:tsbarnes/indicator-keylock
sudo apt-get update
sudo apt-get install indicator-keylock indicator-keylock'

Then press numlock key to activate it. The indicator will make sure it will remain active even after reboot.

ipse lute
  • 2,614