From bee9efdf510a71e4b9b4a44e60f9092ab7bd076c Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sat, 27 Jan 2024 21:54:18 +0000 Subject: feat: Notify volume change with sound feedback Play a sound when changing volume --- config/hypr/scripts/Volume.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index 1c18211f..425920e8 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 } -- cgit v1.2.3 From f9bc6913d974d5d1d328b2fb989841640ac93be0 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sat, 27 Jan 2024 23:46:32 +0000 Subject: 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(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/configs/Keybinds.conf b/config/hypr/configs/Keybinds.conf index 1da7e9f7..3ecc4a37 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 ddf4398b..d0ec1f5e 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 -- cgit v1.2.3 From 909b48934f6c5915c3cd67b4a55d3c40594bbbdd Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sat, 27 Jan 2024 23:59:42 +0000 Subject: Fix last commit --- config/hypr/scripts/ScreenShot.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index d0ec1f5e..6b701ff2 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" -- cgit v1.2.3 From 1839a6349add03ce1051c6313fcdd8739a62c840 Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 00:59:05 +0000 Subject: 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(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 6b701ff2..1cec086d 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 425920e8..8322e29f 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 } -- cgit v1.2.3 From 4ee1bbf3b1ff83f954e323caf6f3ded444d0761c Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 03:06:42 +0000 Subject: 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 (limited to 'config/hypr/scripts') diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh new file mode 100755 index 00000000..6bec1ea3 --- /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 1cec086d..3fb25804 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 8322e29f..8c5af5de 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 } -- cgit v1.2.3 From 6b59626f6feaa690367bdb40c84eece6f1cd04c6 Mon Sep 17 00:00:00 2001 From: Ciarán O'Brien Date: Sun, 28 Jan 2024 17:41:54 +0000 Subject: Remove whitespace in ScreenShot.sh --- config/hypr/scripts/ScreenShot.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 3fb25804..f56c58df 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 - } -- cgit v1.2.3 From ed716d91bc6c4f5ebca9bbfb24ceba48137538cc Mon Sep 17 00:00:00 2001 From: KKV9 Date: Sun, 28 Jan 2024 20:30:53 +0000 Subject: 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(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/UserScripts/Sounds.sh b/config/hypr/UserScripts/Sounds.sh index a2523a24..9aaafcf0 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 f56c58df..fa1b40ad 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" } -- cgit v1.2.3 From f7fd59389c265a8ca8ce0e7f8ef240fdcc41abd4 Mon Sep 17 00:00:00 2001 From: xdonu2x Date: Tue, 30 Jan 2024 22:24:57 -0600 Subject: use valid monitor to set wallpaper --- config/hypr/scripts/PywalSwww.sh | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/PywalSwww.sh b/config/hypr/scripts/PywalSwww.sh index 0cbadaf4..4ed7448f 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 -- cgit v1.2.3 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: 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(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/WaybarCava.sh b/config/hypr/scripts/WaybarCava.sh index 62e3558e..bf9e7435 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 -- cgit v1.2.3