At my "primary home", there's two kids, younger being merely 11y old, it's pretty clear that it's a good thing that my laptop's screen goes locked when screensaver (which just blanks the screen) kicks in. At my "secondary home" (where I sadly spend more time than at first mentioned) there's no threat to my privacy, and more importantly, no need to worry that some silly child goes messing around with my work, the locking-option is more of hindrance than use. Especially when I may have two computers running simultaneously, meaning that the laptop's screensaver really may blank the screen. While I got the IM (Instant Message) -applications (Pidgin & Skype) open on the laptop, it's clear that reading my girlfriend's (jokingly?) "status-reports" gets a tad pain if I'm playing a game on my Mac - if I have to type my password every freaking time after the screensaver jumps in. And since gnome-screensaver takes care of more than just the screensaver, I can't just simply drop it out.
Script
Save the script in a text-file, and change it's permissions to allow executing. Then you can easily make a launcher for it.
- Code: Select all
#!/bin/bash
teSt=`gconftool-2 --direct --config-source xml:readwrite:/home/f-3000/.gconf --get /apps/gnome-screensaver/lock_enabled`
if [ "$teSt" = "true" ]
then
teSt2=false
else
teSt2=true
fi
gnome-screensaver-command --exit
gconftool-2 --direct --config-source xml:readwrite:/home/f-3000/.gconf --type bool --set /apps/gnome-screensaver/lock_enabled $teSt2
gnome-screensaver </dev/null >/dev/null 2>&1 &
echo "Screen locking set to $teSt2"
exit 0
If you want to make a launcher that tells you what's going on, set the launcher to run in terminal, and include this line just above exit:
- Code: Select all
/path/to/your/pause-script
And to turn the lock automatically back on when you close the computer, you could save this bash-script in /etc/rc6.d/ with name K99lock_on (for example).
- Code: Select all
#!/bin/bash
teSt=`gconftool-2 --direct --config-source xml:readwrite:/home/$USER/.gconf --get /apps/gnome-screensaver/lock_enabled`
if [ "$teSt" = "false" ]
then
gnome-screensaver-command --exit
gconftool-2 --direct --config-source xml:readwrite:/home/$USER/.gconf --type bool --set /apps/gnome-screensaver/lock_enabled true
fi
exit 0
Postscript
Something that amuses me: Before I started writing this article, the script was PHP-script, and the "lock_on" was less sophisticated.
Sources:
http://live.gnome.org/GnomeScreensaver/FrequentlyAskedQuestions
http://en.kioskea.net/faq/3348-ubuntu-executing-a-script-at-startup-and-shutdown
http://www.unix.com/shell-programming-scripting/70523-how-starting-process-daemon-using-ssh-command.html
