You are not logged in.

#1 2010-08-12 03:42:16

kryptobs2000
Member
Registered: 2010-07-10
Posts: 14

Any way to put the monitor into power saving mode via the cli?

I want to do this primary so I can have a video play and when it's done immediately turn the monitor off. I'll often go to sleep watching something and it's annoying if the monitor stays on lighting up the room yunno. Figured the easiest solution would just be to use mplayer since it exits once the video is over and just have the next command run. If there's not is there any other way to accomplish this?

Last edited by kryptobs2000 (2010-08-12 03:42:32)

Offline

#2 2010-08-12 03:49:10

alexandrite
Member
Registered: 2009-03-27
Posts: 326

Re: Any way to put the monitor into power saving mode via the cli?

Seems like mplayer would be the way to go for the reason you mentioned.

If you want to set the monitor to powersave mode, try something like

mplayer YourMovie.avi; xset dpms force off

Last edited by alexandrite (2010-08-12 03:50:11)

Offline

#3 2010-08-12 05:08:46

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: Any way to put the monitor into power saving mode via the cli?

Hey,

first of all i second

xset dpms force off

but i also watch often movies to go to sleep, and for that, i've written a small python script:

#!/usr/bin/env python
import subprocess
import time
import sys

current_percent = 100
sleep_time = (int(sys.argv[1]) * 60) /100.0

while current_percent > 0:
    vol_str = "%s%%" % current_percent
    subprocess.Popen(['amixer','set', '"Master Front"', vol_str]).communicate()
    print "set volume to %s" % vol_str
    time.sleep(sleep_time)
    current_percent -= 1
subprocess.Popen(['xset','dpms','force','off'])

It takes a time in minutes as parameter and it turns the volume down from 100% to 0% within this time and after that turns the monitor into powersave mode.
Maybe you have to adjust 'Master Front' to your main channel.

Offline

#4 2010-08-12 05:20:55

alexandrite
Member
Registered: 2009-03-27
Posts: 326

Re: Any way to put the monitor into power saving mode via the cli?

knopwob wrote:

Hey,

first of all i second

xset dpms force off

but i also watch often movies to go to sleep, and for that, i've written a small python script:

#!/usr/bin/env python
import subprocess
import time
import sys

current_percent = 100
sleep_time = (int(sys.argv[1]) * 60) /100.0

while current_percent > 0:
    vol_str = "%s%%" % current_percent
    subprocess.Popen(['amixer','set', '"Master Front"', vol_str]).communicate()
    print "set volume to %s" % vol_str
    time.sleep(sleep_time)
    current_percent -= 1
subprocess.Popen(['xset','dpms','force','off'])

It takes a time in minutes as parameter and it turns the volume down from 100% to 0% within this time and after that turns the monitor into powersave mode.
Maybe you have to adjust 'Master Front' to your main channel.

Fancy smile

Last edited by alexandrite (2010-08-12 05:46:03)

Offline

Board footer

Powered by FluxBB