Difference between revisions of "Activating Numlock on Bootup"

From ArchWiki
Jump to: navigation, search
(rm temporary i18n template)
m (cleanup)
Line 8: Line 8:
 
[[tr:Açılışta_numlock_etkinleştirme]]
 
[[tr:Açılışta_numlock_etkinleştirme]]
 
[[zh-CN:Activating Numlock on Bootup]]
 
[[zh-CN:Activating Numlock on Bootup]]
== TTY (Teletype) Consoles 1-6 ==
 
  
To activate NumLock during normal bootup in TTY consoles 1-6 (tty1 -> tty6), add the following line to {{ic|/etc/rc.local}}:
+
== Console ==
 +
 
 +
To activate NumLock during normal bootup in TTY (Teletype) consoles 1-6 (tty1 -> tty6) add the following line to {{ic|/etc/rc.local}}:
 +
 
 
  for tty in /dev/tty?; do /usr/bin/setleds -D +num < "$tty"; done
 
  for tty in /dev/tty?; do /usr/bin/setleds -D +num < "$tty"; done
  
If strange things start to happen (the NumLock LED is on, but the num pad still works as arrow keypad), there seems to be a conflict between {{Ic|setleds}} and Xserver.
+
If the NumLock LED is on but the number pad still works as an arrow keypad it may be because of a conflict between {{Ic|setleds}} and Xserver. Limit the {{Ic|for}} command only to the consoles you have set on {{ic|/etc/inittab}}:
Limit the {{Ic|for}} command only to the consoles you have set on {{ic|/etc/inittab}}. For example, for the first 6 consoles (default) :  
+
 
  for tty in /dev/tty{1..6}; do ...
 
  for tty in /dev/tty{1..6}; do ...
  
 
== X.org ==
 
== X.org ==
If you use {{Ic|startx}} to start your X session, simply install the {{Pkg|numlockx}} package and add it to your {{ic|~/.xinitrc}} file.
 
  
Install {{Pkg|numlockx}}:
+
Various methods are available.
# pacman -S numlockx
+
 
 +
=== startx ===
 +
 
 +
Install the {{Pkg|numlockx}} package and add it to the {{ic|~/.xinitrc}} file before {{Ic|exec}}:
  
Add it to {{ic|~/.xinitrc}} before {{Ic|exec}}:
 
 
  #!/bin/sh
 
  #!/bin/sh
 
  #
 
  #
Line 33: Line 36:
 
  numlockx &
 
  numlockx &
 
   
 
   
  exec your_window_manager
+
  exec window_manager
  
 
=== KDM ===
 
=== KDM ===
If you use KDM as a login manager, add :
+
 
 +
If you use KDM as a login manager, add:
 +
 
 
  numlockx on
 
  numlockx on
to your {{ic|/usr/share/config/kdm/Xsetup}}, or to {{ic|/opt/kde/share/config/kdm/Xsetup}} if you're using KDM3.
 
  
Note that this file lives outside of Pacman's protected area, so it might be overwritten on update without warning or creating a {{ic|.pacnew}} file. If it bothers you, add the following line to your {{ic|/etc/pacman.conf}} file (omit the leading slash in the path):
+
to the {{ic|/usr/share/config/kdm/Xsetup}}, or the {{ic|/opt/kde/share/config/kdm/Xsetup}} for KDM3.
 +
 
 +
Note that this file will be overwritten on update without creating a {{ic|.pacnew}} file. To prevent this, add the following line to {{ic|/etc/pacman.conf}} file (omit the leading slash in the path):
  
 
  NoUpgrade = usr/share/config/kdm/Xsetup
 
  NoUpgrade = usr/share/config/kdm/Xsetup
Line 48: Line 54:
 
Go to System Settings, under the Hardware/Input Devices/Keyboard item you will find an option to select the behavior of NumLock.
 
Go to System Settings, under the Hardware/Input Devices/Keyboard item you will find an option to select the behavior of NumLock.
  
 +
==== Alternate Method ====
 +
 +
Alternatively, add the script the {{ic|~/.kde4/Autostart/numlockx}} containing:
  
====Alternate Method====
 
You may alternatively add a script to your {{ic|~/.kde4/Autostart}} directory:
 
$ nano ~/.kde4/Autostart/numlockx
 
Add the following:
 
 
  #!/bin/sh
 
  #!/bin/sh
 
  numlockx on
 
  numlockx on
 +
 
And make it executable:
 
And make it executable:
 +
 
  $ chmod +x ~/.kde4/Autostart/numlockx
 
  $ chmod +x ~/.kde4/Autostart/numlockx
  
===GDM===
+
=== GDM ===
First make sure that you have {{Pkg|numlockx}} (from extra) installed. Then, GDM users may add the following code to {{ic|/etc/gdm/Init/Default}}:
+
 
 +
First make sure that you have {{Pkg|numlockx}} (from extra) installed then add the following code to {{ic|/etc/gdm/Init/Default}}:
 +
 
 
  if [ -x /usr/bin/numlockx ]; then
 
  if [ -x /usr/bin/numlockx ]; then
 
       /usr/bin/numlockx on
 
       /usr/bin/numlockx on
 
  fi
 
  fi
  
===SLiM===
+
=== SLiM ===
In the file {{ic|/etc/slim.conf}} find the line:
+
 
 +
In the file {{ic|/etc/slim.conf}} find the line and uncomment it (remove the {{Ic|#}}):
 +
 
 
  #numlock            on
 
  #numlock            on
and remove the {{Ic|#}}
 

Revision as of 09:07, 5 August 2012


Console

To activate NumLock during normal bootup in TTY (Teletype) consoles 1-6 (tty1 -> tty6) add the following line to /etc/rc.local:

for tty in /dev/tty?; do /usr/bin/setleds -D +num < "$tty"; done

If the NumLock LED is on but the number pad still works as an arrow keypad it may be because of a conflict between setleds and Xserver. Limit the for command only to the consoles you have set on /etc/inittab:

for tty in /dev/tty{1..6}; do ...

X.org

Various methods are available.

startx

Install the numlockx package and add it to the ~/.xinitrc file before exec:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#

numlockx &

exec window_manager

KDM

If you use KDM as a login manager, add:

numlockx on

to the /usr/share/config/kdm/Xsetup, or the /opt/kde/share/config/kdm/Xsetup for KDM3.

Note that this file will be overwritten on update without creating a .pacnew file. To prevent this, add the following line to /etc/pacman.conf file (omit the leading slash in the path):

NoUpgrade = usr/share/config/kdm/Xsetup

KDE4 Users

Go to System Settings, under the Hardware/Input Devices/Keyboard item you will find an option to select the behavior of NumLock.

Alternate Method

Alternatively, add the script the ~/.kde4/Autostart/numlockx containing:

#!/bin/sh
numlockx on

And make it executable:

$ chmod +x ~/.kde4/Autostart/numlockx

GDM

First make sure that you have numlockx (from extra) installed then add the following code to /etc/gdm/Init/Default:

if [ -x /usr/bin/numlockx ]; then
      /usr/bin/numlockx on
fi

SLiM

In the file /etc/slim.conf find the line and uncomment it (remove the #):

#numlock             on