diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index ced09b9..ad538c7 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -29,6 +29,8 @@ super + g #~~~~~~~~~ Print screenshot +shift + Print + screenshot --force super + m rofi-mpd -a super + x @@ -36,7 +38,7 @@ super + x super + z powermenu super + u - updater + update super + n rofi-todo -f $HOME/doc/notes/notes.json super + e diff --git a/.local/bin/scripts/screenshot b/.local/bin/scripts/screenshot index 6bbd3f6..5d3a4b5 100755 --- a/.local/bin/scripts/screenshot +++ b/.local/bin/scripts/screenshot @@ -1,23 +1,29 @@ #!/usr/bin/env sh -m() { rofi -dmenu -i -l "$@"; } - -type="$(printf "Screen\nArea\n" | m 2 -p 'What do you want to screenshot?')" -[ ! "$type" ] && exit -save="$(printf "No\nYes" | m 2 -p 'Do you want to copy to clipboard?')" -[ ! "$save" ] && exit -time="$(printf "0.7\n5\n10\n15" | m 3 -p 'How many seconds you want to wait?')" -[ ! "$time" ] && exit - -[ "$type" = "Area" ] && type="-s -u" || type="" +m() { rofi -dmenu -width 200 -i -l "$@"; } mkdir -p ~/pix/Screenshots -sleep "$time" screen_path=~/pix/Screenshots/$(date +%G-%m-%d_%s).png -maim $type "$screen_path" && - notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!" +screenshot() { + maim $type "$screen_path" && + notify-send -u low -t 1400 -i "$screen_path" "Screenshot created!" +} -[ "$save" = "Yes" ] && +[ "$1" = "--force" ] && { screenshot && exit; } + +type="$(printf " Screen\n Area\n" | m 2 -p 'Screenshoter')" +[ ! "$type" ] && exit +save="$(printf " No\n Yes" | m 2 -p 'Copy?')" +[ ! "$save" ] && exit +time="$(printf "0.7\n5\n10\n15" | m 3 -p 'Delay')" +[ ! "$time" ] && exit + +[ "$type" = " Area" ] && type="-s -u" || type="" + +sleep "$time" +screenshot + +[ "$save" = " Yes" ] && xclip -sel clip /dev/null; sleep 0.5 xclip -selection clipboard -t image/png "$screen_path" || exit