TIP Numlock

From Gentoo Linux Wiki

Jump to: navigation, search
This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Annoyed that numlock is turned off by default? This will help you have it automatically turned on.

Contents

[edit] For Console Users

  • Add numlock service to your preferred runlevel (usually default) and you are done.
system ~#
rc-update add numlock defaultImage:CursorOFF.gif

[edit] For users of graphical environments

  • KDE Users do not need numlockx to enable numlock on KDM (see below)
  • First step: install numlockx package
system ~#
emerge numlockxImage:CursorOFF.gif
  • Second step varies with your desktop environment. You can to choose to enable numlock per-user (e.g. after login) and/or sytem-wide (e.g. before you enter password to your login manager)

Alternative: gnome-extra/lock-keys-applet Installing this enables you to put a small applet on your gnome panel that shows you the current state of your keys. Apart from being good for people with keyboards without status leds it also remembers your current states for eg numlock between sessions. http://www.wh-hms.uni-ulm.de/~mfcn/lock-keys-applet/


[edit] System-wide

[edit] For KDM users

- as posted by tosho in the gentoo.forums.org

system ~#
echo '/usr/bin/numlockx on' >> /usr/kde/3.5/share/config/kdm/XsetupImage:CursorOFF.gif

Assuming you have kde 3.5 series (if not, replace 3.5 with 3.4)


KDM 3.5
by magik 7-13-07

numlock x isn't needed to enable numlock on kdm startup, kdm can handle it automatically just add NumLock=On (case sensitive) to /usr/kde/3.5/share/config/kdm/kdmrc

File: /usr/kde/3.5/share/config/kdm/kdmrc
[X-*-Greeter]
ForgingSeed=1182963271
LogoArea=Logo
LogoPixmap=/usr/kde/3.5/share/apps/kdm/pics/kdelogo.png
MaxShowUID=65000
MinShowUID=1000
Preloader=/usr/kde/3.5/bin/preloadkde
Theme=/usr/kde/3.5/share/apps/kdm/themes/Pulsar KDM
UseTheme=true
NumLock=On

[edit] For GDM Users

If you are using gdm, try adding the following code to /etc/X11/gdm/Init/Default above exit 0

File: /etc/X11/gdm/Init/Default
if [ -x /usr/bin/numlockx ]; then
       /usr/bin/numlockx on
fi

Putting it at the top of the file should work, and then run gdm-safe-restart as root.

[edit] For Fluxbox and other Desktop Environment Users

You can add the location of numlockx tool (for instance /usr/X11R6/bin/numlockx) to the relevant session script in /etc/X11/Sessions. For example, the editted version of fluxbox session script looks like:

/usr/X11R6/bin/numlockx
/usr/bin/startfluxbox

[edit] Per user

[edit] For KDE Users

KDE users have it fairly straightforward. See Control Center -> Peripherals -> Keyboard

  • If you installed KDE using split ebuilds, this requires kde-base/kxkb.

[edit] For Gnome Users

  • start the gnome-session-properties tool.
  • At the top of the Window, select Startup Programs and click the Add button.
  • Now insert the location of the numlockx tool (for instance /usr/X11R6/bin/numlockx) and exit.

[edit] For XFCE4.4 Users

Go to Settings -> Autostarted Applications and add a new application with this command : /usr/bin/numlockx on

[edit] For E17 Users

Go to "Configuration > Applications > Create a new application" and fill the fields as you normally would. Once created simply click "Add application.." inside the "startup" folder.

[edit] For other freedesktop Environments

You can put all kinds of programs that you want to autostart during startup in this folder. ~/Desktop/Autostart/ You can do this by making a symlink (not tested) or writing a small script that just starts it.. for example:

File: ~/Desktop/Autostart/02numlockx

numlockx on

Personal tools
In other languages