Compositor: Reworked the compositor detection to make it more robust when switching from one to another in TTY

- Sway seems to leave its SWAYSOCK valid when going back to TTY, which
would break Noctalia on Niri. Was probably fine with a display manager.
+ Autofmt
This commit is contained in:
ItsLemmy
2025-10-07 20:59:33 -04:00
parent de944ca728
commit d8a67ce298
3 changed files with 10 additions and 5 deletions
+1 -2
View File
@@ -297,8 +297,7 @@ NPanel {
}
// Spacer
Item {
}
Item {}
// Navigation and divider
RowLayout {
+8 -2
View File
@@ -32,8 +32,14 @@ Singleton {
function detectCompositor() {
const hyprlandSignature = Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE")
const niriSocket = Quickshell.env("NIRI_SOCKET")
const swaySock = Quickshell.env("SWAYSOCK")
if (hyprlandSignature && hyprlandSignature.length > 0) {
if (niriSocket && niriSocket.length > 0) {
isHyprland = false
isNiri = true
isSway = false
backendLoader.sourceComponent = niriComponent
} else if (hyprlandSignature && hyprlandSignature.length > 0) {
isHyprland = true
isNiri = false
isSway = false
@@ -44,7 +50,7 @@ Singleton {
isSway = true
backendLoader.sourceComponent = swayComponent
} else {
// Default to Niri
// Always fallback to Niri
isHyprland = false
isNiri = true
isSway = false
+1 -1
View File
@@ -155,7 +155,7 @@ Item {
if (!toplevel)
return ""
return toplevel.appId;
return toplevel.appId
}
// Safe property getter