From 4b9bc025cd56dac3acd0d480d39760d13ace5617 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 12 Jan 2025 15:41:09 +0900 Subject: improvement of screenshot --- config/hypr/scripts/ScreenShot.sh | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index ceef9dad..7cc28afc 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -14,6 +14,7 @@ active_window_file="Screenshot_${time}_${active_window_class}.png" active_window_path="${dir}/${active_window_file}" notify_cmd_base="notify-send -t 10000 -A action1=Open -A action2=Delete -h string:x-canonical-private-synchronous:shot-notify" +notify_swappy="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" notify_cmd_shot="${notify_cmd_base} -i ${dir}/${file}" notify_cmd_shot_win="${notify_cmd_base} -i ${active_window_path}" @@ -21,9 +22,9 @@ notify_cmd_shot_win="${notify_cmd_base} -i ${active_window_path}" notify_view() { if [[ "$1" == "active" ]]; then if [[ -e "${active_window_path}" ]]; then - resp=$(timeout 10 ${notify_cmd_shot_win} "Screenshot of '${active_window_class}' Saved.") - "${sDIR}/Sounds.sh" --screenshot - case "$resp" in + "${sDIR}/Sounds.sh" --screenshot + resp=$(timeout 5 ${notify_cmd_shot_win} "Screenshot of '${active_window_class}' Saved.") + case "$resp" in action1) xdg-open "${active_window_path}" & ;; @@ -35,21 +36,16 @@ notify_view() { ${notify_cmd_shot} "Screenshot of '${active_window_class}' not Saved" "${sDIR}/Sounds.sh" --error fi + elif [[ "$1" == "swappy" ]]; then - resp=$(timeout 10 ${notify_cmd_shot} "Screenshot Captured.") - case "$resp" in - action1) - xdg-open "${dir}/${file}" & - ;; - action2) - rm "${dir}/${file}" & - ;; - esac + "${sDIR}/Sounds.sh" --screenshot + ${notify_swappy} "Screenshot Captured (swappy)" + else local check_file="${dir}/${file}" if [[ -e "$check_file" ]]; then - resp=$(timeout 10 ${notify_cmd_shot} "Screenshot Saved.") "${sDIR}/Sounds.sh" --screenshot + resp=$(timeout 5 ${notify_cmd_shot} "Screenshot Saved.") case "$resp" in action1) xdg-open "${check_file}" & @@ -86,8 +82,7 @@ shot5() { countdown '5' sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy sleep 1 - notify_view - + notify_view } shot10() { @@ -125,12 +120,11 @@ shotactive() { shotswappy() { tmpfile=$(mktemp) - grim -g "$(slurp)" - >"$tmpfile" && "${sDIR}/Sounds.sh" --screenshot && notify_view "swappy" + grim -g "$(slurp)" - >"$tmpfile" && notify_view "swappy" swappy -f - <"$tmpfile" rm "$tmpfile" } - if [[ ! -d "$dir" ]]; then mkdir -p "$dir" fi -- cgit v1.2.3 From df6c626e613838ded886bd33ea4c7f7fb0882cd7 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 12 Jan 2025 15:51:06 +0900 Subject: improved swappy --- config/hypr/scripts/ScreenShot.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 7cc28afc..2089c033 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -39,7 +39,15 @@ notify_view() { elif [[ "$1" == "swappy" ]]; then "${sDIR}/Sounds.sh" --screenshot - ${notify_swappy} "Screenshot Captured (swappy)" + resp=$(${notify_cmd_shot} "Screenshot Captured (swappy)") + case "$resp" in + action1) + swappy -f - <"$tmpfile" + ;; + action2) + rm "$tmpfile" + ;; + esac else local check_file="${dir}/${file}" @@ -82,7 +90,7 @@ shot5() { countdown '5' sleep 1 && cd ${dir} && grim - | tee "$file" | wl-copy sleep 1 - notify_view + notify_view } shot10() { @@ -121,8 +129,6 @@ shotactive() { shotswappy() { tmpfile=$(mktemp) grim -g "$(slurp)" - >"$tmpfile" && notify_view "swappy" - swappy -f - <"$tmpfile" - rm "$tmpfile" } if [[ ! -d "$dir" ]]; then @@ -147,4 +153,4 @@ else echo -e "Available Options : --now --in5 --in10 --win --area --active --swappy" fi -exit 0 +exit 0 \ No newline at end of file -- cgit v1.2.3 From 3573df4a1d0b4c915975ac80275442c35831fb2f Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 12 Jan 2025 15:52:44 +0900 Subject: last update promise :) --- config/hypr/scripts/ScreenShot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 2089c033..b33a31c7 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -14,7 +14,7 @@ active_window_file="Screenshot_${time}_${active_window_class}.png" active_window_path="${dir}/${active_window_file}" notify_cmd_base="notify-send -t 10000 -A action1=Open -A action2=Delete -h string:x-canonical-private-synchronous:shot-notify" -notify_swappy="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" +#notify_swappy="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/picture.png" notify_cmd_shot="${notify_cmd_base} -i ${dir}/${file}" notify_cmd_shot_win="${notify_cmd_base} -i ${active_window_path}" -- cgit v1.2.3