Conversation
… when available. Since systemd 257, logind always obeys "block" inhibitors, including the ones held by the user who requests the operation (before, those were ignored for the same user and for root). The "sleep:shutdown" inhibitor that cinnamon-session takes on behalf of applications inhibiting suspend (Rhythmbox while playing, browsers playing media, ...) now blocks the session itself: - closing the lid: csd-power locks the screen and calls Suspend(), which is refused, so the laptop stays on; - end-session dialog: logind answers "inhibited" to CanSuspend/CanPowerOff/CanReboot, so suspend, restart and shut down are not offered, and "Ignore and continue" for suspend does nothing. The "block-weak" mode, added in systemd 257, keeps the previous semantics. Suspend on idle still honours the inhibitors, since csd-power checks the session inhibitors itself before arming the sleep timeout. gnome-session did the same (39d51c9e6, "systemd: Downgrade suspend inhibitor to block-weak"). systemd-logind and elogind older than 257 don't know "block-weak": there the inhibitor is still taken in "block" mode, which on those versions is ignored for the same user anyway. The BlockWeakInhibited property, added together with the new mode, tells the two apart. Ref: linuxmint/cinnamon#13219 Assisted-by: Claude Code:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When an application inhibits suspend through the session manager (Rhythmbox while playing, browsers playing media, ...), cinnamon-session takes a logind
sleep:shutdowninhibitor inblockmode. Since systemd 257, logind always obeysblockinhibitors, also when the request comes from the same user who holds them (before, they were ignored for the same user and for root). So the session now blocks itself:Suspend(), logind refuses it and the laptop stays on;inhibitedtoCanSuspend/CanPowerOff/CanReboot, so cinnamon-session does not offer suspend, restart and shut down, and "Ignore and continue" for suspend does nothing.This PR takes the inhibitor in
block-weakmode, added in systemd 257 to keep the previous semantics, when logind supports it. Suspend on idle still honours the inhibitors, because csd-power checks the session inhibitors itself before arming the sleep timeout.gnome-session made the same change: 39d51c9e6 "systemd: Downgrade suspend inhibitor to block-weak", with the same rationale (a suspend inhibitor is implicitly ignored anyway when logind handles the lid, since
LidSwitchIgnoreInhibited=yesis the default), later extended to the shutdown inhibitor in df8cf27b8.Testing
Debian sid VM (systemd 262, Cinnamon 6.6.9, cinnamon-session and cinnamon-settings-daemon 6.6.4), with cinnamon-session rebuilt with this change (the code is identical to master). The lid was simulated with a uinput
SW_LIDdevice, which upower and logind handle as a real lid switch. The application was a small GTK program callinggtk_application_inhibit (..., GTK_APPLICATION_INHIBIT_SUSPEND, ...), the same path as Rhythmbox.block)block-weak)Can*from the sessioninhibitedyesGetCapabilitiesfalsetrueSuspend+IgnoreInhibitorsWithout the application, closing the lid suspends in both cases. The table was collected with
block-weakhard-coded; with the final version the same VM takes the inhibitor inblock-weakmode.Compatibility
block-weakneeds systemd-logind >= 257 or elogind >= 257; older versions (systemd 255 in Linux Mint 22, elogind 255 still shipped by Debian) don't know it. The mode is chosen from theBlockWeakInhibitedlogind property, added together with it: when the property is missing the inhibitor is taken inblockmode as before, which on those versions is already ignored for the same user. Checked on Linux Mint 22.3 (systemd 255) with this change applied to 6.6.3: the inhibitor is still taken, inblockmode, with no errors.Related: linuxmint/cinnamon#13219, #147, #186, #193, and Debian bug #1107965.