I am soon going to have to migrate an entire computer lab (about 50 PCs) from Windows 7 to Ubuntu 14.04 LTS. As it's an university, 99% of the time (if not 100%) it will be used by students. There is not a central database of user accounts and credentials, so each PC will have only two accounts, admin
and guest
, with the latter configured to autologin (besides some customization as per this tutorial).
When the PCs are turned on, and the guest account logs in automaticcaly, the first thing shown after the window manager is loaded is this dialog box:
However, there's two problems:
- The very first person who sits at the computer at 9am will see the dialog box, click OK, use the PC, leave, not ending the session or locking the screen (because users), and the second user onwards won't see the message
- There is more relevant information that I'd like to convey for the lab users (lab rules, etc).
So, with this scenario in mind, what I want to achieve is having a dialog box really similar to this one (but with a different text, set by me) to popup whenever a computer isn't used for, say, 15 minutes. (For the purpose of this question, let's assume "not used" means no keyboard or mouse activity).
I have been directed to How does ubuntu determine inactivity before suspending? and How can a script detect a user's idle time? and use ruby or sheel scripts, but I don't know how to code.
Is there a simpler way to achieve what I need?
Use
xautolock
or use zenity or any dialog you wish.
See http://manpages.ubuntu.com/manpages/trusty/man1/xautolock.1.html
Edit: After the edit to the question, the OP went with zenity
If you run the following script in the background, it will check the idle-time every 5 seconds. If the idle time exceeds a given amount of time (in minutes), a message will appear, defined in a textfile. (through a Zenity window).
How to use
install
xprintidle
:Copy the script into an empty file, set the idle time (
t
) in minutes and set the path to the textfile containing your message text. Save it asset_warning.py
Run it by the command
Notes
--no-wrap
option from zenity is used, you need to use the returns, or otherwise your message will be excessively broad.Here's what I ended up doing:
I added that line as an entry on the session apps of the account that is soft linked to
/etc/guest-session/skel
, so it will run every time the guest session starts.