Diff for /wikisrc/tutorials/how_to_blank_and_unblank_screens_on_lid_close__92__open.mdwn between versions 1.1 and 1.2

version 1.1, 2011/11/20 20:55:21 version 1.2, 2012/02/05 07:14:36
Line 1 Line 1
 The [powerd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?powerd+8+NetBSD-current) daemon acts upon power management events posted by the kernel's power management facility, translating the events into a script name and arguments. These scripts are found in `/etc/powerd/scripts/`.  The [powerd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?powerd+8+NetBSD-current) daemon acts upon power management events posted by the kernel's power management facility, translating the events into a script name and arguments. These scripts are found in `/etc/powerd/scripts/`. 
   
 The `lid_switch` script is called on lid-open and -close events. An event of `pressed` means the lid has been closed, and `released` that the lid has been opened.  The `lid_switch` script is called on lid-open and -close events. An event of `pressed` means the lid has been closed, and `released` that the lid has been opened. 
   
 The following `lid_switch` uses [xset(1)](http://netbsd.gw.com/cgi-bin/man-cgi?xset+1+NetBSD-current) to forcibly blank the screen on lid-close, and refresh the screen on lid-open:  The following `lid_switch` uses [xset(1)](http://netbsd.gw.com/cgi-bin/man-cgi?xset+1+NetBSD-current) to forcibly blank the screen on lid-close, and refresh the screen on lid-open: 
          
 #!/bin/sh  #!/bin/sh
     # arguments passed by powerd(8): device event      # arguments passed by powerd(8): device event
     # debugging: exec 1>>/tmp/lid_switch.log 2>&1      # debugging: exec 1>>/tmp/lid_switch.log 2>&1
     if [ -z "$DISPLAY" ]; then export DISPLAY=:0; fi      if [ -z "$DISPLAY" ]; then export DISPLAY=:0; fi
     case "${2}" in      case "${2}" in
      pressed)    # lid closed       pressed)    # lid closed
        /usr/X11R6/bin/xset dpms force off         /usr/X11R6/bin/xset dpms force off
        exit 0         exit 0
        ;;         ;;
      released)   # lid opened       released)   # lid opened
        # need to both force dpms and reset screensaver         # need to both force dpms and reset screensaver
        /usr/X11R6/bin/xset dpms force on         /usr/X11R6/bin/xset dpms force on
        /usr/X11R6/bin/xset s reset         /usr/X11R6/bin/xset s reset
        exit 0         exit 0
        ;;         ;;
      *)       *)
        logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1         logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
        exit 1         exit 1
        ;;         ;;
     esac      esac
          

Removed from v.1.1  
changed lines
  Added in v.1.2


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb