Re: Resume from Suspend when triggered by Lid

From: Ben Hutton <ben_at_benhutton.com.au>
Date: Tue, 17 Mar 2026 23:49:05 UTC
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