Skip to content

Instantly share code, notes, and snippets.

@duckythescientist
Created March 20, 2025 21:11
Show Gist options
  • Save duckythescientist/898e88fbb09f754d90f62bf0c6ef228d to your computer and use it in GitHub Desktop.
Save duckythescientist/898e88fbb09f754d90f62bf0c6ef228d to your computer and use it in GitHub Desktop.
Better screenshots - because xfce4-screenshooter only gives me black screens
#!/usr/bin/env bash
# Better screenshots - because xfce4-screenshooter only gives me black screens
# /home/duck/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml
# <property name="&lt;Primary&gt;&lt;Shift&gt;Print" type="string" value="/home/duck/.local/bin/scrotshot.sh regionclip"/>
# <property name="&lt;Shift&gt;Print" type="string" value="/home/duck/.local/bin/scrotshot.sh region"/>
# <property name="Print" type="string" value="/home/duck/.local/bin/scrotshot.sh full"/>
# <property name="&lt;Primary&gt;Print" type="string" value="/home/duck/.local/bin/scrotshot.sh fullclip"/>
# <property name="&lt;Primary&gt;&lt;Super&gt;Print" type="string" value="/home/duck/.local/bin/scrotshot.sh activeclip"/>
# <property name="&lt;Super&gt;Print" type="string" value="/home/duck/.local/bin/scrotshot.sh active"/>
filename="${HOME}/Pictures/screenshot_%Y-%m-%d_%s.png"
tmpfile="/tmp/scrot_tmp.png"
selection="-s -l mode=edge"
case $1 in
region)
scrot $selection -F "$filename"
;;
full)
scrot -F "$filename"
;;
regionclip)
scrot $selection -F "$tmpfile"
xclip -selection clipboard -t image/png -i "$tmpfile"
rm "$tmpfile"
;;
fullclip)
scrot -F "$tmpfile"
xclip -selection clipboard -t image/png -i "$tmpfile"
rm "$tmpfile"
;;
active)
scrot -u -F "$filename"
;;
activeclip)
scrot -u -F "$tmpfile"
xclip -selection clipboard -t image/png -i "$tmpfile"
rm "$tmpfile"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment