As far as X11 is concerned, when you switch to another user, that user is on a completely different display.
In you session, if you execute:
echo $DISPLAY
you will have :0
, the first virtual display. In the second user, the same will give you :1
, the second display.
You can see the screens in use with the command w
:
[romano:~] % w
11:32:03 up 1:05, 8 users, load average: 0,10, 0,24, 0,30
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
romano :0 :0 10:27 ?xdm? 6:25 0.13s gdm-session-wor
romano pts/1 :0 11:03 26:49 0.10s 0.10s zsh
romano pts/3 :0 11:21 0.00s 0.12s 0.01s w
default :1 :1 11:24 ?xdm? 6:25 0.07s gdm-session-wor
default pts/15 :1 11:24 1:56 0.05s 0.05s bash
To be able to do a screenshot from one screen of the other, or from another user, the user to be "shotted" must issue the command
xhost +
to enable access (not even root
will be able to do the snapshot otherwise). After that, you can do a
DISPLAY=:1 scrot
from a script or another user. Notice that if you shot a screen which is not active (displayed) you will have a black screen or strange things --- who knows what's in the video buffer memory...
Now it's up to you to write a script exploring all this... you should in principle detect which user is active (not easy --- or simply shot all of the screen and discard the black ones after) and do the screenshot.
Good luck!
/usr/bin
to be accessible to all users, and then make a .desktop file in/etc/xdg/autostart
folder to make it available for each user. As for storing screenshots . . . .if you usegnome-screenshot
it stores screenshots in current users directory. You might wanna add another variable that will be incremented and use -f flag in the gnome-screenshot to store screnshot with that variable as name. Or use $(date).