Simple devd.conf rule has no effect

Warren Block wblock at wonkity.com
Wed Apr 6 21:37:07 UTC 2016


On Wed, 6 Apr 2016, Brandon J. Wandersee wrote:

>
> Hi, folks. I'm trying to get my laptop screen to lock when the lid
> closes, using x11/slock. I've created the file /etc/devd/lidlock.conf
> with the following rule:
>
> | notify 0 {
> |         match   "system"        "ACPI";
> |         match   "subsystem"     "Lid";
> |         match   "notify"        "0x00";
> |         action  "/usr/local/bin/slock";
> | };
>
> This is really just a slight variation on the example from the
> devd.conf(5) man page. Now when I close the lid, the screen fails to
> lock, yet /var/log/messages displays the message "devd: Executing
> 'slock'". Any advice on what to look into to figure out why the program
> is not actually executed? Thanks in advace.

devd(8) stuff runs as root, I think.  So it probably does not have 
$DISPLAY set.  Maybe use su to switch to the normal X user and execute 
the command:

   su -l xusername -c 'setenv DISPLAY :0.0 && /usr/local/bin/slock'


More information about the freebsd-questions mailing list