You are not logged in.

#1 2010-07-03 14:09:58

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Awesome WM, disable screen shut off with VLC?

I am using Awesome and when I run VLC my screen shuts off after 10 minutes. I know it's because of my xorg,

Section "ServerFlags"
    Option         "DefaultServerLayout" "Layout0"
    Option         "BlankTime" "5"
    Option         "StandbyTime" "10"
    Option         "OffTime" "15"
EndSection

My question is, how can I disable it when VLC is full screen (or running at all?). It didn't give me any problems when I had a DE, but now I don't. I assume it must be something with Awesome. Is there anything I can do?

I have checked the option in VLC to disable hibernation and everything, but that doesn't do anything.

Offline

#2 2010-07-03 14:12:41

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: Awesome WM, disable screen shut off with VLC?

Try running caffeine:

http://aur.archlinux.org/packages.php?ID=29762

You can even configure it to run when you start vlc.

Offline

#3 2010-07-03 14:28:04

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

How do you do that?

I have dug up this, but how do you use it and how does that work ?

#!/bin/bash

PID=$(pgrep caffeine)
  
if [ -z "$PID" ]; then
  caffeine -a &>/dev/null &
  PID=$!
fi

/usr/bin/vlc "$@"
kill $PID

Offline

#4 2010-07-03 14:34:12

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: Awesome WM, disable screen shut off with VLC?

Personally I just run caffeine and use its tray icon to control/config it.

Offline

#5 2010-07-03 14:38:04

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

$ caffeine
** Message: pygobject_register_sinkfunc is deprecated (GtkWindow)
** Message: pygobject_register_sinkfunc is deprecated (GtkInvisible)
** Message: pygobject_register_sinkfunc is deprecated (GtkObject)
Traceback (most recent call last):
  File "/usr/bin/caffeine", line 38, in <module>
    import caffeine
  File "/usr/lib/python2.6/site-packages/caffeine/__init__.py", line 171, in <module>
    from caffeine.main import main
  File "/usr/lib/python2.6/site-packages/caffeine/main.py", line 46, in <module>
    generic = icon_theme.load_icon("application-x-executable", 16, gtk.ICON_LOOKUP_NO_SVG)
glib.GError: Icon 'application-x-executable' not present in theme

sad

edit:

There are a butt load of dependencies and what not for caffeine, including fam, hal etc. I don't use hal. I don't use fam or gamin. Hmmmm

Last edited by Google (2010-07-03 14:40:09)

Offline

#6 2010-07-03 14:40:45

ApotheoZ
Member
Registered: 2009-08-10
Posts: 40

Re: Awesome WM, disable screen shut off with VLC?

http://wiki.archlinux.org/index.php/DPM … s_damir.29

Now I will try to find how to execute this at VLC launch

Edit :

[Deprecated]

# nano /usr/bin/vlc-dpms

#!/bin/sh
/usr/bin/xset -dpms &
/usr/bin/vlc $1

# chmod 777 /usr/bin/vlc-dpms
vlc-dpms

Now You have to find how to do" xset dpms" when you turn off VLC.

Last edited by ApotheoZ (2010-07-03 14:52:22)

Offline

#7 2010-07-03 14:51:59

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

So we need to execute 'xset -dpms' before launching VLC and then turn dpms back on when VLC closes? Sounds like a bash script to me:

I am a newbie, but won't this turn off dpms when  VLC is running?

#!/bin/bash

PID=$(pgrep vlc)
  
if [ -z "$PID" ]; then
  xset -dpms
  PID=$!
fi

Last edited by Google (2010-07-03 14:54:27)

Offline

#8 2010-07-03 14:54:23

ApotheoZ
Member
Registered: 2009-08-10
Posts: 40

Re: Awesome WM, disable screen shut off with VLC?

I dont know anything about bash, but the script i gave you works.
If you prefer, you can make it in your home and make an alias to run this script.
But you still have the problem to turn on dpms when VLC stop

Offline

#9 2010-07-03 15:04:43

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

I have made two scripts. One you posted for turning off dpms and one for turning it back on. I just need to figure out how to launch the turn on script when the VLC process is killed. I guess I can wait until someone has a solution T___T

Thanks!

Offline

#10 2010-07-03 15:55:34

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Awesome WM, disable screen shut off with VLC?

You can make one script which runs vlc, and then runs the script to turn on dpms. For example:

#!/bin/bash
# run the real vlc with all arguments passed to this script
/usr/bin/vlc "$@"
# Then once it has quit, turn on dpms
/path/to/turn/on/dpms

