1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

KeyboardSettings: Add checkbox to enable Caps Lock mapping to Ctrl

This patch adds an additional control to KeyboardSettings allowing
the user to map Caps Lock to Ctrl. Previously, this was only possible
by writing to /sys/kernel/variables/caps_lock_to_ctrl.

Writing to /sys/kernel/variables/caps_lock_to_ctrl requires root
privileges, but KeyboardSettings will not attempt to elevate
the privilege of the user if they are not root. Instead, the
checkbox is rendered as un-editable.
This commit is contained in:
sbcohen2000 2022-12-12 13:35:55 -06:00 committed by Tim Flynn
parent 07b83cf3fa
commit 9e21b3f216
4 changed files with 53 additions and 0 deletions

View file

@ -27,7 +27,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio rpath recvfd sendfd proc exec"));
TRY(Core::System::unveil("/res", "r"));
TRY(Core::System::unveil("/bin/keymap", "x"));
TRY(Core::System::unveil("/bin/sysctl", "x"));
TRY(Core::System::unveil("/sys/kernel/keymap", "r"));
TRY(Core::System::unveil("/sys/kernel/variables/caps_lock_to_ctrl", "r"));
TRY(Core::System::unveil("/etc/Keyboard.ini", "r"));
TRY(Core::System::unveil(nullptr, nullptr));