Tech Tip: Go Green On Your Screen(saver)
I usually lock my screen when I leave my cubicle for a tea-break etc. With all the talk of saving energy these days I've disabled screen-savers on my system. Still, when I'd lock my screen I noticed that the LCD didn't turn off completely. Wanting to go as green as I could I wanted to switch off the LCD as well.
The following command does that:
xset dpms force off
When I press "Alt+Ctrl+L" (lock screen), the following command is invoked:
What I want now is to associate the following command with a different shortcut key:
gnome-screensaver-command --lock; xset dpms force off
So that I can lock as well as power off my LCD screen with a keyboard shortcut. To do this I installed xbindkeys to add a custom shortcut key. When you have xbindkeys installed create created the default config file:
xbindkeys --defaults > /home/your-user-name/.xbindkeysrc
Now assign a shortcut key. To do this you edit the config file (or if you prefer you can install xbindkeys-config) and append the following lines to the file:
# lock&blank "gnome-screensaver-command --lock; sleep 1; xset dpms force off;" alt+control+k
You also should remove all the enabled lines (comment them out), at least in my case they somehow interfered with my other shortcuts. I also had to add the sleep 1 between the commands to get it to work, perhaps due to compiz animation time.
Now, when I press "alt+control+k" I save power as well as lock my screen.
Tested on Ubuntu 8.10 running on Lenovo T61p.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- The Ubuntu Conspiracy
- A First Look at IBM's New Linux Servers
- Vigilante Malware
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Libreboot on an X60, Part I: the Setup
- Vagrant Simplified
- System Status as SMS Text Messages
- Bluetooth Hacks
- Dealing with Boundary Issues
- Non-Linux FOSS: Code Your Way To Victory!