With this you can even name it vlc and it will work as a drop in replacement. If you already are using a script to turn off dpms when vlc starts in this manner, just add the line to run the turn-on script at the end.

I think you had the right idea with your scripts, but it would just be easier to have one script to turn it off, run vlc, and turn it back on. Otherwise you manually run one script whenever you run vlc to turn dpms off. Then you also have to manually run the turn on script once your done.

Last edited by jac (2010-07-03 16:01:43)

Offline

#11 2010-07-03 16:00:46

ApotheoZ
Member
Registered: 2009-08-10
Posts: 40

Re: Awesome WM, disable screen shut off with VLC?

You mean "/path/to/turn/on/dpms" will not be execute as soon as vlc has started ?
Because if it's the case, Google you have here a solved problem big_smile .

Offline

#12 2010-07-03 16:04:00

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Awesome WM, disable screen shut off with VLC?

Correct, since you do not background the vlc process (using & at the end) it will stop right there until vlc exits.

Something I just noticed about the script in post #7 is the fact that it turns off dpms if vlc is NOT running, that is when the PID of vlc is zero.

Offline

#13 2010-07-03 16:20:37

ApotheoZ
Member
Registered: 2009-08-10
Posts: 40

Re: Awesome WM, disable screen shut off with VLC?

So here is your final script :

#!/bin/sh
/usr/bin/xset -dpms &
/usr/bin/vlc $1
/usr/bin/xset dpms

@jac : why do you use $@ instead of $1 (in the way I don't know what is $@ big_smile )

Offline

#14 2010-07-03 16:56:41

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

I ran the script directly but the screen is still turning off  sad

I am clueless

Offline

#15 2010-07-03 17:15:35

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Awesome WM, disable screen shut off with VLC?

@ApotheoZ: $1 is the first argument to the script only, $@ expands to all arguments to the script. For instance, if you tried to pass any switches to vlc with your example, it would only get the first thing (probably a switch). With $@ it gets the switches and all.

@Google: Maybe try turning off dpms with xset, to see if that actually works?
Also, Looking at the man page, maybe you should use

#!/bin/sh
xset dpms 0 0 0
# we only need the full path here in order to avoid an infinite loop in case this script is named vlc
/usr/bin/vlc $1
xset +dpms

I'm uncertain whether or not "xset +dpms" returns the times to default or not...

Last edited by jac (2010-07-03 17:16:22)

Offline

#16 2010-07-03 17:32:38

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

I just gave it a shot and my screen still shut off. It's being really stubborn. Could it be because I am also using blanktime? I don't see blank time anywhere in there, only standby, offtime and suspend.

Offline

#17 2010-07-03 19:02:44

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Awesome WM, disable screen shut off with VLC?

It could be, I really don't know anything about this. I see your blank time is set to 5 minutes, so does it go off after 5 minutes? I'd say if it does then blank time is to blame.

Flipping through the man page for xset, I see that the screensaver has the word "blank" in it, so you could also try using "xset s off" before you start vlc, to see if it is a screensaver activating and not dpms.

Does your monitor actually turn off, or does it just go black? My monitor can be on (viewing something), blank but on, and off. I'm not sure exactly how those correspond to the three values in the dpms setting, but it might help determine if it actually is dpms and not something like a screensaver.

Offline

#18 2010-07-03 20:52:32

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: Awesome WM, disable screen shut off with VLC?

# Disable screen blanking
xset s noblank
xset s noexpose
xset s off -dpms

Let us know how it goes.


You need to install an RTFM interface.

Offline

#19 2010-07-03 21:10:55

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

anrxc wrote:

# Disable screen blanking
xset s noblank
xset s noexpose
xset s off -dpms

Let us know how it goes.

I did a lot of testing and this script seems to do the trick for me:

#!/bin/sh
#Script to turn off monitor modes that will power down, standby or blank the screen
#

#Disable modes
/usr/bin/xset -dpms &
/usr/bin/xset s off &

#Open VLC
/usr/bin/vlc $1

#Re-enable modes
/usr/bin/xset dpms
/usr/bin/xset s on

I wrote an alias in .bashrc, "alias vlc='vlc.sh' and it works when I call vlc from the command line. The only problem is my file manager. I am using Ranger, and in apps.py I coded it to open movie extensions with 'vlc' and it does, but it doesn't seem to use the 'vlc' from .bashrc, because the screen shuts off when I open movies from Ranger.

I am using this is Ranger:

if f.extension in (c, 'tp', 'wav', 'asf', 'vob', 'ts', 'mpg', 'mpeg', 'mp3', 'flv', 'wmv'):
                                return self.either(c, 'vlc')

Any ideas why Ranger isn't working?

Offline

#20 2010-07-04 11:35:34

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Awesome WM, disable screen shut off with VLC?

I'm guessing that Ranger is still running the actual vlc. I'm going to take a stab at it and say that you could either change that line to be

if f.extension in (c, 'tp', 'wav', 'asf', 'vob', 'ts', 'mpg', 'mpeg', 'mp3', 'flv', 'wmv'):
                                return self.either(c, 'vlc.sh')

Or, rename vlc.sh to just vlc and make sure it's in your path (the directory it's in must also be before the /usr/bin directory, so that it will take precedence). If it is, anything trying to execute vlc from your user should execute the script without needing any aliases or other work-arounds.

