mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
uwsm fix
This commit is contained in:
@@ -1185,7 +1185,7 @@ Item {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
logoutDialog.close()
|
logoutDialog.close()
|
||||||
CompositorService.logout()
|
SessionService.logout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ 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")
|
||||||
@@ -81,7 +80,6 @@ Singleton {
|
|||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
detectCompositor()
|
detectCompositor()
|
||||||
uwsmCheck.running = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterCurrentWorkspace(toplevels, screen){
|
function filterCurrentWorkspace(toplevels, screen){
|
||||||
@@ -187,29 +185,4 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
|
||||||
if (uwsmActive) {
|
|
||||||
Quickshell.execDetached(["uwsm", "stop"])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNiri) {
|
|
||||||
NiriService.quit()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hyprland fallback
|
|
||||||
Hyprland.dispatch("exit")
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: uwsmCheck
|
|
||||||
// `uwsm check is-active` returns 0 if in uwsm-managed session, 1 otherwise
|
|
||||||
command: ["uwsm", "check", "is-active"]
|
|
||||||
running: false
|
|
||||||
onExited: function(exitCode) {
|
|
||||||
uwsmActive = exitCode === 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,47 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ! TODO - hacky because uwsm doesnt behave as expected
|
||||||
|
// uwsm idk, always passes the is-active check even if it's not a session
|
||||||
|
// It reutrns exit code 0 when uwsm stop fails
|
||||||
|
// They have flaws in their system, so we need to be hacky to just try it and
|
||||||
|
// detect random text
|
||||||
|
Process {
|
||||||
|
id: uwsmLogout
|
||||||
|
command: ["uwsm", "stop"]
|
||||||
|
running: false
|
||||||
|
|
||||||
|
stdout: SplitParser {
|
||||||
|
splitMarker: "\n"
|
||||||
|
onRead: (data) => {
|
||||||
|
if (data.trim().toLowerCase().includes("not running")) {
|
||||||
|
_logout()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onExited: function(exitCode) {
|
||||||
|
if (exitCode === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
_logout()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function logout() {
|
||||||
|
uwsmLogout.running = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function _logout() {
|
||||||
|
if (CompositorService.isNiri) {
|
||||||
|
NiriService.quit()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hyprland fallback
|
||||||
|
Hyprland.dispatch("exit")
|
||||||
|
}
|
||||||
|
|
||||||
function suspend() {
|
function suspend() {
|
||||||
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"])
|
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ ShellRoot {
|
|||||||
powerConfirmModalLoader.item.show(title, message, function() {
|
powerConfirmModalLoader.item.show(title, message, function() {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "logout":
|
case "logout":
|
||||||
CompositorService.logout()
|
SessionService.logout()
|
||||||
break
|
break
|
||||||
case "suspend":
|
case "suspend":
|
||||||
SessionService.suspend()
|
SessionService.suspend()
|
||||||
@@ -192,7 +192,7 @@ ShellRoot {
|
|||||||
powerConfirmModalLoader.item.show(title, message, function() {
|
powerConfirmModalLoader.item.show(title, message, function() {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "logout":
|
case "logout":
|
||||||
CompositorService.logout()
|
SessionService.logout()
|
||||||
break
|
break
|
||||||
case "suspend":
|
case "suspend":
|
||||||
SessionService.suspend()
|
SessionService.suspend()
|
||||||
@@ -288,7 +288,7 @@ ShellRoot {
|
|||||||
powerConfirmModalLoader.item.show(title, message, function() {
|
powerConfirmModalLoader.item.show(title, message, function() {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case "logout":
|
case "logout":
|
||||||
CompositorService.logout()
|
SessionService.logout()
|
||||||
break
|
break
|
||||||
case "suspend":
|
case "suspend":
|
||||||
SessionService.suspend()
|
SessionService.suspend()
|
||||||
|
|||||||
Reference in New Issue
Block a user