You are not logged in.
Pages: 1
Hi All,
Is it possible to take a screenshot when somebody is logging in and using openbox (suppose that I have the root access of that machine)?
If it's impossible, is there any way to regularly take screenshots when somebody logs in with user, for example user1, and uses openbox? This is what I tried, but it didn't work correctly: I have something like
( /home/user1/h.sh ) &
in /home/user1/.bashrc. In h.sh, I make an infinite loop of this code:
TITLE=$(xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) _NET_WM_NAME)
if [[ $TITLE == *"Minecraft"* ]] || [[ $TITLE == *"Firefox"* ]] || [[ $TITLE == *"Chrome"* ]] ; then
X=$(date --iso-8601=seconds)
X=${X:0:19}
X=${X//:/-}
gnome-screenshot --remove-border --file=/dev/shm/${X}.png
fi
It seems to work after a reboot and user1 is logged in and openbox is started. But if I ssh using user1, then it doesn't work anymore.
Thanks.
Offline
Are you using some form of X11 forwarding? Please describe that if you are.
If you aren't, then I'm missing a big part of your logic: you want screenshots of users1's openbox session, but it doesn work when you shell in. But when you shell in you are not running a gui let alone openbox.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Are you using some form of X11 forwarding? Please describe that if you are.
No, I don't use X11 forwarding
If you aren't, then I'm missing a big part of your logic: you want screenshots of users1's openbox session, but it doesn work when you shell in. But when you shell in you are not running a gui let alone openbox.
Yes, I want screenshots of user1's openbox session. It seems to work if user1 logs in and starts openbox before anybody text-ssh to that machine with the user1 account.
I thought and googled about this for a couple of days but couldn't find the answer. But only 5 minutes after I posted my question here, I googled again and voila, the answer is
gnome-screenshot --display :0.0
Now I'm so happy :-)I was happy too soon.
Now I can shell in and run gnome-screenshot --display :0.0 but my infinite loop stops (still don't know why) after I shell in.
2nd edit: when user1 logs in and starts an openbox session, that infinite loop, which is started in .bashrc in the background, starts. When I shell in using user1 account, that infinite loop stops and a new infinite loop starts and it will stop when I exit this text ssh session. Now my question is: why does a script, which contains an infinite loop, in .bashrc (and is started in the background, i.e.
script-containing-infinite-loop &
) stop when somebody text-ssh in?
Last edited by dxxvi (2017-03-16 03:39:50)
Offline
you're loading .bashrc again when you ssh in, so that would start a new script (and close it when you logout of ssh). why not just use a user cron job run every minute or however often you want to take a screenshot, instead of an infinite loop?
also, if you're going to be working with a graphical session from a shell, it's better to just export the DISPLAY variable
export DISPLAY=":0"
unless you plan on x forwarding
Last edited by HiImTye (2017-03-16 05:24:16)
Offline
you're loading .bashrc again when you ssh in, so that would start a new script (and close it when you logout of ssh). why not just use a user cron job run every minute or however often you want to take a screenshot, instead of an infinite loop?
also, if you're going to be working with a graphical session from a shell, it's better to just export the DISPLAY variable
export DISPLAY=":0"
unless you plan on x forwarding
Thank you. I'll try with a cron job.
Offline
Pages: 1