From owner-freebsd-questions@freebsd.org Wed Apr 20 09:11:30 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D626BB15615 for ; Wed, 20 Apr 2016 09:11:30 +0000 (UTC) (envelope-from brandon.wandersee@gmail.com) Received: from mail-ig0-f193.google.com (mail-ig0-f193.google.com [209.85.213.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AEF821C68 for ; Wed, 20 Apr 2016 09:11:30 +0000 (UTC) (envelope-from brandon.wandersee@gmail.com) Received: by mail-ig0-f193.google.com with SMTP id kb1so5825671igb.3 for ; Wed, 20 Apr 2016 02:11:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=SgtVY6ECnNfI4CcQW41flOeJQXzdI4ZFO4SKbzSn9lo=; b=BSeJDCoTa+Aeot7qqp371r7mWndysCZms94gz0+gDAD7lxVe4SK1/1IFRREUhGlvUR jI0O/+AI+5qFAe9xxq8IIl+inQRVZ/gDm1KdgIxMMrj1aKBioiwxIjbjZLlSFVOsgMkN hBLH9Dlzss+KIRNVs1u89MTVq1rPBWrehCNvQEOzZwt1DBPgUJ0NIzC4ldxbVcFN1XsB 5OYyk37Xi5aiojWG87W+G/FJFmt/qHc+eecotEsPTTiT5RBU+pKlKIg0s7Dg54+j0gys AymwVRdGcjTtdCXyFHpG+JlnlTF/bSQclRnbnnQzq4m7LopHZYLqKV9sbBpVyXRHxurs 7IhA== X-Gm-Message-State: AOPr4FVM97xgIoB9U6lAqkT2zENBxit2klwGIW/rf+VlFPizWA4zpPpeKQV8JB1AExxdGA== X-Received: by 10.50.8.40 with SMTP id o8mr6059912iga.17.1461097797470; Tue, 19 Apr 2016 13:29:57 -0700 (PDT) Received: from WorkBox.Home.gmail.com (97-116-17-82.mpls.qwest.net. [97.116.17.82]) by smtp.gmail.com with ESMTPSA id f71sm987511iof.1.2016.04.19.13.29.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Apr 2016 13:29:56 -0700 (PDT) References: <86fuuywldn.fsf@WorkBox.Home> User-agent: mu4e 0.9.16; emacs 24.5.1 From: Brandon J. Wandersee To: Warren Block Cc: freebsd-questions@freebsd.org Subject: Re: Simple devd.conf rule has no effect In-reply-to: Date: Tue, 19 Apr 2016 15:29:57 -0500 Message-ID: <86bn552vga.fsf@WorkBox.Home> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2016 09:11:30 -0000 Warren Block writes: > 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' Thanks for the response, Warren; sorry for the lateness of mine. Your solution works when run from a shell, but devd still doesn't properly execute it. I also tried changing the quotes around, adapting it for my user shell (changing 'setenv' to 'export DISPLAY='), and putting it in a shell script and executing the script from the devd config file. No luck. Guess I'll just keep messing with it when the mood strikes, see if anything clicks. -- :: Brandon J. Wandersee :: brandon.wandersee@gmail.com :: -------------------------------------------------- :: 'The best design is as little design as possible.' :: --- Dieter Rams ----------------------------------