Xfce Forum

Sub domains
 

You are not logged in.

#1 2019-09-04 21:17:08

NuncEstBibendum
Member
Registered: 2017-10-13
Posts: 10

Automatically capturing screenshots of workspaces

I am running Xfce 4.12 in a Slackware64 14.2 system. In my Xfce desktop I have 8 workspaces. What I would like to do is to capture a screenshot of each of those workspaces at regular intervals. I would like for this to happen automatically, from a script launched by cron.

Can this be done at all? It is of course easy enough to do a script capture by hand, but I wouldn't know how to start when it comes to doing it from a script - all the more so if it is a script to be invoked automatically.

Offline

#2 2019-09-04 21:55:52

NuncEstBibendum
Member
Registered: 2017-10-13
Posts: 10

Re: Automatically capturing screenshots of workspaces

Actually, I think I got a solution: a combination of xdotool and scrot seem to do the trick. Still, if anybody can propose a different mechanism, I would still be interested to hear about it.

Offline

#3 2019-09-05 10:58:11

alcornoqui
Member
Registered: 2014-07-28
Posts: 470

Re: Automatically capturing screenshots of workspaces

Can you share the details? Is it similar to this method?

Try using wmctrl to switch to the workspace briefly, like this:

wmctrl -s 1; scrot; wmctrl -s 0

Because, from this other thread I don't see an obvious way to do it, as hidden desktops are unrendered untill seen, aren't they?

Offline

#4 2019-09-05 13:42:34

NuncEstBibendum
Member
Registered: 2017-10-13
Posts: 10

Re: Automatically capturing screenshots of workspaces

The following script works for me:

#! /bin/sh

export DISPLAY=localhost:0.0

WORKSPACES=8
CURRENT=`xdotool get_desktop`
COUNT=0

while [ $COUNT -lt $WORKSPACES ]; do
  FILENAME=`date +'%Y%m%d%H%M%S'`_$COUNT.jpg
  xdotool set_desktop $COUNT
  scrot -q 100 -d 1 /tmp/$FILENAME
  COUNT=$(($COUNT + 1))
done

xdotool set_desktop $CURRENT

Assuming that your desktop is running and you have eight workspaces, this works all right, even when invoked by cron. I don't know about wmctrl, which I don't have anyway; xdotool seems to do the same as wmctrl purportedly does.

Offline

#5 2019-09-05 14:34:00

alcornoqui
Member
Registered: 2014-07-28
Posts: 470

Re: Automatically capturing screenshots of workspaces

Cool, thanks for sharing!

Offline

#6 2019-09-06 15:05:43

NuncEstBibendum
Member
Registered: 2017-10-13
Posts: 10

Re: Automatically capturing screenshots of workspaces

I had to disable my Xfce screensaver, of course, but I also had to disable the screen blanking feature that is part of X:

    xset -dpms
    xset s noblank
    xset s off

Otherwise, when invoked from crontab, I would get snapshots of blanks screens.

Offline

Board footer

Powered by FluxBB