diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-01-08 21:02:00 -0500 |
|---|---|---|
| committer | Don Williams <don.e.williams@gmail.com> | 2026-01-08 21:02:00 -0500 |
| commit | a35a1c4e980081566287dd6e2510f658f046cad1 (patch) | |
| tree | 40e31c0cbee8edc0986698880824cfd07026c5c4 | |
| parent | b32d5df54895bc89f139592cb2116ebeeabe73dd (diff) | |
Fixing hyprland-dots scripts
- 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
| -rwxr-xr-x | config/hypr/scripts/DarkLight.sh | 12 | ||||
| -rwxr-xr-x | config/hypr/scripts/Distro_update.sh | 2 | ||||
| -rwxr-xr-x | config/hypr/scripts/KooLsDotsUpdate.sh | 12 | ||||
| -rwxr-xr-x | config/hypr/scripts/TouchPad.sh | 48 | ||||
| -rwxr-xr-x | config/hypr/scripts/Volume.sh | 69 |
5 files changed, 106 insertions, 37 deletions
diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index a225c7bc..37016ec3 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -20,6 +20,10 @@ kitty_conf="$HOME/.config/kitty/kitty.conf" wallust_config="$HOME/.config/wallust/wallust.toml" pallete_dark="dark16" pallete_light="light16" +qt5ct_dark="$HOME/.config/qt5ct/colors/Catppuccin-Mocha.conf" +qt5ct_light="$HOME/.config/qt5ct/colors/Catppuccin-Latte.conf" +qt6ct_dark="$HOME/.config/qt6ct/colors/Catppuccin-Mocha.conf" +qt6ct_light="$HOME/.config/qt6ct/colors/Catppuccin-Latte.conf" # intial kill process for pid in waybar rofi swaync ags swaybg; do @@ -44,6 +48,14 @@ else # Logic for Light mode wallpaper_path="$light_wallpapers" fi +# Select Qt color scheme templates for the upcoming mode +if [ "$next_mode" = "Dark" ]; then + qt5ct_color_scheme="$qt5ct_dark" + qt6ct_color_scheme="$qt6ct_dark" +else + qt5ct_color_scheme="$qt5ct_light" + qt6ct_color_scheme="$qt6ct_light" +fi # Function to update theme mode for the next cycle update_theme_mode() { diff --git a/config/hypr/scripts/Distro_update.sh b/config/hypr/scripts/Distro_update.sh index 2b3376e3..917f303b 100755 --- a/config/hypr/scripts/Distro_update.sh +++ b/config/hypr/scripts/Distro_update.sh @@ -27,7 +27,7 @@ elif command -v dnf &> /dev/null; then notify-send -i "$iDIR/ja.png" -u low 'Fedora system' 'has been updated.' elif command -v apt &> /dev/null; then # Debian-based (Debian, Ubuntu, etc.) - kitty -T update sudo apt update && sudo apt upgrade -y + kitty -T update bash -c "sudo apt update && sudo apt upgrade -y" notify-send -i "$iDIR/ja.png" -u low 'Debian/Ubuntu system' 'has been updated.' elif command -v zypper &> /dev/null; then # openSUSE-based diff --git a/config/hypr/scripts/KooLsDotsUpdate.sh b/config/hypr/scripts/KooLsDotsUpdate.sh index 51277ab1..a49f5430 100755 --- a/config/hypr/scripts/KooLsDotsUpdate.sh +++ b/config/hypr/scripts/KooLsDotsUpdate.sh @@ -5,12 +5,12 @@ # Local Paths local_dir="$HOME/.config/hypr" iDIR="$HOME/.config/swaync/images/" -local_version=$(ls $local_dir/v* 2>/dev/null | sort -V | tail -n 1 | sed 's/.*v\(.*\)/\1/') +local_version=$(find "$local_dir" -maxdepth 1 -name 'v*' -printf '%f\n' 2>/dev/null | sort -V | tail -n 1 | sed 's/^v//') KooL_Dots_DIR="$HOME/Hyprland-Dots" # exit if cannot find local version if [ -z "$local_version" ]; then - notify-send -i "$iDIR/error.png" "ERROR "!?!?!!"" "Unable to find KooL's dots version . exiting.... " + notify-send -i "$iDIR/error.png" 'ERROR !?!?!!' "Unable to find KooL's dots version. Exiting." exit 1 fi @@ -19,7 +19,7 @@ branch="main" github_url="https://github.com/JaKooLit/Hyprland-Dots/tree/$branch/config/hypr/" # Fetch the version from GitHub URL - KooL's dots -github_version=$(curl -s $github_url | grep -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+' | sort -V | tail -n 1 | sed 's/v//') +github_version=$(curl -s "$github_url" | grep -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+' | sort -V | tail -n 1 | sed 's/v//') # Cant find GitHub URL - KooL's dots version if [ -z "$github_version" ]; then @@ -39,13 +39,13 @@ else case "$response" in "action1") - if [ -d $KooL_Dots_DIR ]; then + if [ -d "$KooL_Dots_DIR" ]; then if ! command -v kitty &> /dev/null; then notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Kitty terminal not found. Please install Kitty terminal." exit 1 fi kitty -e bash -c " - cd $KooL_Dots_DIR && + cd \"$KooL_Dots_DIR\" && git stash && git pull && ./copy.sh && @@ -59,7 +59,7 @@ else fi kitty -e bash -c " git clone --depth=1 https://github.com/JaKooLit/Hyprland-Dots.git $KooL_Dots_DIR && - cd $KooL_Dots_DIR && + cd \"$KooL_Dots_DIR\" && chmod +x copy.sh && ./copy.sh && notify-send -u critical -i "$iDIR/ja.png" 'Update Completed:' 'Kindly log out and relogin to take effect' 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 diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index d870519c..e1034a68 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -7,8 +7,14 @@ sDIR="$HOME/.config/hypr/scripts" # Get Volume get_volume() { + if [[ "$(pamixer --get-mute)" == "true" ]]; then + echo "Muted" + return + fi + + local volume volume=$(pamixer --get-volume) - if [[ "$volume" -eq "0" ]]; then + if [[ "$volume" -eq 0 ]]; then echo "Muted" else echo "$volume %" @@ -17,12 +23,15 @@ get_volume() { # Get icons get_icon() { - current=$(get_volume) - if [[ "$current" == "Muted" ]]; then + if [[ "$(pamixer --get-mute)" == "true" ]]; then echo "$iDIR/volume-mute.png" - elif [[ "${current%\%}" -le 30 ]]; then + return + fi + + current=$(pamixer --get-volume) + if [[ "$current" -le 30 ]]; then echo "$iDIR/volume-low.png" - elif [[ "${current%\%}" -le 60 ]]; then + elif [[ "$current" -le 60 ]]; then echo "$iDIR/volume-mid.png" else echo "$iDIR/volume-high.png" @@ -31,11 +40,18 @@ get_icon() { # Notify notify_user() { - if [[ "$(get_volume)" == "Muted" ]]; then - notify-send -e -h string:x-canonical-private-synchronous:volume_notif -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$(get_icon)" " Volume:" " Muted" + local muted="$(pamixer --get-mute)" + local level="$(pamixer --get-volume)" + + if [[ "$muted" == "true" || "$level" -eq 0 ]]; then + notify-send -e -h string:x-canonical-private-synchronous:volume_notif \ + -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$(get_icon)" \ + " Volume:" " Muted" else - notify-send -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$(get_icon)" " Volume Level:" " $(get_volume)" && - "$sDIR/Sounds.sh" --volume + notify-send -e -h int:value:"$level" -h string:x-canonical-private-synchronous:volume_notif \ + -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$(get_icon)" \ + " Volume Level:" " ${level}%" && + "$sDIR/Sounds.sh" --volume fi } @@ -71,13 +87,14 @@ toggle_mic() { if [ "$(pamixer --default-source --get-mute)" == "false" ]; then pamixer --default-source -m && notify-send -e -u low -h boolean:SWAYNC_BYPASS_DND:true -i "$iDIR/microphone-mute.png" " Microphone:" " Switched OFF" elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then - pamixer -u --default-source u && notify-send -e -u low -h boolean:SWAYNC_BYPASS_DND:true -i "$iDIR/microphone.png" " Microphone:" " Switched ON" + pamixer --default-source -u && notify-send -e -u low -h boolean:SWAYNC_BYPASS_DND:true -i "$iDIR/microphone.png" " Microphone:" " Switched ON" fi } # Get Mic Icon get_mic_icon() { - current=$(pamixer --default-source --get-volume) - if [[ "$current" -eq "0" ]]; then + local muted="$(pamixer --default-source --get-mute)" + local current="$(pamixer --default-source --get-volume)" + if [[ "$muted" == "true" || "$current" -eq "0" ]]; then echo "$iDIR/microphone-mute.png" else echo "$iDIR/microphone.png" @@ -86,8 +103,14 @@ get_mic_icon() { # Get Microphone Volume get_mic_volume() { + if [[ "$(pamixer --default-source --get-mute)" == "true" ]]; then + echo "Muted" + return + fi + + local volume volume=$(pamixer --default-source --get-volume) - if [[ "$volume" -eq "0" ]]; then + if [[ "$volume" -eq 0 ]]; then echo "Muted" else echo "$volume %" @@ -96,9 +119,21 @@ get_mic_volume() { # Notify for Microphone notify_mic_user() { - volume=$(get_mic_volume) - icon=$(get_mic_icon) - notify-send -e -h int:value:"$volume" -h "string:x-canonical-private-synchronous:volume_notif" -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$icon" " Mic Level:" " $volume" + local muted="$(pamixer --default-source --get-mute)" + local level="$(pamixer --default-source --get-volume)" + local icon message + + if [[ "$muted" == "true" || "$level" -eq 0 ]]; then + icon="$iDIR/microphone-mute.png" + notify-send -e -h "string:x-canonical-private-synchronous:volume_notif" \ + -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$icon" \ + " Mic Level:" " Muted" + else + icon="$iDIR/microphone.png" + notify-send -e -h int:value:"$level" -h "string:x-canonical-private-synchronous:volume_notif" \ + -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$icon" \ + " Mic Level:" " ${level}%" + fi } # Increase MIC Volume @@ -113,7 +148,7 @@ inc_mic_volume() { # Decrease MIC Volume dec_mic_volume() { if [ "$(pamixer --default-source --get-mute)" == "true" ]; then - toggle-mic + toggle_mic else pamixer --default-source -d 5 && notify_mic_user fi |
