From ef5f9e34fe30c13a1fa3ce2999819da3b0773bce Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Fri, 17 Jan 2025 16:58:50 +1100 Subject: screenshot script --- screenshot.fish | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 screenshot.fish (limited to 'screenshot.fish') diff --git a/screenshot.fish b/screenshot.fish new file mode 100755 index 0000000..1798b3b --- /dev/null +++ b/screenshot.fish @@ -0,0 +1,23 @@ +#!/bin/fish + +. (dirname (status filename))/util.fish + +mkdir -p "$CACHE/screenshots" +set tmp_file "$CACHE/screenshots/$(date +'%Y%m%d%H%M%S')" +grim $argv $tmp_file; and wl-copy < $tmp_file; or exit 1 + +set action (notify-send -i 'image-x-generic-symbolic' -h "STRING:image-path:$tmp_file" \ + -a (basename (status current-filename)) --action='open=Open' --action='save=Save' \ + 'Screenshot taken' "Screenshot stored in $tmp_file and copied to clipboard") +switch $action + case 'open' + uwsm app -- swappy -f $tmp_file & disown + case 'save' + set save_file (uwsm app -- zenity --file-selection --save --title='Save As') + [ -z $save_file ] && exit 0 + if [ -f $save_file ] + uwsm app -- yad --image='abrt' --title='Warning!' --text-align='center' --buttons-layout='center' --borders=20 \ + --text='Are you sure you want to overwrite this file?' || exit 0 + end + cp -f $tmp_file $save_file +end -- cgit v1.2.3-freya