prism-keyboard
A utility for changing the system keyboard layout on the fly. It provides a comprehensive, searchable list of all available X11 keyboard layouts (e.g., US, German, Dvorak) via 08 Rofi. When a selection is made, the change is applied instantly to the current session and saved permanently to the 01 Hyprland configuration.
How it works
- Discovery: The script locates the
base.lstrules file provided by thexorg.xkeyboardconfigpackage. This file serves as the master list of valid keyboard layouts on Linux. - Parsing: It uses
awkto extract layout codes (likeus,de,fr) and their full descriptions (like "English (US)", "German") from the rules file. If the file is missing (rare), it falls back to a short list of common layouts. - Selection: The list is piped into
rofi, allowing the user to search by country name or language (e.g., typing "Italy" finds theitcode). - Application:
- Immediate: Uses
hyprctl keyword input:kb_layout <code> to switch the layout instantly without restarting the session. - Permanent: Uses
sedto update thekb_layoutline in$HOME/.config/hypr/input.conf, ensuring the choice persists after a reboot.
- Immediate: Uses
- Feedback: Sends a desktop notification confirming the new layout.
Dependencies
rofi: The selection menu interface.hyprland: Provideshyprctlfor immediate layout switching.xorg.xkeyboardconfig: Provides the database of keyboard layouts.gnused&gawk: Text processing tools for config updates and parsing.libnotify: Sends the confirmation notification.
Usage
To open the keyboard layout selector:
prism-keyboard
Configuration
This script expects your Hyprland input configuration to be located at $HOME/.config/hypr/input.conf and to contain a line starting with kb_layout =.
If you changed this line this script will not work.