From a35a1c4e980081566287dd6e2510f658f046cad1 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Thu, 8 Jan 2026 21:02:00 -0500 Subject: Fixing hyprland-dots scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TouchPad.sh never expands $TOUCHPAD_ENABLED - (and doesn’t source the file that defines it), so the toggle command is - currently doesn't work. - Volume.sh has multiple microphone-control bugs - bad pamixer arguments, typoed function name, invalid notification payloads - that break mic toggling and volume feedback. - DarkLight.sh wipes the Qt theme paths each run - because the qt5ct/qt6ct palette variables are commented out. - KooLsDotsUpdate.sh contains a malformed notify-send string that - crashes the script when no local version is detected. - Distro_update.sh runs sudo apt upgrade outside the kitty window, - so the Debian/Ubuntu flow never finishes inside the terminal. On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: config/hypr/scripts/DarkLight.sh modified: config/hypr/scripts/Distro_update.sh modified: config/hypr/scripts/KooLsDotsUpdate.sh modified: config/hypr/scripts/TouchPad.sh modified: config/hypr/scripts/Volume.sh --- config/hypr/scripts/TouchPad.sh | 48 ++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 13 deletions(-) (limited to 'config/hypr/scripts/TouchPad.sh') diff --git a/config/hypr/scripts/TouchPad.sh b/config/hypr/scripts/TouchPad.sh index 030c36de..f14165a0 100755 --- a/config/hypr/scripts/TouchPad.sh +++ b/config/hypr/scripts/TouchPad.sh @@ -5,28 +5,50 @@ # use hyprctl devices to get your system touchpad device name # source https://github.com/hyprwm/Hyprland/discussions/4283?sort=new#discussioncomment-8648109 +set -euo pipefail + notif="$HOME/.config/swaync/images/ja.png" +laptops_conf="$HOME/.config/hypr/UserConfigs/Laptops.conf" + +touchpad_device="${TOUCHPAD_DEVICE:-}" +if [[ -z "$touchpad_device" && -f "$laptops_conf" ]]; then + touchpad_device="$( + awk -F= '/^\$Touchpad_Device/ { + gsub(/[[:space:]]*/, "", $1); + gsub(/^[[:space:]]+|[[:space:]]+$/, "", $2); + print $2; + exit + }' "$laptops_conf" + )" +fi + +if [[ -z "$touchpad_device" ]]; then + notify-send -u low -i "$notif" " Touchpad" " Device name not set (check Laptops.conf)" + exit 1 +fi -export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" +touchpad_keyword="${TOUCHPAD_KEYWORD:-device:${touchpad_device}:enabled}" +status_file="${XDG_RUNTIME_DIR:-/tmp}/touchpad.status" enable_touchpad() { - printf "true" >"$STATUS_FILE" - notify-send -u low -i $notif " Enabling" " touchpad" - hyprctl keyword '$TOUCHPAD_ENABLED' "true" -r + printf "true" >"$status_file" + notify-send -u low -i "$notif" " Enabling" " touchpad" + hyprctl keyword "$touchpad_keyword" true -r } disable_touchpad() { - printf "false" >"$STATUS_FILE" - notify-send -u low -i $notif " Disabling" " touchpad" - hyprctl keyword '$TOUCHPAD_ENABLED' "false" -r + printf "false" >"$status_file" + notify-send -u low -i "$notif" " Disabling" " touchpad" + hyprctl keyword "$touchpad_keyword" false -r } -if ! [ -f "$STATUS_FILE" ]; then - enable_touchpad -else - if [ $(cat "$STATUS_FILE") = "true" ]; then +current_state="false" +if [[ -f "$status_file" ]]; then + current_state="$(<"$status_file")" +fi + +if [[ "$current_state" == "true" ]]; then disable_touchpad - elif [ $(cat "$STATUS_FILE") = "false" ]; then +else enable_touchpad - fi fi -- cgit v1.2.3