Re: Sway not locked after resume

From: Gleb Popov <arrowd_at_freebsd.org>
Date: Thu, 15 May 2025 13:03:10 UTC
On Thu, May 15, 2025 at 3:56 PM Renato Botelho <garga@freebsd.org> wrote:
>
> I've installed a fresh 15-CURRENT on a thinkpad E14 and setup a simple
> sway desktop.  After resuming from S3 suspend it comes back unlocked.
>
> I have swayidle running as follow:
>
> swayidle -w \
>           timeout 300 'swaylock -f -c 000000' \
>           timeout 600 'swaymsg "output * dpms off"' \
>           resume 'swaymsg "output * dpms on"' \
>           before-sleep 'swaylock -f -c 000000'
>
> swaylock is executed as expected by timeout parameter but it looks like
> it's not being executed by before-sleep call.
>
> There are some messages about failures to find session on swayidle debug
> output
>
> 2025-05-15 09:50:24 - [Line 903] Got timeout
> 2025-05-15 09:50:24 - [Line 750] Register idle timeout at 300000 ms
> 2025-05-15 09:50:24 - [Line 751] Setup idle
> 2025-05-15 09:50:24 - [Line 713] Command: swaylock -f -c 000000
> 2025-05-15 09:50:24 - [Line 903] Got timeout
> 2025-05-15 09:50:24 - [Line 750] Register idle timeout at 600000 ms
> 2025-05-15 09:50:24 - [Line 751] Setup idle
> 2025-05-15 09:50:24 - [Line 713] Command: swaymsg "output * dpms off"
> 2025-05-15 09:50:24 - [Line 756] Setup resume
> 2025-05-15 09:50:24 - [Line 713] Command: swaymsg "output * dpms on"
> 2025-05-15 09:50:24 - [Line 906] Got before-sleep
> 2025-05-15 09:50:24 - [Line 713] Command: swaylock -f -c 000000
> 2025-05-15 09:50:24 - [Line 778] Setup sleep lock: swaylock -f -c 000000
> 2025-05-15 09:50:24 - [Line 1078] No config file found.
> 2025-05-15 09:50:24 - [Line 440] GetSession failed: Unable to find
> session for ID
> 2025-05-15 09:50:24 - [Line 449] GetSessionByPID failed: Unable to
> lookup session information for process '9062'
> 2025-05-15 09:50:24 - [Line 451] Failed to find session
> 2025-05-15 09:50:24 - [Line 223] Got sleep lock: 12
> 2025-05-15 09:50:24 - [Line 282] Failed to parse get BlockInhibited
> property: Invalid argument
> 2025-05-15 09:50:24 - [Line 621] Enable idle timeouts
> 2025-05-15 09:50:24 - [Line 596] Register with timeout: 600000
> 2025-05-15 09:50:24 - [Line 596] Register with timeout: 300000
>
> I have seatd and dbus running, my user is member of video group,
> XDG_RUNTIME_DIR set and sway was launched by ly DM.  /etc/sysctl.conf
> has only one special entry
>
> hw.acpi.lid_switch_state=S3
>
> Is anyone experiencing such problems?  Any thoughts about what could be
> causing it?

Is it even supposed to work with seatd? "GetSessionByPID" and
"BlockInhibited" look like ConsoleKit interface, does it take part in
the action?

Also, I saw the "Unable to lookup session information for process
XXXX" error messages when polkit was failing to obtain an
authorization.