screenshot: replace xwd+netpbm with maim
While at it, add a new keybind for it.
This commit is contained in:
parent
f020fac3d5
commit
f721826d92
@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# screenshot
|
# screenshot
|
||||||
# Written in 2019-2020 by Lucas
|
# Written in 2019-2020,2022 by Lucas
|
||||||
# CC0 1.0 Universal/Public domain - No rights reserved
|
# CC0 1.0 Universal/Public domain - No rights reserved
|
||||||
#
|
#
|
||||||
# To the extent possible under law, the author(s) have dedicated all
|
# To the extent possible under law, the author(s) have dedicated all
|
||||||
@ -12,40 +12,9 @@
|
|||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
cat - <<. >&2
|
printf "Usage: %s [maim options]\n" "${0##*/}" >&2
|
||||||
Usage:
|
|
||||||
${0##*/}
|
|
||||||
${0##*/} -id id
|
|
||||||
${0##*/} -name name
|
|
||||||
${0##*/} -window
|
|
||||||
.
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
err()
|
|
||||||
{
|
|
||||||
printf "%s: %s\n" "${0##*/}" "$*" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
case $# in
|
|
||||||
0)
|
|
||||||
set -- -root
|
|
||||||
;;
|
|
||||||
1)
|
|
||||||
[ "$1" = "-window" ] || err "unknown option $1"
|
|
||||||
set --
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
[ "$1" = "-id" ] || [ "$1" = "-name" ] || err "unknown option $1"
|
|
||||||
[ -n "$2" ] || err "$1 expects a non-empty parameter"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
usage
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
: ${SCREENSHOTS:=~/media/ss}
|
: ${SCREENSHOTS:=~/media/ss}
|
||||||
xwd -silent "$@" |
|
maim "$@" "$SCREENSHOTS/$(date +%Y%m%d-%H%M%S).png"
|
||||||
xwdtopnm |
|
|
||||||
pnmtopng >"$SCREENSHOTS/$(date +%Y%m%d-%H%M%S).png"
|
|
||||||
|
@ -42,6 +42,7 @@ hc keybind $Mod-Control-Return spawn xterm -geometry 80x40
|
|||||||
hc keybind $Mod-Control-l spawn xlock
|
hc keybind $Mod-Control-l spawn xlock
|
||||||
hc keybind $Mod-Control-z spawn sh -c 'xlock & doas /usr/sbin/ZZZ'
|
hc keybind $Mod-Control-z spawn sh -c 'xlock & doas /usr/sbin/ZZZ'
|
||||||
hc keybind $Mod-Print spawn screenshot
|
hc keybind $Mod-Print spawn screenshot
|
||||||
|
hc keybind $Mod-Shift-Print spawn screenshot -s
|
||||||
|
|
||||||
# basic movement
|
# basic movement
|
||||||
# focusing clients
|
# focusing clients
|
||||||
|
Loading…
Reference in New Issue
Block a user