mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-13 00:42:49 -05:00
feat:implement uwsm session check
This commit is contained in:
@@ -13,6 +13,7 @@ Singleton {
|
|||||||
// Compositor detection
|
// Compositor detection
|
||||||
property bool isHyprland: false
|
property bool isHyprland: false
|
||||||
property bool isNiri: false
|
property bool isNiri: false
|
||||||
|
property bool uwsmActive: false
|
||||||
property string compositor: "unknown"
|
property string compositor: "unknown"
|
||||||
|
|
||||||
readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
|
readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
|
||||||
@@ -80,6 +81,7 @@ Singleton {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
detectCompositor()
|
detectCompositor()
|
||||||
|
uwsmCheck.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterCurrentWorkspace(toplevels, screen){
|
function filterCurrentWorkspace(toplevels, screen){
|
||||||
@@ -187,8 +189,18 @@ Singleton {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
// Trigger the check process
|
if (uwsmActive) {
|
||||||
uwsmCheck.running = true
|
Quickshell.execDetached(["uwsm", "stop"])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNiri) {
|
||||||
|
NiriService.quit()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hyprland fallback
|
||||||
|
Hyprland.dispatch("exit")
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
@@ -197,23 +209,7 @@ Singleton {
|
|||||||
command: ["uwsm", "check", "is-active"]
|
command: ["uwsm", "check", "is-active"]
|
||||||
running: false
|
running: false
|
||||||
onExited: function(exitCode) {
|
onExited: function(exitCode) {
|
||||||
if (exitCode === 0) {
|
uwsmActive = exitCode === 0
|
||||||
uwsmStop.running = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not a uwsm-managed session; fall back to compositor-specific logout
|
|
||||||
if (isNiri) {
|
|
||||||
NiriService.quit()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Hyprland.dispatch("exit")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
|
||||||
id: uwsmStop
|
|
||||||
command: ["uwsm", "stop"]
|
|
||||||
running: false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user