Annotation of wikisrc/tutorials/how_to_blank_and_unblank_screens_on_lid_close__92__open.mdwn, revision 1.2

1.2     ! schmonz     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/`. 
        !             2: 
        !             3: 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. 
        !             4: 
        !             5: 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: 
        !             6:     
        !             7: #!/bin/sh
        !             8:     # arguments passed by powerd(8): device event
        !             9:     # debugging: exec 1>>/tmp/lid_switch.log 2>&1
        !            10:     if [ -z "$DISPLAY" ]; then export DISPLAY=:0; fi
        !            11:     case "${2}" in
        !            12:      pressed)    # lid closed
        !            13:        /usr/X11R6/bin/xset dpms force off
        !            14:        exit 0
        !            15:        ;;
        !            16:      released)   # lid opened
        !            17:        # need to both force dpms and reset screensaver
        !            18:        /usr/X11R6/bin/xset dpms force on
        !            19:        /usr/X11R6/bin/xset s reset
        !            20:        exit 0
        !            21:        ;;
        !            22:      *)
        !            23:        logger -p warning "${0}: unsupported event ${2} on device ${1}" >&1
        !            24:        exit 1
        !            25:        ;;
        !            26:     esac
        !            27:     

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