1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
[[Category:Boot process]]
[[Category:Keyboards]]
[[de:Numlock]]
[[es:Activating Numlock on Bootup]]
[[it:Activating Numlock on Bootup]]
[[ja:Activating Numlock on Bootup]]
[[ru:Activating Numlock on Bootup]]
[[tr:Açılışta_numlock_etkinleştirme]]
[[zh-CN:Activating Numlock on Bootup]]
== Console ==
=== Using a separate service ===
* [[Pacman|Install]] the package {{AUR|systemd-numlockontty}} from the [[AUR]].<br>Now you should enable the {{ic|numLockOnTty}} daemon. Read [[Daemons]] for more details.
* Alternatively, if you don't want to install an aur package to implement this, you can simply create a service file in {{ic|/etc/systemd/system}} like:{{bc|<nowiki>
[Unit]
Description=Switch on numlock from tty1 to tty6
[Service]
ExecStart=/bin/bash -c 'for tty in /dev/tty{1..6};do /usr/bin/setleds -D +num < \"$tty\";done'
[Install]
WantedBy=multi-user.target</nowiki>}}{{note|The filename should have a {{ic|.service}} suffix, e.g. {{ic|numlock1to6.service}}.}} Don't forget to enable the service after you create it.
=== Extending getty@.service ===
This is simpler than using a separate service (especially since systemd-198) and does not hardcode the number of VTs in a script. Create a directory for drop-in configuration files:
{{bc|# mkdir /etc/systemd/system/getty@.service.d}}
Now add the following file in this directory.
{{hc|activate-numlock.conf|<nowiki>
[Service]
ExecStartPre=/bin/sh -c 'setleds +num < /dev/%I'
</nowiki>}}
=== Bash alternative ===
Add {{ic|setleds -D +num}} to {{ic|~/.bash_profile}}. Note that, unlike the other methods, this will not take effect until after you log in.
== X.org ==
Various methods are available.
=== startx ===
Install the {{Pkg|numlockx}} package and add it to the {{ic|~/.xinitrc}} file before {{Ic|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 {{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
=== 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 {{ic|~/.kde4/Autostart/numlockx.sh}} containing:
#!/bin/sh
numlockx on
And make it executable:
$ chmod +x ~/.kde4/Autostart/numlockx.sh
==== Alternate Method 2 ====
This method enables num lock in KDM login screen (e.g. numeric password)
1) Disable "Themed Greeter" in System Settings -> Login Screen
2) in file /usr/share/config/kdm/kdmrc find section
[X-*-Greeter]
Right after that line, add this:
NumLock=On
=== GDM ===
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
/usr/bin/numlockx on
fi
=== GNOME ===
When not using the GDM login manager, numlockx can be added to GNOME's start-up applications.
[[pacman|Install]] {{Pkg|numlockx}} from the [[official repositories]]. Then, add a start-up command to launch {{ic|numlockx}}.
$ gnome-session-properties
The above command opens the '''Startup Applications Preferences''' applet. Click '''''Add''''' and enter the following:
{| class="wikitable"
| Name: || ''Numlockx''
|-
| Command: || ''/usr/bin/numlockx on''
|-
| Comment: || ''Turns on numlock.''
|}
{{note|This is not a system-wide change, repeat these steps for each user wishing to activate NumLock after logging in.}}
=== SDDM ===
In the file {{ic|/etc/sddm.conf}}, add the following line under the {{ic|[General]}} section:
[General]
Numlock=on
=== SLiM ===
In the file {{ic|/etc/slim.conf}} find the line and uncomment it (remove the {{Ic|#}}):
#numlock on
=== OpenBox ===
In the file {{ic|~/.config/openbox/autostart}} add the line:
numlockx &
And then save the file.
=== LightDM ===
See [[LightDM#NumLock on by default]].
|