Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2026 07:49:05 +0800
From:      Ben Hutton <ben@benhutton.com.au>
To:        freebsd-desktop@freebsd.org
Subject:   Re: Resume from Suspend when triggered by Lid
Message-ID:  <d0570a33-b6c7-4cce-9fa0-e5dc78d2f8ea@benhutton.com.au>
In-Reply-To: <d2f6af42-9d5c-41a1-a76b-7307fe52a63d@shurik.kiev.ua>
References:  <7fab23a7-723b-4857-a732-10238bf46d1f@benhutton.com.au> <609dbdd3-0d6c-463d-86a0-3c238acea213@shurik.kiev.ua> <31566b59-107d-42e6-8cc9-a4f93238534d@benhutton.com.au> <33814e2c-4ad9-4221-b40d-af2cecef0aec@shurik.kiev.ua> <2ea2c801-012b-445e-8605-4bab65a2471d@benhutton.com.au> <d2f6af42-9d5c-41a1-a76b-7307fe52a63d@shurik.kiev.ua>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
That works. Thank you again.

I ended up writing a shell script since I've found in some cases the 
session may not be Session1. In the case currently on my laptop it's 
Session2.

#!/bin/sh
session=$(/usr/local/bin/ck-unlock-session)

/usr/local/bin/qdbus6 --system org.freedesktop.ConsoleKit 
/org/freedesktop/ConsoleKit/$session org.freedesktop.ConsoleKit.Session.Lock


On 3/17/26 23:53, Oleksandr Kryvulia wrote:
> 17.03.26 08:22, Ben Hutton:
>> Fair enough, I can live with that. That's what I have been doing, I 
>> did try a few hacky ways to initiating a lock but so far nothing has 
>> worked.
>>
>> Anyway thank you for the help.
>>
>> On 3/17/26 13:32, Oleksandr Kryvulia wrote:
>>> 17.03.26 01:25, Ben Hutton:
>>>> That fixes the issue. New issue is how do you get the system to 
>>>> lock the screen automatically on resume/suspend?
>>>
>>> I didn't solve this problem because I have a habit of locking the 
>>> screen myself (by pressing Meta+L in KDE).
>>>
>>
>
> This works for me from root console:
>
> /usr/local/bin/qdbus6 --system org.freedesktop.ConsoleKit 
> /org/freedesktop/ConsoleKit/Session1 
> org.freedesktop.ConsoleKit.Session.Lock
>
> Try to place it into /etc/rc.suspend 
[-- Attachment #2 --]
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>That works. Thank you again.</p>
    <p>I ended up writing a shell script since I've found in some cases
      the session may not be Session1. In the case currently on my
      laptop it's Session2.</p>
    <p>
      <span style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;">#!/bin/sh</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#000000;background-color:#ffffff;">session=$(/usr/local/bin/ck-unlock-session)</span><span
          style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#000000;background-color:#ffffff;">
        </span><br>
        <span style="color:#000000;background-color:#ffffff;">/usr/local/bin/qdbus6
          --system org.freedesktop.ConsoleKit
          /org/freedesktop/ConsoleKit/$session
          org.freedesktop.ConsoleKit.Session.Lock</span><br>
        <span style="color:#000000;background-color:#ffffff;">
        </span><br>
      </span>
      <br>
    </p>
    <div class="moz-cite-prefix">On 3/17/26 23:53, Oleksandr Kryvulia
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:d2f6af42-9d5c-41a1-a76b-7307fe52a63d@shurik.kiev.ua">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">17.03.26 08:22, Ben Hutton:<br>
      </div>
      <blockquote type="cite"
        cite="mid:2ea2c801-012b-445e-8605-4bab65a2471d@benhutton.com.au">Fair
        enough, I can live with that. That's what I have been doing, I
        did try a few hacky ways to initiating a lock but so far nothing
        has worked. <br>
        <br>
        Anyway thank you for the help. <br>
        <br>
        On 3/17/26 13:32, Oleksandr Kryvulia wrote: <br>
        <blockquote type="cite">17.03.26 01:25, Ben Hutton: <br>
          <blockquote type="cite">That fixes the issue. New issue is how
            do you get the system to lock the screen automatically on
            resume/suspend? <br>
          </blockquote>
          <br>
          I didn't solve this problem because I have a habit of locking
          the screen myself (by pressing Meta+L in KDE). <br>
          <br>
        </blockquote>
        <br>
      </blockquote>
      <br>
      This works for me from root console:<br>
      <br>
      <span style="font-family:monospace"><span
          style="color:#000000;background-color:#ffffff;">/usr/local/bin/qdbus6
          --system org.freedesktop.ConsoleKit
          /org/freedesktop/ConsoleKit/Session1
          org.freedesktop.ConsoleKit.Session.Lock</span><br>
      </span><br>
      Try to place it into /etc/rc.suspend </blockquote>
  </body>
</html>
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d0570a33-b6c7-4cce-9fa0-e5dc78d2f8ea>