![]() ![]() That part is fairly easy, we read the processes running for the current user using ps -u $USER and pipe the output to grep and count the media players with a regex, and value larger than zero exits the script. Disable the screen saver when media players are running ![]() This is similar to the caffeine application used in Unity, that’s why I called parts of the script cappuccino. We add that code in the end of locker.sh. # set display to not turn off automatically # lets keep the script running in background until the screen saver gets switched off We need to run xset dpms 0 0 0 to switch that off, after the screen saver was disabled. We need to do that because with xset dpms 0 0 20 the screen will switch off every time you are inactive for 20 seconds or more, that is certainly not desirable. No we let the script run in background and check the state of the screen saver, basically, it does nothing, most of the time it sleeps, so don’t worry. I know, I could have done it easier but I like it this way, a little gambling. That way I avoid, that the screen gets turned off while you try to login, which would happen when you use force off. I use two commands for xset dpms, the first one sets the poweroff delay to 1 second, then I added a delay of 2 seconds (so unless you do something, the screen gets turned off after a second) before changing the poweroff delay to 20 seconds. # make display turn off automatically after 20 sec # next lets get the state of the screen saver, if still active, switch off the screen Now we check if the screen saver is already inactive (meaning you logged in) using gnome-screensaver-command -q, if not inactive, we switch off the screen, if it is inactive, we end the script. # lets wait a bit before switching off the screen But let’s go step by step.įirst I added a little delay, just in case you want to login immediately, you can adjust that delay to your liking. That is not a very friendly solution, I tried to workaround that. To switch off the screen, we use xset dpms to enable energy saving mode, you can use xset dpms force off to switch off the screen immediately. Login screen with blurred screenshot as background (showing Nemo) Save energy This chain of commands creates just the blurry picture, it gets downscaled by a factor of 2.5 and upscaled by a factor of 2.5 then smoothened with s strong blur effect. # pixelate and blur image using convert (could use mogrify but is slower)Ĭonvert $screen1 -scale 40% -scale 250% -blur 10x10 $screen2Ĭonvert is part of ImageMagick, if ImageMagick and scrot are not installed, you can get them from repo. Screen2="/home/$USER/.config/openbox/lockscreen2.png" Screen1="/home/$USER/.config/openbox/lockscreen1.png" First lets take the screenshot and blur it a bit I will provide the complete scripts later but I will explain the bits and pieces here. That doesn’t work the same way with gnome-screensaver but it can be done. ![]() The Idea is not new, I remember such screen savers but the method is rather cool. It uses scrot to take a screenshot of your current desktop and use it as a background image for the screen lock. I found a pretty cool idea on the i3wm support site. I don’t want an animated screen saver, these days are over in my humble opinion. Well, as good as something static can be. I started with the last point, making it look good. How to do that? The first two points are easy, I showed you how to do it in the previous article. – I want it to switch off the screen, on the netbook that saves some power and also keeps it cool – I want it to not kick-in when watching a video or running certain applications ( Caffeine-like) – I want to be able to inhibit the screen saver by shortcut – I want also to be able to lock it via shortcut (WIN+L) – I want the screen to be locked automatically after a certain period of time of inactivity My test system is still Openbox on Ubuntu 14.04. This might work for other window managers as well, I just didn’t find the time to test it on different WMs. It works pretty well, so I thought, I should share it. While experimenting with Openbox for BoxBuntu: Replacing Unity with Openbox, I tried to build my own screen saver based on gnome-screensaver but with more advanced features.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |