From bee9efdf510a71e4b9b4a44e60f9092ab7bd076c Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sat, 27 Jan 2024 21:54:18 +0000 Subject: [PATCH 01/16] feat: Notify volume change with sound feedback Play a sound when changing volume --- config/hypr/scripts/Volume.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index 1c18211..425920e 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -3,6 +3,7 @@ # Scripts for volume controls for audio and mic iDIR="$HOME/.config/swaync/icons" +sDIR="/usr/share/sounds/freedesktop/stereo" # Get Volume get_volume() { @@ -34,6 +35,7 @@ notify_user() { notify-send -e -h string:x-canonical-private-synchronous:volume_notif -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 -u low -i "$(get_icon)" "Volume: $(get_volume)" + paplay "$sDIR/audio-volume-change.oga" fi } From f9bc6913d974d5d1d328b2fb989841640ac93be0 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sat, 27 Jan 2024 23:46:32 +0000 Subject: [PATCH 02/16] feat: Add screenshot sounds & notifications Add sounds for screenshots with freedesktop.org sound theme. Notify for screenshots taken with swappy and move swappy capture to ScreenShot.sh. --- config/hypr/configs/Keybinds.conf | 2 +- config/hypr/scripts/ScreenShot.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index 1da7e9f..3ecc4a3 100644 --- a/config/hypr/configs/Keybinds.conf +++ b/config/hypr/configs/Keybinds.conf @@ -78,7 +78,7 @@ bind = $mainMod ALT, Print, exec, $scriptsDir/ScreenShot.sh --in10 #screenshot i bind = ALT, Print, exec, $scriptsDir/ScreenShot.sh --active #screenshot in 10 secs # screenshot with swappy (another screenshot tool) -bind = $mainMod SHIFT, S, exec, grim -g "$(slurp)" - | swappy -f - +bind = $mainMod SHIFT, S, exec, $scriptsDir/ScreenShot.sh --swappy # Resize windows binde = $mainMod SHIFT, left, resizeactive,-50 0 diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index ddf4398..d0ec1f5 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -3,6 +3,7 @@ # Screenshots scripts iDIR="$HOME/.config/swaync/icons" +sDIR="/usr/share/sounds/freedesktop/stereo" notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" time=$(date "+%d-%b_%H-%M-%S") @@ -29,6 +30,8 @@ notify_view() { ${notify_cmd_shot} "Screenshot NOT Saved." fi fi + elif [[ "$1" == "swappy" ]]; then + ${notify_cmd_shot} "Screenshot Captured." } @@ -74,6 +77,13 @@ shotarea() { notify_view } +shotswappy() { + tmpfile=$(mktemp) + grim -g "$(slurp)" - >"$tmpfile" && paplay "${sDIR}/camera-shutter.oga" && notify_view "swappy" + swappy -f - <"$tmpfile" + rm "$tmpfile" +} + shotactive() { active_window_class=$(hyprctl -j activewindow | jq -r '(.class)') active_window_file="Screenshot_${time}_${active_window_class}.png" @@ -101,8 +111,10 @@ elif [[ "$1" == "--area" ]]; then shotarea elif [[ "$1" == "--active" ]]; then shotactive +elif [[ "$1" == "--swappy" ]]; then + shotswappy else - echo -e "Available Options : --now --in5 --in10 --win --area --active" + echo -e "Available Options : --now --in5 --in10 --win --area --active --swappy" fi exit 0 From 909b48934f6c5915c3cd67b4a55d3c40594bbbdd Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sat, 27 Jan 2024 23:59:42 +0000 Subject: [PATCH 03/16] Fix last commit --- config/hypr/scripts/ScreenShot.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index d0ec1f5..6b701ff 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -19,19 +19,22 @@ notify_view() { if [[ "$1" == "active" ]]; then if [[ -e "${active_window_path}" ]]; then ${notify_cmd_shot} "Screenshot of '${active_window_class}' Saved." + paplay "${sDIR}/camera-shutter.oga" else ${notify_cmd_shot} "Screenshot of '${active_window_class}' not Saved" fi + elif [[ "$1" == "swappy" ]]; then + ${notify_cmd_shot} "Screenshot Captured." else local check_file="$dir/$file" if [[ -e "$check_file" ]]; then ${notify_cmd_shot} "Screenshot Saved." + paplay "${sDIR}/camera-shutter.oga" else ${notify_cmd_shot} "Screenshot NOT Saved." fi fi - elif [[ "$1" == "swappy" ]]; then - ${notify_cmd_shot} "Screenshot Captured." + } @@ -77,13 +80,6 @@ shotarea() { notify_view } -shotswappy() { - tmpfile=$(mktemp) - grim -g "$(slurp)" - >"$tmpfile" && paplay "${sDIR}/camera-shutter.oga" && notify_view "swappy" - swappy -f - <"$tmpfile" - rm "$tmpfile" -} - shotactive() { active_window_class=$(hyprctl -j activewindow | jq -r '(.class)') active_window_file="Screenshot_${time}_${active_window_class}.png" @@ -94,6 +90,13 @@ shotactive() { notify_view "active" } +shotswappy() { + tmpfile=$(mktemp) + grim -g "$(slurp)" - >"$tmpfile" && paplay "${sDIR}/camera-shutter.oga" && notify_view "swappy" + swappy -f - <"$tmpfile" + rm "$tmpfile" +} + if [[ ! -d "$dir" ]]; then mkdir -p "$dir" From 1839a6349add03ce1051c6313fcdd8739a62c840 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 00:59:05 +0000 Subject: [PATCH 04/16] Switch to pw-play change from paplay to pw-play --- config/hypr/scripts/ScreenShot.sh | 6 +++--- config/hypr/scripts/Volume.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 6b701ff..1cec086 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -19,7 +19,7 @@ notify_view() { if [[ "$1" == "active" ]]; then if [[ -e "${active_window_path}" ]]; then ${notify_cmd_shot} "Screenshot of '${active_window_class}' Saved." - paplay "${sDIR}/camera-shutter.oga" + pw-play "${sDIR}/camera-shutter.oga" else ${notify_cmd_shot} "Screenshot of '${active_window_class}' not Saved" fi @@ -29,7 +29,7 @@ notify_view() { local check_file="$dir/$file" if [[ -e "$check_file" ]]; then ${notify_cmd_shot} "Screenshot Saved." - paplay "${sDIR}/camera-shutter.oga" + pw-play "${sDIR}/camera-shutter.oga" else ${notify_cmd_shot} "Screenshot NOT Saved." fi @@ -92,7 +92,7 @@ shotactive() { shotswappy() { tmpfile=$(mktemp) - grim -g "$(slurp)" - >"$tmpfile" && paplay "${sDIR}/camera-shutter.oga" && notify_view "swappy" + grim -g "$(slurp)" - >"$tmpfile" && pw-play "${sDIR}/camera-shutter.oga" && notify_view "swappy" swappy -f - <"$tmpfile" rm "$tmpfile" } diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index 425920e..8322e29 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -35,7 +35,7 @@ notify_user() { notify-send -e -h string:x-canonical-private-synchronous:volume_notif -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 -u low -i "$(get_icon)" "Volume: $(get_volume)" - paplay "$sDIR/audio-volume-change.oga" + pw-play "$sDIR/audio-volume-change.oga" fi } From 4ee1bbf3b1ff83f954e323caf6f3ded444d0761c Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 03:06:42 +0000 Subject: [PATCH 05/16] Move sounds to UserScripts Allow user to mute desktop sounds --- config/hypr/UserScripts/Sounds.sh | 19 +++++++++++++++++++ config/hypr/scripts/ScreenShot.sh | 8 ++++---- config/hypr/scripts/Volume.sh | 4 ++-- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100755 config/hypr/UserScripts/Sounds.sh diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh new file mode 100755 index 0000000..6bec1ea --- /dev/null +++ b/config/hypr/UserScripts/Sounds.sh @@ -0,0 +1,19 @@ +#!/bin/bash +## /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# This script is used to play system sounds. + +# Set the directory for system sounds. +sDIR="/usr/share/sounds/freedesktop/stereo" + +# Set to true to mute the system sounds. +muted=false + +if [[ "$muted" = true ]]; then + exit 0 +fi + +if [[ "$1" == "--shutter" ]]; then + pw-play "$sDIR/camera-shutter.oga" +elif [[ "$1" == "--volume" ]]; then + pw-play "$sDIR/audio-volume-change.oga" +fi diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 1cec086..3fb2580 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -3,7 +3,7 @@ # Screenshots scripts iDIR="$HOME/.config/swaync/icons" -sDIR="/usr/share/sounds/freedesktop/stereo" +sDIR="$HOME/.config/hypr/UserScripts" notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" time=$(date "+%d-%b_%H-%M-%S") @@ -19,7 +19,7 @@ notify_view() { if [[ "$1" == "active" ]]; then if [[ -e "${active_window_path}" ]]; then ${notify_cmd_shot} "Screenshot of '${active_window_class}' Saved." - pw-play "${sDIR}/camera-shutter.oga" + "${sDIR}/Sounds.sh" --shutter else ${notify_cmd_shot} "Screenshot of '${active_window_class}' not Saved" fi @@ -29,7 +29,7 @@ notify_view() { local check_file="$dir/$file" if [[ -e "$check_file" ]]; then ${notify_cmd_shot} "Screenshot Saved." - pw-play "${sDIR}/camera-shutter.oga" + "${sDIR}/Sounds.sh" --shutter else ${notify_cmd_shot} "Screenshot NOT Saved." fi @@ -92,7 +92,7 @@ shotactive() { shotswappy() { tmpfile=$(mktemp) - grim -g "$(slurp)" - >"$tmpfile" && pw-play "${sDIR}/camera-shutter.oga" && notify_view "swappy" + grim -g "$(slurp)" - >"$tmpfile" && "${sDIR}/Sounds.sh" --shutter && notify_view "swappy" swappy -f - <"$tmpfile" rm "$tmpfile" } diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index 8322e29..8c5af5d 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -3,7 +3,7 @@ # Scripts for volume controls for audio and mic iDIR="$HOME/.config/swaync/icons" -sDIR="/usr/share/sounds/freedesktop/stereo" +sDIR="$HOME/.config/hypr/UserScripts" # Get Volume get_volume() { @@ -35,7 +35,7 @@ notify_user() { notify-send -e -h string:x-canonical-private-synchronous:volume_notif -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 -u low -i "$(get_icon)" "Volume: $(get_volume)" - pw-play "$sDIR/audio-volume-change.oga" + "$sDIR/Sounds.sh" --volume fi } From 80433d7fc5a69d9c44123d9768f4216d6275ab03 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 04:44:15 +0000 Subject: [PATCH 06/16] Allow Sounds script to find and change sound themes Sounds script allows user to mute or use any compatible freedesktop sound theme for desktop sound effects. This script will search in the home directory and system diretory for freedesktop sound themes to use. --- config/hypr/UserScripts/Sounds.sh | 47 +++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index 6bec1ea..1bcb181 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -2,18 +2,49 @@ ## /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # This script is used to play system sounds. -# Set the directory for system sounds. -sDIR="/usr/share/sounds/freedesktop/stereo" - -# Set to true to mute the system sounds. -muted=false +theme="freedesktop" # Set the theme for the system sounds. +muted=false # Set to true to mute the system sounds. +# Exit if the system sounds are muted. if [[ "$muted" = true ]]; then - exit 0 + exit 0 +fi + +# Set the directory defaults for system sounds. +userDIR="$HOME/.local/share/sounds" +systemDIR="/usr/share/sounds" +defaultTheme="freedesktop" + +# Prefer the user's theme, but use the system's if it doesn't exist. +sDIR="$systemDIR/$defaultTheme" +if [ -d "$userDIR/$theme" ]; then + sDIR="$userDIR/$theme" +elif [ -d "$systemDIR/$theme" ]; then + sDIR="$systemDIR/$theme" fi +# Get the theme that it inherits. +iTheme=$(cat "$sDIR/index.theme" | grep -i "inherits" | cut -d "=" -f 2) +iDIR="$sDIR/../$iTheme" + +# Choose the sound to play. if [[ "$1" == "--shutter" ]]; then - pw-play "$sDIR/camera-shutter.oga" + soundoption="camera-shutter.*" elif [[ "$1" == "--volume" ]]; then - pw-play "$sDIR/audio-volume-change.oga" + soundoption="audio-volume-change.*" +fi + +# Find the sound file and play it. +sound_file=$(find $sDIR/stereo -name "$soundoption" -print -quit) +if test -f "$sound_file"; then + pw-play "$sound_file" +else + sound_file=$(find $iDIR/stereo -name "$soundoption" -print -quit) + if test -f "$sound_file"; then + pw-play "$sound_file" + elif test -f "$userDIR/$defaultTheme/$soundoption"; then + pw-play "$userDIR/$defaultTheme/$soundoption" + else + pw-play "$systemDIR/$defaultTheme/$soundoption" + fi fi From 3a48d52e34f033ddf54e732749032c84e79825d6 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 17:25:01 +0000 Subject: [PATCH 07/16] Handle file not found error Add exit code 1 when no suitable file is found --- config/hypr/UserScripts/Sounds.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index 1bcb181..d7f08e4 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -45,6 +45,11 @@ else elif test -f "$userDIR/$defaultTheme/$soundoption"; then pw-play "$userDIR/$defaultTheme/$soundoption" else - pw-play "$systemDIR/$defaultTheme/$soundoption" + if test -f "$systemDIR/$defaultTheme/$soundoption"; then + pw-play "$systemDIR/$defaultTheme/$soundoption" + else + echo "Error: Sound file not found." + exit 1 + fi fi fi From 6b59626f6feaa690367bdb40c84eece6f1cd04c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20O=27Brien?= Date: Sun, 28 Jan 2024 17:41:54 +0000 Subject: [PATCH 08/16] Remove whitespace in ScreenShot.sh --- config/hypr/scripts/ScreenShot.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 3fb2580..f56c58d 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -34,7 +34,6 @@ notify_view() { ${notify_cmd_shot} "Screenshot NOT Saved." fi fi - } From b51fa2711196eb7ed2e42cd899defd1d233afd89 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 17:56:44 +0000 Subject: [PATCH 09/16] List arguments for Sounds.sh List arguments when no valid argument is given --- config/hypr/UserScripts/Sounds.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index d7f08e4..ef62e3f 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -32,6 +32,9 @@ if [[ "$1" == "--shutter" ]]; then soundoption="camera-shutter.*" elif [[ "$1" == "--volume" ]]; then soundoption="audio-volume-change.*" +else + echo -e "Available sounds: --shutter, --volume" + exit 0 fi # Find the sound file and play it. From a12faec054ccdff3faec2f82390c3b39f3816036 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 18:44:54 +0000 Subject: [PATCH 10/16] Check arguments before initialise Sounds.sh --- config/hypr/UserScripts/Sounds.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index ef62e3f..99ec9da 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -10,6 +10,16 @@ if [[ "$muted" = true ]]; then exit 0 fi +# Choose the sound to play. +if [[ "$1" == "--shutter" ]]; then + soundoption="camera-shutter.*" +elif [[ "$1" == "--volume" ]]; then + soundoption="audio-volume-change.*" +else + echo -e "Available sounds: --shutter, --volume" + exit 0 +fi + # Set the directory defaults for system sounds. userDIR="$HOME/.local/share/sounds" systemDIR="/usr/share/sounds" @@ -27,16 +37,6 @@ fi iTheme=$(cat "$sDIR/index.theme" | grep -i "inherits" | cut -d "=" -f 2) iDIR="$sDIR/../$iTheme" -# Choose the sound to play. -if [[ "$1" == "--shutter" ]]; then - soundoption="camera-shutter.*" -elif [[ "$1" == "--volume" ]]; then - soundoption="audio-volume-change.*" -else - echo -e "Available sounds: --shutter, --volume" - exit 0 -fi - # Find the sound file and play it. sound_file=$(find $sDIR/stereo -name "$soundoption" -print -quit) if test -f "$sound_file"; then From 47101284b0b654eb0c83a1bd20725c7580eb87a0 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 20:08:38 +0000 Subject: [PATCH 11/16] Allow muting individual sounds Allow user to mute volume ONLY or screenshots ONLY. --- config/hypr/UserScripts/Sounds.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index 99ec9da..a2523a2 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -5,6 +5,10 @@ theme="freedesktop" # Set the theme for the system sounds. muted=false # Set to true to mute the system sounds. +# Mute individual sounds here. +mutedScreenshots=false +muteVolume=false + # Exit if the system sounds are muted. if [[ "$muted" = true ]]; then exit 0 @@ -12,8 +16,14 @@ fi # Choose the sound to play. if [[ "$1" == "--shutter" ]]; then + if [[ "$mutedScreenshots" = true ]]; then + exit 0 + fi soundoption="camera-shutter.*" elif [[ "$1" == "--volume" ]]; then + if [[ "$muteVolume" = true ]]; then + exit 0 + fi soundoption="audio-volume-change.*" else echo -e "Available sounds: --shutter, --volume" From ed716d91bc6c4f5ebca9bbfb24ceba48137538cc Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 20:30:53 +0000 Subject: [PATCH 12/16] Use correct sound file for screen capture Use screen-capture instead of camera-shutter for screenshots --- config/hypr/UserScripts/Sounds.sh | 6 +++--- config/hypr/scripts/ScreenShot.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index a2523a2..9aaafcf 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -15,18 +15,18 @@ if [[ "$muted" = true ]]; then fi # Choose the sound to play. -if [[ "$1" == "--shutter" ]]; then +if [[ "$1" == "--screenshot" ]]; then if [[ "$mutedScreenshots" = true ]]; then exit 0 fi - soundoption="camera-shutter.*" + soundoption="screen-capture.*" elif [[ "$1" == "--volume" ]]; then if [[ "$muteVolume" = true ]]; then exit 0 fi soundoption="audio-volume-change.*" else - echo -e "Available sounds: --shutter, --volume" + echo -e "Available sounds: --screenshot, --volume" exit 0 fi diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index f56c58d..fa1b40a 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -19,7 +19,7 @@ notify_view() { if [[ "$1" == "active" ]]; then if [[ -e "${active_window_path}" ]]; then ${notify_cmd_shot} "Screenshot of '${active_window_class}' Saved." - "${sDIR}/Sounds.sh" --shutter + "${sDIR}/Sounds.sh" --screenshot else ${notify_cmd_shot} "Screenshot of '${active_window_class}' not Saved" fi @@ -29,7 +29,7 @@ notify_view() { local check_file="$dir/$file" if [[ -e "$check_file" ]]; then ${notify_cmd_shot} "Screenshot Saved." - "${sDIR}/Sounds.sh" --shutter + "${sDIR}/Sounds.sh" --screenshot else ${notify_cmd_shot} "Screenshot NOT Saved." fi @@ -91,7 +91,7 @@ shotactive() { shotswappy() { tmpfile=$(mktemp) - grim -g "$(slurp)" - >"$tmpfile" && "${sDIR}/Sounds.sh" --shutter && notify_view "swappy" + grim -g "$(slurp)" - >"$tmpfile" && "${sDIR}/Sounds.sh" --screenshot && notify_view "swappy" swappy -f - <"$tmpfile" rm "$tmpfile" } From 628364022eca36c2d02f13635c49b6c766622fea Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 20:33:42 +0000 Subject: [PATCH 13/16] typo --- config/hypr/UserScripts/Sounds.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index 9aaafcf..bc27c92 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -3,20 +3,20 @@ # This script is used to play system sounds. theme="freedesktop" # Set the theme for the system sounds. -muted=false # Set to true to mute the system sounds. +mute=false # Set to true to mute the system sounds. # Mute individual sounds here. -mutedScreenshots=false +muteScreenshots=false muteVolume=false # Exit if the system sounds are muted. -if [[ "$muted" = true ]]; then +if [[ "$mute" = true ]]; then exit 0 fi # Choose the sound to play. if [[ "$1" == "--screenshot" ]]; then - if [[ "$mutedScreenshots" = true ]]; then + if [[ "$muteScreenshots" = true ]]; then exit 0 fi soundoption="screen-capture.*" From e2c1144266279c6b522b4ff7e96f578f85b0fcbf Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 21:06:07 +0000 Subject: [PATCH 14/16] Fix fallback sounds Fix Sounds.sh not finding files correctly. --- config/hypr/UserScripts/Sounds.sh | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index bc27c92..0d2bfff 100755 --- a/config/hypr/UserScripts/Sounds.sh +++ b/config/hypr/UserScripts/Sounds.sh @@ -49,20 +49,17 @@ iDIR="$sDIR/../$iTheme" # Find the sound file and play it. sound_file=$(find $sDIR/stereo -name "$soundoption" -print -quit) -if test -f "$sound_file"; then - pw-play "$sound_file" -else +if ! test -f "$sound_file"; then sound_file=$(find $iDIR/stereo -name "$soundoption" -print -quit) - if test -f "$sound_file"; then - pw-play "$sound_file" - elif test -f "$userDIR/$defaultTheme/$soundoption"; then - pw-play "$userDIR/$defaultTheme/$soundoption" - else - if test -f "$systemDIR/$defaultTheme/$soundoption"; then - pw-play "$systemDIR/$defaultTheme/$soundoption" - else - echo "Error: Sound file not found." - exit 1 + if ! test -f "$sound_file"; then + sound_file=$(find $userDIR/$defaultTheme/stereo -name "$soundoption" -print -quit) + if ! test -f "$sound_file"; then + sound_file=$(find $systemDIR/$defaultTheme/stereo -name "$soundoption" -print -quit) + if ! test -f "$sound_file"; then + echo "Error: Sound file not found." + exit 1 + fi fi fi fi +pw-play "$sound_file" From f7fd59389c265a8ca8ce0e7f8ef240fdcc41abd4 Mon Sep 17 00:00:00 2001 From: xdonu2x Date: Tue, 30 Jan 2024 22:24:57 -0600 Subject: [PATCH 15/16] use valid monitor to set wallpaper --- config/hypr/scripts/PywalSwww.sh | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/config/hypr/scripts/PywalSwww.sh b/config/hypr/scripts/PywalSwww.sh index 0cbadaf..4ed7448 100755 --- a/config/hypr/scripts/PywalSwww.sh +++ b/config/hypr/scripts/PywalSwww.sh @@ -11,30 +11,28 @@ monitor_outputs=($(ls "$cache_dir")) # Initialize a flag to determine if the ln command was executed ln_success=false -# Loop through monitor outputs -for output in "${monitor_outputs[@]}"; do - # Construct the full path to the cache file - cache_file="$cache_dir$output" - - # Check if the cache file exists for the current monitor output - if [ -f "$cache_file" ]; then - # Get the wallpaper path from the cache file - wallpaper_path=$(cat "$cache_file") - - # Copy the wallpaper to the location Rofi can access - if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then - ln_success=true # Set the flag to true upon successful execution - fi - - break # Exit the loop after processing the first found monitor output +# Get first valid monitor +current_monitor=$(hyprctl -j monitors | jq -r '.[0].name') +echo $current_monitor +# Construct the full path to the cache file +cache_file="$cache_dir$current_monitor" +echo $cache_file +# Check if the cache file exists for the current monitor output +if [ -f "$cache_file" ]; then + # Get the wallpaper path from the cache file + wallpaper_path=$(cat "$cache_file") + echo $wallpaper_path + # Copy the wallpaper to the location Rofi can access + if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then + ln_success=true # Set the flag to true upon successful execution fi -done +fi # Check the flag before executing further commands if [ "$ln_success" = true ]; then # execute pywal # wal -i "$wallpaper_path" - + echo 'about to execute wal' # execute pywal skipping tty and terminal changes wal -i "$wallpaper_path" -s -t & fi From 464601eb448981aa5747133753b00f5e932bb8f9 Mon Sep 17 00:00:00 2001 From: ppfloydde <157708553+ppfloydde@users.noreply.github.com> Date: Wed, 31 Jan 2024 07:12:17 +0100 Subject: [PATCH 16/16] Update WaybarCava.sh Fix shebang line to prevent posix execution of shell script. In posix mode, the for-loop failed. --- config/hypr/scripts/WaybarCava.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/hypr/scripts/WaybarCava.sh b/config/hypr/scripts/WaybarCava.sh index 62e3558..bf9e743 100755 --- a/config/hypr/scripts/WaybarCava.sh +++ b/config/hypr/scripts/WaybarCava.sh @@ -1,4 +1,4 @@ -# #! /bin/bash +#!/bin/bash ## /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # Not my own work. This was added through Github PR. Credit to original author