Screen blanking - running commands on boot

Use this forum for questions related to graphics, sound or desktop environments.

Screen blanking - running commands on boot

Postby Hallvor » August 27th, 2011, 11:32 am

I want to avoid the screen going blank when I am watching a movie on my media center/server. I have discovered that these commands fixes the issue of screen blanking (as root):

Code: Select all
xset s off
xset -dpms


But after reboot, the screen blanking works again. I need a way to make them run on every boot. I read somewhere that you could insert the lines in ~/.xinitrc, but that does not seem to work. I could of course make a bash script and put it on my desktop, but is there a better solution where everything runs as root in the background?
Desktop: AMD Athlon X2 3800+, 2,5 GB RAM, MSI NX8400GS, 2 TB HDD, Debian Squeeze (XFCE)
Media center/seedbox: Raspberry Pi, Raspbian (LXDE)
User avatar
Hallvor
 
Posts: 232
Joined: February 10th, 2011, 2:11 pm
Location: Kristiansand, Norway

Re: Screen blanking - running commands on boot

Postby julian67 » August 27th, 2011, 2:05 pm

I ran into this problem with my laptop but I fixed it a different way (without needing to manually disable/enable monitor power saving before/after watching a movie).

It seems the problem lies with the screensaver/power management apps. From the mplayer man page:
-heartbeat-cmd
Command that is executed every 30 seconds during playback via system() - i.e. using the shell.

NOTE: MPlayer uses this command without any checking, it is your responsibility to ensure it does
not cause security problems (e.g. make sure to use full paths if "." is in your path like on Win‐
dows). It also only works when playing video (i.e. not with -novideo but works with -vo null).

This can be "misused" to disable screensavers that do not support the proper X API (also see
-stop-xscreensaver). If you think this is too complicated, ask the author of the screensaver pro‐
gram to support the proper X APIs.

EXAMPLE for xscreensaver: mplayer -heartbeat-cmd "xscreensaver-command -deactivate" file

EXAMPLE for GNOME screensaver: mplayer -heartbeat-cmd "gnome-screensaver-command -p" file


So on my laptop my ~/.mplayer/config contains
Code: Select all
# Global Options
heartbeat-cmd="/usr/bin/xscreensaver-command -deactivate > /dev/null"


This works really well. It's automatic while mplayer is playing video and has no effect while using mplayer for anything else (playing audio, dumping streams etc). If I pause a movie the power management retakes control (until playback is resumed) and on battery power will dim the screen and eventually blank it.

I don't know what you can do with other players or if no screensaver or no power management is installed (beyond acpi defaults).
User avatar
julian67
 
Posts: 249
Joined: February 9th, 2011, 12:59 pm

Re: Screen blanking - running commands on boot

Postby huggybear » August 27th, 2011, 3:46 pm

Wow, thank you julian for sharing this!

This is a bit unrelated to halvor's problem, but I'll post it anways:
On Ubuntu, they also have caffeine, but for some reason it's not in the Debian repos. The project started out on launchpad, maybe that's why. However, it always worked well when I tried it on Ubuntu. It is basically just a gnome applet that can be set up to disable screensavers and power saving for individual apps and even Flash video. Not sure whether this really works outside of Gnome, or even outside of Ubuntu for that matter. I'll try it on Debian with Xfce and report about it.

http://pragmattica.wordpress.com/2009/1 ... -released/

https://launchpad.net/caffeine
<< I guess that makes them "DEBITARDS" ..... >>
User avatar
huggybear
 
Posts: 1408
Joined: February 9th, 2011, 6:54 pm
Location: Gargantua's cookie jar

Re: Screen blanking - running commands on boot

Postby huggybear » August 27th, 2011, 4:18 pm

Hmm... these folks either don't deliver the source code or obscure it, since you can't just grab the source for the latest version (or maybe I'm blind). So not like! Also, the debs on launchpad don't work on Debian, since python-appindicator is missing in the repos.
<< I guess that makes them "DEBITARDS" ..... >>
User avatar
huggybear
 
Posts: 1408
Joined: February 9th, 2011, 6:54 pm
Location: Gargantua's cookie jar

Re: Screen blanking - running commands on boot

Postby Hallvor » August 27th, 2011, 7:09 pm

Thanks. Should have said I only use VLC (on XFCE).

I did notice a command in the VLC wiki that might work:

vlc --disable-screensaver <filename>

Will do some testing and see if it works.

Edit: That seems to have fixed the problem. Why on earth isn't this enabled by default? Who wants the screen to go blank in the middle of a movie anyway?

Edit2: No, it was actually adding the two first commands to autostart that did the trick.
Desktop: AMD Athlon X2 3800+, 2,5 GB RAM, MSI NX8400GS, 2 TB HDD, Debian Squeeze (XFCE)
Media center/seedbox: Raspberry Pi, Raspbian (LXDE)
User avatar
Hallvor
 
Posts: 232
Joined: February 10th, 2011, 2:11 pm
Location: Kristiansand, Norway


Return to Desktop & Multimedia

Who is online

Users browsing this forum: No registered users and 1 guest

x