Last edited by jac (2010-07-04 11:36:25)

Offline

#21 2010-07-10 03:12:21

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: Awesome WM, disable screen shut off with VLC?

hi I addressed some issues and some unique to me.

1) check if you are loading VLC or a file with VLC (so launch VLC or VLC $1)
2) make the $1 work with spaces in the file name "$1")
3) check if you have alternate sound devices available

This may or may not be useful but I post anyway in case it is...

#!/bin/bash
function askuser {
    #ask user
    ans=$(zenity  --width="210" --height="190" --title="VLC" --text="Standard or USB sound output?:" --list --radiolist --column "" --column "" FALSE Standard TRUE USB); echo $ans
    # cases for user to select
    case $ans in
        Standard)
            # use VLC with speakers
            cp ~/mybin/vlc-speakers ~/.config/vlc/vlcrc;
        ;;
        USB)
            # use VLC with headphones
            cp ~/mybin/vlc-headphones ~/.config/vlc/vlcrc;
        ;;
    esac
}
#
if [ -a /dev/audio1 ]
then
    askuser
else
    echo "skipping usb question"
fi
#Turn off monitor modes that will power down, standby or blank the screen
#Disable modes
/usr/bin/xset -dpms &
/usr/bin/xset s off &

#Open VLC
if [ -n "$1" ]
then
    /usr/bin/vlc "$1"
else
    /usr/bin/vlc
fi

#Re-enable modes
/usr/bin/xset dpms
/usr/bin/xset s on
exit

EDIT: oops left some comments in that shouldn't be there

Last edited by tawan (2010-07-10 03:14:15)

Offline

#22 2010-07-10 13:38:30

Google
Member
From: Mountain View, California
Registered: 2010-05-31
Posts: 484
Website

Re: Awesome WM, disable screen shut off with VLC?

Thanks, everything is working well. I have one more problem but the problem is in Ranger file manager. The script is working nicely, but for some reason it's not reading filenames with spaces in it.

Offline

#23 2010-07-11 08:59:33

tawan
Member
Registered: 2010-03-02
Posts: 290
Website

Re: Awesome WM, disable screen shut off with VLC?

Google wrote:

The script is working nicely, but for some reason it's not reading filenames with spaces in it.

$1 needs to be "$1"

Offline

#24 2010-07-14 12:34:42

amkan13
Member
Registered: 2010-07-12
Posts: 2

Re: Awesome WM, disable screen shut off with VLC?

i was having the same issues but with openbox.
disabling x screensaver and dpms worked.

on further investigation i didnt have a problem with smplayer
there seems to be a bug in the latest vlc causing this: http://forum.videolan.org/viewtopic.php?f=13&t=78698

Offline

#25 2011-01-07 00:02:14

ianux
Member
From: France
Registered: 2008-12-02
Posts: 16

Re: Awesome WM, disable screen shut off with VLC?

I had the same problem too, but now, I have understand it.
In VLC preferences, showing all, in advanced settings there is a checkbox about the power management daemon. When checked, VLC disable DPMS.
You can see it by playing a video and run

xset q|grep DPMS

wich should show

DPMS is Disabled

.Then stop the video and the same command should output

DPMS is Enabled

BUT, VLC seems not to disable screensaver. You can see if screensaver is running with

xset q|grep -A 2 Screen

. If timeout is non-null, then screensaver/blank screen is enabled.

So you must run

xset s off

before running VLC. And if you want to enabled screensaver again

xset s on

which restore default blanking time.

In fact, I think screensaver is redundant with DPMS (and makes trouble with web browser too); so I disable it in xinitrc (but still have power saving with DPMS).

PS: I don't know how, but MPlayer (with --stop-xscreensaver) manage all of this very well...

Offline

Board footer

Powered by FluxBB