Here's exactly what I wanted to do: Turn ON Lock (Settings
> Brightness and Lock
), set the time to wait (Lock screen after:
), BUT NOT to lock the screen (e.g. no Password prompt) if I'd only close (and of course open) the lid.
I'm not sure if there's some tweak/hack to be able to do that.
(I'm always walking out of my desk but my machine always does something, so "Do nothing" on lid close, but it's a little annoying to keep typing the password like 4x an hour. I need to have it lid closed. BUT, sometimes I do leave my desk for more than an hour and forgot to Ctrl+Alt+L. I'd like it to lock automatically like after an hour of inactivity. If scripting is the only way to do it, can you please help me where to start? Thanks in advance.)
Ubuntu 12.04.02, LightDM, Gnome Shell
Ok, the information you provided in the comments is enough now.
First, you should install
xprintidle
(sudo apt-get install xprintidle
), because we are going to try and emulate the locking mechanism!Now, write a script (I've call it
screen-locker
, notice you don't need to put an extension to your filename):Say you save it in a directory called
/home/your-username/bin
. Make it executablenow in the terminal run
to add this script to your crontab. (With this the script will be executed every 10 minutes.)
Now you can navigate to Brightness & Lock and deactivate the locking because the script will lock your screen if (and only if) the lid is open.
(You can change the
60
to1
minute for the purpose of a quick test. You wait around 2 minutes with the lid open to see if it locks, then do the same waiting but with the lid closed to see if it does not lock).