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
  • 829

3 Answers3

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
  • 10,923
  • After installing numlockx I dont have lightdm.conf in the /etc/lightdm/ There is just users.conf file. What did I do wrong? – PKM May 25 '16 at 13:00
  • @PKM what version of Ubuntu to you have? And what flavor are you using? Unity/Gnome/KDE? Do you know if you're using lightdm or sddm? – Delorean May 25 '16 at 14:06
  • @PKM I added an alternate method to my answer you could try. – Delorean May 25 '16 at 14:10
  • I am using Ubuntu 16.04 LTS, Gnome flavor. Based on screenshots of DMs, I probably use lightdm, but I dont have that config file, so I really cant say for sure. Thank you, I am going to try that alternative. – PKM May 25 '16 at 15:51
  • No, you should not edit 50-unity-greeter.conf, since it's a package owned file, and any edits will disappear at next upgrade of the unity-greeter package. Create a new file instead - please see my answer. – Gunnar Hjalmarsson May 25 '16 at 16:39
  • I did it by that long terminal command and it looks it worked. Thanks! – PKM May 25 '16 at 16:44
  • @PKM: Good to hear that. I saw only now that you have Ubuntu GNOME, and it uses GDM as default login manager, not lightdm, which probably explains why other suggestions don't apply. – Gunnar Hjalmarsson May 25 '16 at 16:48
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
Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94
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,584
  • Problem is that I dont have numlock on keyboard, so I couldnt activate it. – PKM May 25 '16 at 13:02
  • You have a numpad, but you don't have a numlock key? How did that magic happen? Anyways, you can activate numlock by clicking on the indicator and check the appropiate box. – ipse lute May 25 '16 at 13:52
  • Check this article: https://help.ubuntu.com/community/NumLock – ipse lute May 25 '16 at 13:59
  • Yeah, I know its kinda ironic, I really dont know why manufacturer skipped it on my NB model. I already read that article, but I cant get into "Keyboard Preferences" window. – PKM May 25 '16 at 15:55
  • Ok, so i found two possible workarounds:1-(de)activate numkey in BIOS (http://smallbusiness.chron.com/disable-num-lock-computer-bios-70151.html) OR 2-remap numkey to another physical key (https://radu.cotescu.com/remapping-keys-in-ubuntu-14.04/ OR http://askubuntu.com/questions/24916/how-do-i-remap-certain-keys-or-devices). I hope any of these will help you. – ipse lute May 25 '16 at 16:10
  • I did by terminal command, and now numlock enables right after booting. – PKM May 25 '16 at 16:46
  • Please publish the solution that helped you most as an answer, so that others may benefit from your experience. Thank you. – ipse lute May 25 '16 at 16:51
  • I marked answer that helped me, solution is in it. – PKM May 25 '16 at 22:22