aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaKooLit <ejhay.games@gmail.com>2024-06-09 08:10:54 +0900
committerJaKooLit <ejhay.games@gmail.com>2024-06-09 08:10:54 +0900
commita1e56128aa7c16d9d147270ad59e7d57fa0597cf (patch)
treeef664c3098cdc1c8f44aff8e2af83cb532316720
parent1a5cc9de22a75335bd495e9ed4eef80d3b683b2c (diff)
updated disabling touchpad script
-rw-r--r--config/hypr/UserConfigs/Laptops.conf8
-rwxr-xr-xconfig/hypr/scripts/TouchPad.sh37
2 files changed, 29 insertions, 16 deletions
diff --git a/config/hypr/UserConfigs/Laptops.conf b/config/hypr/UserConfigs/Laptops.conf
index 2f1f2077..1a1226a9 100644
--- a/config/hypr/UserConfigs/Laptops.conf
+++ b/config/hypr/UserConfigs/Laptops.conf
@@ -7,6 +7,9 @@ $mainMod = SUPER
$scriptsDir = $HOME/.config/hypr/scripts
$UserConfigs = $HOME/.config/hypr/UserConfigs
+# for disabling Touchpad. hyprctl devices to get device name.
+$Touchpad_Device=asue1209:00-04f3:319f-touchpad
+
binde = , xf86KbdBrightnessDown, exec, $scriptsDir/BrightnessKbd.sh --dec #Keyboard brightness Down
binde = , xf86KbdBrightnessUp, exec, $scriptsDir/BrightnessKbd.sh --inc #Keyboard brightness up
bind = , xf86Launch1, exec, rog-control-center # ASUS Armory crate button
@@ -23,6 +26,11 @@ bind = $mainMod CTRL, F6, exec, $scriptsDir/ScreenShot.sh --in5 # Screenshot in
bind = $mainMod ALT, F6, exec, $scriptsDir/ScreenShot.sh --in10 # Screenshot in 10 secs
bind = ALT, F6, exec, $scriptsDir/ScreenShot.sh --active # Screenshot active window
+$TOUCHPAD_ENABLED = true
+device {
+ name = $Touchpad_Device
+ enabled = $TOUCHPAD_ENABLED
+}
# Below are useful when you are connecting your laptop in external display
# Suggest you edit below for your laptop display
# From WIKI This is to disable laptop monitor when lid is closed.
diff --git a/config/hypr/scripts/TouchPad.sh b/config/hypr/scripts/TouchPad.sh
index e94ee068..228e4ca2 100755
--- a/config/hypr/scripts/TouchPad.sh
+++ b/config/hypr/scripts/TouchPad.sh
@@ -1,27 +1,32 @@
#!/bin/bash
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
# For disabling touchpad.
-# Edit the Touchpad_Device according to your system
+# Edit the Touchpad_Device on ~/.config/hypr/UserConfigs/Laptops.conf according to your system
# use hyprctl devices to get your system touchpad device name
+# source https://github.com/hyprwm/Hyprland/discussions/4283?sort=new#discussioncomment-8648109
-
-Touchpad_Device="asue1209:00-04f3:319f-touchpad"
notif="$HOME/.config/swaync/images/bell.png"
-XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)}
-STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status"
+export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status"
-toggle_touchpad() {
- if [ ! -f "$STATUS_FILE" ] || [ "$(cat "$STATUS_FILE")" = "false" ]; then
- echo "true" > "$STATUS_FILE"
- action="enabled"
- else
- echo "false" > "$STATUS_FILE"
- action="disabled"
- fi
+enable_touchpad() {
+ printf "true" >"$STATUS_FILE"
+ notify-send -u low -i $notif "Enabling touchpad"
+ hyprctl keyword '$TOUCHPAD_ENABLED' "true" -r
+}
- notify-send -u low -i "$notif" "Touchpad $action"
- hyprctl keyword "device[$Touchpad_Device]:enabled" "$(cat "$STATUS_FILE")"
+disable_touchpad() {
+ printf "false" >"$STATUS_FILE"
+ notify-send -u low -i $notif "Disabling touchpad"
+ hyprctl keyword '$TOUCHPAD_ENABLED' "false" -r
}
-toggle_touchpad
+if ! [ -f "$STATUS_FILE" ]; then
+ enable_touchpad
+else
+ if [ $(cat "$STATUS_FILE") = "true" ]; then
+ disable_touchpad
+ elif [ $(cat "$STATUS_FILE") = "false" ]; then
+ enable_touchpad
+ fi
+fi
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage