Access to our computer (not only to the internet) needs to be restricted for the accounts of my kids (7, 8) until they are old enough to manage this by themselves. Until then we need to be able to define the following:
- the hours of the day when computing is o.k. (e.g. 5 – 9 pm)
- the days of the week when computing is not o.k. (e.g. mondays to fridays)
- the amount of time allowed per day (e.g. 2 hours)
In 11.10 all of the following that used to do the job don't work any more:
- Timekpr: for > 11.10 no more available through the ppa.
- Timeoutd: command line alternative, but from 11.10 removed from the repositories.
- Gnome Nanny: Looks great but repeatedly crashes to force restarting X-server. So we can't use or recommed this program at the moment.
Are there any other alternatives?
Best Answer
Lock Screen Timer
Create your own Screen Lock Timer instead of 3rd Party applications
Although there are 3rd Party applications to do this, you can create your own. Summary of steps:
gedit
to create scriptlock-screen-timer
lock-screen-timer
lock-screen-timer
as an executableUse
gedit
to create scriptlock-screen-timer
Open the
Terminal
using Ctrl+Alt+T and type:Copy and paste code from window below to
lock-screen-timer
Toggle back to this screen and copy the following code by highlighting it and pressing Ctrl+C:
Then toggle back to the empty
gedit
window and paste the code using Ctrl+V. Save the file and exit the editor back to the command prompt.Mark
lock-screen-timer
as an executableNow we need to make the script executable by typing:
Test It!
Before calling the script from the GUI, we'll call it from the terminal so we can see if any error messages are displayed:
You are prompted for the number of minutes:
Set the desired number of minutes and click OK to start the timer. When there are 15, 10, 5, 3, 2 and 1 minute(s) left a system sound is heard and a message bubble appears advising when the screen will be locked. After the screen is locked you need to enter your password to unlock the screen.
Configure Nautilus to execute bash scripts
Nautilus defines what happens when we double click on an executable script when it's the files display window or a link on on the desktop. Normal behavior is to edit the script using
gedit
. We want to change this behavior such that it is executed.Start Nautilus and navigate to directory containing
lock-screen-timer
. Left click on it once to give it focus. Hover mouse over top menu bar until "File Edit..." menu appears, use:Edit
drop-down menuProperties
optionBehavior
tabExecutable Text Files
Run executable text files when they are opened
Create desktop shortcut link
From previous section
lock-screen-timer
still has focus. If not, navigate to the script and left click on it once to give it focus. Then use:Make Link
.Link to lock-screen-timer
.Now you can double click on the desktop shortcut link and the script is run. A dialog box appears to get the number minutes. Two buttons are presented Cancel and OK. If you click the
X
to close the window it is the same as selecting Cancel.After the timer is running and you double click on it again the first running copy is "killed". You can now start a new scren lock countdown or click Cancel for no countdown.
Display Time Remaining in systray / notification area
While lock screen timer is running it records how many minutes are remaining into the file
~/.lock-screen-timer-remaining
. You can look at this file with thewatch
command or display it on Ubuntu's system tray / application indicator bar as shown at the top of this answer. To display time remaining in the notification area, follow the instructions in this Q&A: (Can BASH display in systray as application indicator?).