Page 3 of 7 FirstFirst 12345 ... LastLast
Results 21 to 30 of 62

Thread: Problem with xset dpms force off

  1. #21
    Join Date
    Nov 2009
    Beans
    1,203

    Re: Problem with xset dpms force off

    Alex Cabal's workaround is what I've used since the problem first occurred with me in Karmic:

    http://alexcabal.com/turn-your-lapto...ubuntu-karmic/

    László Monda's Blog's post also sounds intriguing. I'll definitely check his out as I hadn't run across it in my many nights of Googling a solution to this very problem.
    Last edited by inameiname; May 25th, 2010 at 09:23 AM.

  2. #22
    Join Date
    Jun 2007
    Beans
    236

    Re: Problem with xset dpms force off

    I thought about removing gnome-screensaver but didn't go with since I've had issues in the past doing that (maybe related with gnome-power-manager turning the screen off), but I guess there's no harm in trying.

    EDIT: Ok, I tried it and now I figured out what the issue is: the screen cannot be locked without gnome-screensaver. Since I need to be able to lock it, my workaround is to simply add "gnome-screensaver-command -i" to the startup applications. As nxmehta points out, I don't really need it working...

    EDIT 2: This doesn't work either . By inhibiting gnome-screensaver the locking facility is also disabled.
    Last edited by muadnu; May 25th, 2010 at 03:27 PM.

  3. #23
    Join Date
    Nov 2009
    Beans
    1,203

    Re: Problem with xset dpms force off

    Okay so trying Monda's script, what it does for me is that it pops up my screensaver for a half a second, before proceeding to a black screen. However, after a few minutes (no more than 3 or so) the screensaver suddenly pops up. And if I then push something, I notice my screen is locked and I must log in. Oh, and fyi, my screensaver is set to turn on in 5 minutes, and to not display a log in box, meaning it's not locked, if that makes any difference.

    However, trying Muadnu's way of writing out Monda's script, it is delayed a few seconds, and then goes black and seems to stay that way:

    #!/bin/bash
    sleep 3 && xset -display :0.0 dpms force off && gnome-screensaver-command -i


    It seems to work, minus the locked screen and log in requirement when a button is touched. Thus, I'm guessing the placement of that 'gnome-screensaver-command -i' changes things from Monda's original script.

    So it seems if I just use that as my script, bind it to say a launcher on my desktop or panel, or even to a hardware button, the screen will forever stay off until I push something for it to resume. Anybody else get that? However, due to that 'gnome-screensaver-command -i' part, my screensaver won't work again. Am I right, or does 'inhibited' mean something else? And also, if I want a locked screen desire, I'm also out of luck too? Not to say I need the latter really.

    As I mentioned earlier, Alex Cabal's workaround is what I've used for months, but if this one as it stands now does what his does but more efficiently, I'm ready to try it.
    Last edited by inameiname; May 26th, 2010 at 02:00 PM.

  4. #24
    Join Date
    Aug 2008
    Beans
    24

    Re: Problem with xset dpms force off

    Well, for some reason removing gnome-screensaver didn't seem to work for me after thorough testing. The whole 'gnome-screensaver-command -i' thing DID seem to work, which is weird.

    I got sufficiently pissed off about this problem today that I wrote a python script that is much more elegant than the whole run 'xset dpms force off' in an infinite loop thing, then somehow try to break the loop. For this script to work you need python and the python-xlib package installed. Paste the following into a file, chmod +x it, and then run it to finally turn off the screen once and for all.

    Code:
    #!/usr/bin/python
    
    import time
    import subprocess
    from Xlib import X
    from Xlib.display import Display
    
    display = Display(':0')
    root = display.screen().root
    root.grab_pointer(True, 
            X.ButtonPressMask | X.ButtonReleaseMask | X.PointerMotionMask, 
            X.GrabModeAsync, X.GrabModeAsync, 0, 0, X.CurrentTime)
    root.grab_keyboard(True, 
            X.GrabModeAsync, X.GrabModeAsync, X.CurrentTime)
    
    subprocess.call('xset dpms force off'.split())
    p = subprocess.Popen('gnome-screensaver-command -i'.split())
    time.sleep(1)
    
    while True:
        print display.next_event()
        p.terminate()
        break
    This is just my first shot at this, so it might not work perfectly. Basically what it does is it calls 'xset dpms force off', forks a process to inhibit gnome-screensaver, waits one second, then sits waiting for any user input to the X server. If the user moves the mouse, hits a mouse button, or presses a key, the script terminates the gnome-screensaver inhibit command and exits.

    Hopefully this will work. I'll post back if I ever notice the backlight turning back on. Then we'll have to go back to the drawing board...

    If you wanted this to lock the screensaver as well you could probably put in a "subprocess.Popen('gnome-screensaver-command -l'.split())" call after the "p.termintate()" call (but I suspect the timing might be a little off).
    Last edited by nxmehta; June 9th, 2010 at 08:00 AM.

  5. #25
    Join Date
    Jun 2007
    Beans
    236

    Re: Problem with xset dpms force off

    Thanks! It works great for me, at least for a minute (haven't tried it longer).

  6. #26
    Join Date
    Nov 2009
    Beans
    1,203

    Re: Problem with xset dpms force off

    Very cool, nxmehta. I will have to try it and get back to you on it.

    UPDATE:

    Works just fine for me! Wow, after 8.5 months since Karmic was released and this problem started (at least from what I've gotten online), a real solution seems to have been found! Thanks. Credit to all those that contributed to the final product, of course.

    Oh, and while it's not a huge issue for me, the 'lock screen' command that you suggested to add seems to also work, despite the timing, as you said might be an issue. Basically, when I hit a button, or move the cursor, it pops up my screen for a second, only to suddenly go to a black screen, sometimes my screensaver, and then if I hit a button again and/or continue to move the cursor for a sec, it goes to the login box.
    Last edited by inameiname; June 9th, 2010 at 05:19 PM.

  7. #27
    Join Date
    Dec 2007
    Beans
    17

    Re: Problem with xset dpms force off

    Have you tried

    Code:
    sleep 1 && gnome-screensaver-command -a && xset dpms force off
    ?

  8. #28
    Join Date
    Nov 2009
    Beans
    1,203

    Re: Problem with xset dpms force off

    Unfortunately Caprilo, what:

    sleep 1 && gnome-screensaver-command -a && xset dpms force off

    does for me is that it turns off the display for a second or two, and then either goes to screensaver, or keeps the screen backlight on.

    Regardless, the fix previously that I mentioned working continues to work flawlessly.

  9. #29
    Join Date
    Aug 2006
    Location
    England
    Beans
    110
    Distro
    Ubuntu 6.10 Edgy

    Re: Problem with xset dpms force off

    Sorry, commented to soon...
    Last edited by SirPecanGum; July 5th, 2010 at 11:04 AM. Reason: Incorrect. No need to waste other people's time as well as my own! Sorry!

  10. #30
    Join Date
    Apr 2008
    Beans
    5

    Re: Problem with xset dpms force off

    Thank you very much for your script nxmehta. I am only recently using Ubuntu as my full time OS at home. Fortunately I had started getting into CLI on my personal mac which is currently being used at work but I am still very green to the *NIX like OS's.

    I'm executing this script via an alias. How can I make the script run silently with nothing appearing on std output? The output to std out is somewhat undesirable. I tried using

    alias sd='nohup path/to/script &'

    and once more without the nohup. Didn't get the effect I wanted. In the script itself I see the text "print display.next_event()" Is that writing to std out?

    Other than that I'm very pleased with the script.

Page 3 of 7 FirstFirst 12345 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •