summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Guschin <guschin@altlinux.org>2025-03-02 12:18:11 +0400
committerAndrew Guschin <guschin@altlinux.org>2025-03-02 12:18:11 +0400
commitb160fe859e7c337630d273accafe2def229cb09a (patch)
treecace2f563809fde4c8807e8dd7b6d26250f53eae
parent5a7748de28291b9a0ad5968205f35c13399acfdc (diff)
feat: script for toggling off laptop keyboard
-rwxr-xr-x.local/bin/toggle-laptop-keyboard25
1 files changed, 25 insertions, 0 deletions
diff --git a/.local/bin/toggle-laptop-keyboard b/.local/bin/toggle-laptop-keyboard
new file mode 100755
index 0000000..912f5eb
--- /dev/null
+++ b/.local/bin/toggle-laptop-keyboard
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+export STATUS_FILE="$XDG_RUNTIME_DIR/keyboard.status"
+
+enable_keyboard() {
+ printf "true" >"$STATUS_FILE"
+ notify-send -u normal "Enabling Keyboard"
+ hyprctl keyword '$LAPTOP_KB_ENABLED' "true" -r
+}
+
+disable_keyboard() {
+ printf "false" >"$STATUS_FILE"
+ notify-send -u normal "Disabling Keyboard"
+ hyprctl keyword '$LAPTOP_KB_ENABLED' "false" -r
+}
+
+if ! [ -f "$STATUS_FILE" ]; then
+ enable_keyboard
+else
+ if [ $(cat "$STATUS_FILE") = "true" ]; then
+ disable_keyboard
+ elif [ $(cat "$STATUS_FILE") = "false" ]; then
+ enable_keyboard
+ fi
+fi