You are not logged in.

#1 2011-07-19 18:00:15

cybertorture
Member
Registered: 2010-05-05
Posts: 339

VLC and totem on Openbox - ugly way to deal with DPMS

Hello everyone,
from quite some time i got this kind of problem that when i watch movie with VLC or Totem on Openbox my Monitors goes blank every 10 minutes.
Triyed a lot of google-ing bbs.archlinux.org search and frankly i did not see any salvation smile.
So i try to solve this "Ugly" way and i want to share it with those who need it (i realy hope i m not alone here and i did not miss somewhere some better idea Oo)

1st - create script file (aka. ~/player.sh)

> #!/bin/sh
#ugly way to prevent DMPS , maybe i ll try pidof instead of ps aux , but i m too lazy atm ;)
SERVICE1='vlc'
SERVICE2='totem'

if pgrep $SERVICE1 > /dev/null
then
     xset -dpms
elif pgrep $SERVICE2 > /dev/null
then
     xset -dpms
else
     xset +dpms
fi

corrected as karol suggest

2nd - put it in :
2.1 - conky (recomended)

${execi 300 ~/player.sh}

2.2 - crontab (not recomended if u ask me) see here

downsides are - its ugly and it wont let dpms works until u close player .

Hope it will help someone, and best wishes wink

Last edited by cybertorture (2011-07-19 18:08:07)


O' rly ? Ya rly Oo

Offline

#2 2011-07-19 18:04:44

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: VLC and totem on Openbox - ugly way to deal with DPMS

IIRC 'ps ax | grep -v grep | grep foo' is equivalent to 'pgrep foo'.

Offline

#3 2011-07-19 18:06:31

cybertorture
Member
Registered: 2010-05-05
Posts: 339

Re: VLC and totem on Openbox - ugly way to deal with DPMS

Thanks a lot karol


O' rly ? Ya rly Oo

Offline

#4 2011-07-19 18:39:27

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: VLC and totem on Openbox - ugly way to deal with DPMS

totem relies on gnome-session to inhibit the monitor and screensaver. no wonder it doesn't work out of his environment. in the end is a gnome application.


Give what you have. To someone, it may be better than you dare to think.

Offline

#5 2011-07-19 18:58:44

cybertorture
Member
Registered: 2010-05-05
Posts: 339

Re: VLC and totem on Openbox - ugly way to deal with DPMS

True, i can understand totem, but its a real shame for vlc. I can confirm that vlc works same way in Freebsd 8.2 with hal support etc..


O' rly ? Ya rly Oo

Offline

#6 2011-07-19 18:59:12

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: VLC and totem on Openbox - ugly way to deal with DPMS

I do it with this running in the background:

#!/bin/bash

# Stop xscreensaver from starting and monitor from blanking
# if one or more defined processes are running
#
# Last edited: 27-Jun-10

for instance in $(pidof -x -o %PPID $(basename $0)); do
  if [ -n "$(ps -p $instance -o user | grep $USER)" ]; then
    echo $(basename $0)": Killing now defunct instance (pid $instance)"
    kill $instance
  fi
done

# Disable screensaver etc. when any of the following processes are running
process_list="firefox-bin,mplayer,vdr-sxfe,vlc,xine"

# Get current DPMS state (enabled/disabled) as default
dpms_default=$(xset q | grep "DPMS is" | cut -d" " -f5)

while [ true ]; do
  sleep 60

  dpms_state=$(xset q | grep "DPMS is" | cut -d" " -f5)

  if [ -n "$(ps -o pid --no-headers -C ${process_list})" ]; then
    if [ -n "$(pidof "xscreensaver")" ]; then
      xscreensaver-command -deactivate &> /dev/null
    fi
    if [ "${dpms_state}" = "Enabled" ]; then
      xset -dpms
    fi
  elif [ "${dpms_state}" = "Disabled" ] && [ "${dpms_default}" = "Enabled" ]; then
    xset +dpms
  fi
done

Offline

#7 2011-07-19 19:07:31

cybertorture
Member
Registered: 2010-05-05
Posts: 339

Re: VLC and totem on Openbox - ugly way to deal with DPMS

@azleifel
This looks prommising, i can say way better than mine big_smile
Thanks wink


O' rly ? Ya rly Oo

Offline

Board footer

Powered by FluxBB