one-button screenshots attempt with scrot and fvwm
In Gnome desktop, a full-screen screenshot is printscreen, and to snap the current window, it's alt-printscreen. Gnome desktop has many annoyances, so I tend to use to use fvwm.
So far, I've managed to get screenshots working under fvwm using a program called scrot(1), a shell script wrapping it, and a little fvwm config.
scrot is packaged by debian, so installing it is no problem.
The invocation to capture the currently focussed window with window manager decorations (borders) is, for example:
scrot -u $HOME/scr/%Y-%m-%d.%H.%M.%S.png -b
but the directory must already exist, so I wrap it in a shell script I put in ~/bin/screenshot with contents:
#!/bin/sh
set -e
DIR=$HOME/scr
if ! [ -d "$DIR" ] ; then
mkdir $DIR
fi
exec scrot -u $HOME/scr/%Y-%m-%d.%H.%M.%S.png -b
To bind this to alt-printscreen in fvwm, I have this config in .fvwm/config:
Key Print A M Exec exec screenshot
The Print means the printscreen key. The A means any context, which in fvwm means it happens anywhere, not just for example in the title bar or something. The M stands for Meta, meaning Alt.
I wanted just printscreen alone to do it. But replacing the M with N, for none, didn't work. printscreen did nothing. So the best I can do for now is alt-printscreen.
There seems to be a delay of around 2s. I could try --delay 0, but it seems unlikely that zero wouldn't be the default delay anyway (the manpage scrot(1) does not say what the default delay is).
It also seems to cause a little window wibble, which is unsatisfactory. A quick flash would be better.
Comments
Post a Comment