Skip to content

KDE Plasma Experience Optimization: Fixing Login Focus, Numlock, and Function Key Mapping

When frequently switching Linux distributions, some detail configurations, if left unadjusted, can always make the experience feel “disconnected.” This article records three essential detail optimizations I always make in the KDE Plasma environment: enabling the numeric keypad on the login screen, fixing keyboard function key mapping, and making the login box automatically focus on the password field.

Reading Notes:

  1. This tutorial uses the KDE environment with SDDM as the login manager as an example.
  2. When modifying system files, please ensure you have sudo privileges.
  3. Practical Example: The third part of this article will use the Blackglass theme as an example, diving deep into the source code logic for adaptation.
  4. Vim Tips: A Vim Operation Guide is included at the end to help you move beyond nano.

Phase 1: Enable Numeric Keypad on SDDM Login Screen

Many distributions do not enable Numlock on the login screen by default. If you’re used to entering passwords with the numeric keypad, having to manually press the Numlock key every time you boot is very disruptive to the smooth experience of entering the system.

1. Create Configuration File

We need to manually specify the enable behavior in SDDM’s configuration directory.

Execute the command in terminal to create the configuration file with Vim:

sudo vim /etc/sddm.conf.d/numlock.conf

2. Write Enable Parameters

Press i to enter insert mode, paste the following content:

[General]
Numlock=on

Save and exit (type :wq and press Enter). After the next system restart, you’ll find the numeric keypad is already enabled by default.


Phase 2: Fix Function Key Mapping for Apple-Style Keyboards

If you’re using an Apple-layout keyboard (like Keychron or some membrane keyboards), or if the system recognizes and uses the hid_apple driver, you might encounter the situation where “pressing F5 to refresh actually adjusts the volume.” This is because the driver defaults to prioritizing media functions.

1. Temporary Test

You can test the modified feel without restarting.

Execute the following command in terminal for immediate effect:

echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode

2. Permanent Driver Configuration

To make the setting persist after restarts, we need to write it into the system’s module configuration.

Create and edit the modprobe configuration file:

sudo vim /etc/modprobe.d/hid_apple.conf

Write the following key parameter:

options hid_apple fnmode=2

After configuration is complete, F1-F12 will return to their original functions and no longer require the Fn key.


Phase 3: Auto-Focus Password Input Box on Login Screen (Using Blackglass Theme as Example)

This is an ultimate detail optimization. In many third-party themes, the focus defaults to the “username input box.” If you’ve enabled “remember last logged-in user,” then every boot only requires entering the password.

Since each theme’s source code structure is different (some call it Login.qml, others Main.qml), here I’ll use the Blackglass theme as an example for breakdown.

1. Locate Theme Files

Blackglass’s core logic is located in Main.qml.

Enter the theme directory:

cd /usr/share/sddm/themes/blackglass/

2. Modify Component Focus Properties

We need to disable focus on the username box and manually enable focus on the password box.

Backup and open the source code:

sudo cp Main.qml Main.qml.bak && sudo vim Main.qml

Use / in Vim to search for keywords, and modify the following two places:

  • Username box (id: nameinput): Comment out focus: true
  • Password box (id: password): Add focus: true
// Username input section
TextField {
id: nameinput
// focus: true <-- Comment this out
...
}

// Password input section
TextField {
id: password
focus: true // <-- Explicitly enable here
...
}

3. Modify Lifecycle Hook (onCompleted)

This is the most critical step. Blackglass executes initialization code when the interface loads. If you don’t synchronize the modifications here, the previous settings will be overwritten.

Jump to the end of the file (press G in Vim), find the Component.onCompleted block and make the following adjustments:

Component.onCompleted : {
// nameinput.focus = true <-- Comment out this line
password.focus = true // <-- Ensure password box gets focus
textback.state = "nay" // <-- Ensure username box's selected highlight state is reset
}

[Supplement] Productivity Tool: Vim Operation Guide

If you’re unfamiliar with Vim operations while executing the above tutorial, you can refer to the following common commands.

1. Mode Switching

  • Normal Mode (default): Press Esc to enter. Keys are function commands in this mode.
  • Insert Mode: Press i in normal mode to enter. You can type in this mode.

2. Search and Navigation

  • Search: In normal mode, type / + keyword + Enter. Press n to jump to the next match.
  • Jump to line: Type G to jump directly to the end of the file, type gg to return to the beginning.

3. Save and Exit (must be entered in normal mode with a colon)

  • :wq – Save and exit.
  • :q! – Force quit without saving any changes.

Conclusion

Without configuring these details, the system is really “hard to deal with.” The fun of Linux lies in fixing these inconvenient things one by one until they match your habits.

I hope this practical record using the Blackglass theme as an example can help everyone. If you encounter focus failure issues when modifying other themes, feel free to discuss in the comments below.

Can it really be done this way? Yes, Linux can be played with like this.

About this Post

This post is written by 青空由依(AozoraYui)/青空由纪(AozoraYuki)/青空葵(AozoraAoi), licensed under CC BY-NC 4.0.

#Linux #KDE #Desktop Environment #Efficiency