[openbox] xset from hot key

Pedro Ribeiro pedrib at gmail.com
Fri Dec 24 11:11:03 EST 2010


On 24 December 2010 15:37, Jorge Almeida <jjalmeida at gmail.com> wrote:
> I'm trying to put the LCD monitor to sleep via rc.conf:
>
>
>    <keybind key="0xdf">
>      <action name="Execute">
>        <execute>xset dpms force off</execute>
>      </action>
>    </keybind>
>
> The problem is that upon pressing the key the monitor darkens but then
> it wakes again one or two seconds later. The monitor button doesn't
> change from green to orange.
> I also tried putting sh -c "xset dpms force off", same problem. It
> happens as if some key were pressed after the hotkey...
>
> The key is one of those non-standard ones (it says "user", and I
> suppose it is some Windows stuff)  But I tried with "C-E" and it has
> exactly the same behaviour.
> When run from a shell, the command "xset dpms force off" works as
> expected (dark screen, orange button, wakes when some key is pressed).
>
> $ xset -q
> Keyboard Control:
>  auto repeat:  on    key click percent:  0    LED mask:  00000000
>  XKB indicators:
>    00: Caps Lock:   off    01: Num Lock:    off    02: Scroll Lock: off
>    03: Shift Lock:  off    04: Group 2:     off    05: Mouse Keys:  off
>  auto repeat delay:  660    repeat rate:  25
>  auto repeating keys:  00ffffffdffffbbf
>                        fadfffdfffdfe5ef
>                        ffffffffffffffff
>                        ffffffffffffffff
>  bell percent:  50    bell pitch:  400    bell duration:  100
> Pointer Control:
>  acceleration:  2/1    threshold:  4
> Screen Saver:
>  prefer blanking:  yes    allow exposures:  yes
>  timeout:  600    cycle:  600
> Colors:
>  default colormap:  0x20    BlackPixel:  0    WhitePixel:  16777215
> Font Path:
>  /usr/share/fonts/misc,/usr/share/fonts/TTF,/usr/share/fonts/Type1,/usr/share/fonts/75dpi,/usr/share/fonts/100dpi,/usr/share/fonts/misc/,/usr/share/fonts/TTF/,/usr/share/fonts/Type1/,/usr/share/fonts/100dpi/,/usr/share/fonts/75dpi/,built-ins
> DPMS (Energy Star):
>  Standby: 600    Suspend: 600    Off: 600
>  DPMS is Enabled
>  Monitor is On
>
>
> Thanks for any suggestion
>
> Jorge Almeida
> _______________________________________________
> openbox mailing list
> openbox at icculus.org
> http://icculus.org/mailman/listinfo/openbox
>

Hi Jorge,

I have set the same thing (screensaver lock + dpms force off) with a keybinding.
The way I do it is by invoking a shell script which has the executable bit set.

    <keybind key="XF86ScreenSaver">
      <action name="Execute">
        <execute>/path-to-script/xscreensaver-control.sh lock</execute>
      </action>
    </keybind>

The lock function in the script does this:

Lock (){
      /usr/bin/xscreensaver-command -lock
      /usr/bin/xset dpms force off
      exit 0
}

This works perfectly. Please let me know if you have any more questions.

Regards,
Pedro


More information about the openbox mailing list