“Oh nice, for today I’m done! Now lets watch a movie before going to sleep!”
This could be considered a justified desire right? After a day of work why not enjoy a movie?
Unfortunately, if you are running a Linux distro you may encouter some problems depending on the Desktop Environment (DE) and the power management system you are relying on.
Those problems can all be summarized in more or less random screensavers activations and/or consequent screens blanking.
Some DE comes with proper shortcuts to disable the system that handle the functionality under discussion.
However, it may happens that the functionality gets handled not entirely by a single application (i.e. system) but by more than one (e.g. screensaver, DE locker application, and eventual power management system)
In this case you may not find a quick solution that works right out of the box but nothing stops you from implementing your personal custom solution!
This is exactly what I did and here’s what I end up for my system (i.e. XFCE 4.10 with LightLocker and the default xfce4-power-manager).
This isn’t really nothing special, just a switch in a few lines of bash! 😉
#!/bin/sh
enabled_flag='DPMS is Enabled'
if [ "`xset -q | grep "${enabled_flag}"`" ]; then
notify-send "Screensaver disabled"
xset s off -dpms
else
notify-send "Screensaver enabled"
xset s on +dpms
fi
As you can see I just check the state of DPMS by grepping the result of querying the xset utility and then adjust the settings (still through xset) accordingly.
The notify-send "..."
is only used to get some visual feedback.
Once saved and made it executable you can simply bind the tiny script to a custom shortcut. Depending on the DE you are using there may be some differences in this last step but it shouldn’t be particular difficult to get it done.
For a more comprehensive explanation of what is going on under the hood take a look at the great Arch doc linked above (https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling).
Now you only need to fire up your favorite player and invoke the over mentioned script through the chosen shortcut to watch what you want without being bothered!
Enjoy it! 🙂
Leave a Reply