feat: auto-disable niri-dependent components when NIRI_SOCKET is absent

This commit is contained in:
Damocles 2026-04-15 21:08:44 +02:00
parent dd854a2f7f
commit 9cf6853742
4 changed files with 9 additions and 5 deletions

View file

@ -11,12 +11,14 @@ QtObject {
signal windowFocusChanged(var windowId) signal windowFocusChanged(var windowId)
signal windowOpenedOrChanged(var window) signal windowOpenedOrChanged(var window)
readonly property bool available: Quickshell.env("NIRI_SOCKET") !== ""
property string focusedTitle: "" property string focusedTitle: ""
property string focusedAppId: "" property string focusedAppId: ""
property bool overviewOpen: false property bool overviewOpen: false
property var _focusedProc: Process { property var _focusedProc: Process {
running: true running: root.available
command: ["niri", "msg", "--json", "focused-window"] command: ["niri", "msg", "--json", "focused-window"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {
@ -35,7 +37,7 @@ QtObject {
} }
property var _eventStream: Process { property var _eventStream: Process {
running: true running: root.available
command: ["niri", "msg", "--json", "event-stream"] command: ["niri", "msg", "--json", "event-stream"]
stdout: SplitParser { stdout: SplitParser {
splitMarker: "\n" splitMarker: "\n"

View file

@ -7,7 +7,7 @@ import "." as M
M.BarSection { M.BarSection {
id: root id: root
spacing: M.Theme.moduleSpacing spacing: M.Theme.moduleSpacing
visible: M.Modules.windowTitle.enable && M.NiriIpc.focusedTitle !== "" visible: M.Modules.windowTitle.enable && M.NiriIpc.available && M.NiriIpc.focusedTitle !== ""
tooltip: M.NiriIpc.focusedAppId ? M.NiriIpc.focusedAppId + "\n" + M.NiriIpc.focusedTitle : M.NiriIpc.focusedTitle tooltip: M.NiriIpc.focusedAppId ? M.NiriIpc.focusedAppId + "\n" + M.NiriIpc.focusedTitle : M.NiriIpc.focusedTitle

View file

@ -14,10 +14,12 @@ Row {
readonly property string _output: bar.screen?.name ?? "" readonly property string _output: bar.screen?.name ?? ""
readonly property var _workspaces: _allWorkspaces.filter(w => w.output === root._output) readonly property var _workspaces: _allWorkspaces.filter(w => w.output === root._output)
visible: M.NiriIpc.available
// Initial state // Initial state
Process { Process {
id: initProc id: initProc
running: true running: M.NiriIpc.available
command: ["niri", "msg", "--json", "workspaces"] command: ["niri", "msg", "--json", "workspaces"]
stdout: StdioCollector { stdout: StdioCollector {
onStreamFinished: { onStreamFinished: {

View file

@ -34,7 +34,7 @@ ShellRoot {
} }
LazyLoader { LazyLoader {
active: Modules.overviewBackdrop.enable active: Modules.overviewBackdrop.enable && NiriIpc.available
OverviewBackdrop { OverviewBackdrop {
screen: scope.modelData screen: scope.modelData
} }