shell: take the instance signature from viewtop, not from Hyprland's env
HYPRLAND_INSTANCE_SIGNATURE is unset under viewtop, so this compared "" to "" and isNewHyprlandInstance was false on every start. It gates lock.launchOnStartup, which has therefore never fired once under viewtop, and both Idle.qml copies read it as well. viewtop publishes viewtop.instance beside its control socket — pid plus startup nanos, different every start. Read that first, fall back to the env var so a Hyprland session (the laptop is still one) keeps working, and treat "neither" as the session continuing, which re-locks rather than assuming a fresh boot.
This commit is contained in:
parent
6b67512c4f
commit
95dd21b998
1 changed files with 27 additions and 1 deletions
|
|
@ -20,11 +20,37 @@ Singleton {
|
|||
|
||||
property bool ready: false
|
||||
property string previousHyprlandInstanceSignature: ""
|
||||
|
||||
// What identifies THIS compositor run.
|
||||
//
|
||||
// `HYPRLAND_INSTANCE_SIGNATURE` is unset under viewtop, so this compared
|
||||
// "" to "" and `isNewHyprlandInstance` was false every single time. It
|
||||
// gates `lock.launchOnStartup` (LockScreen.qml), which therefore never
|
||||
// fired once, and both Idle.qml copies read it too. viewtop publishes
|
||||
// `viewtop.instance` beside its control socket for exactly this: pid plus
|
||||
// startup nanos, different on every start.
|
||||
//
|
||||
// The env var stays as the fallback so this file still behaves on a
|
||||
// Hyprland session — the laptop is still one — and an empty answer from
|
||||
// both means "assume the session continues", which re-locks rather than
|
||||
// assuming a fresh boot.
|
||||
readonly property string instanceSignature: viewtopInstance.text().trim()
|
||||
|| Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
|
||||
|| ""
|
||||
|
||||
property bool isNewHyprlandInstance: previousHyprlandInstanceSignature !== states.hyprlandInstanceSignature
|
||||
|
||||
FileView {
|
||||
id: viewtopInstance
|
||||
path: `${Quickshell.env("XDG_RUNTIME_DIR") || "/run/user/1000"}/souveraine/viewtop.instance`
|
||||
// Absence is normal, not an error: a Hyprland session has no such file
|
||||
// and falls through to the env var below.
|
||||
printErrors: false
|
||||
}
|
||||
|
||||
onReadyChanged: {
|
||||
root.previousHyprlandInstanceSignature = root.states.hyprlandInstanceSignature
|
||||
root.states.hyprlandInstanceSignature = Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE") || ""
|
||||
root.states.hyprlandInstanceSignature = root.instanceSignature
|
||||
}
|
||||
|
||||
Timer {
|
||||
|
|
|
|||
Loading…
Reference in a new issue