move NiriIpc and PowerProfileService singletons to services/

This commit is contained in:
Damocles 2026-04-17 23:11:46 +02:00
parent 63e93f5de0
commit 0160e4a1fb
10 changed files with 18 additions and 19 deletions

View file

@ -145,7 +145,7 @@ PanelWindow {
id: _windowTitleGroup
Layout.minimumWidth: 0
clip: true
visible: S.Modules.windowTitle.enable && M.NiriIpc.focusedTitle !== ""
visible: S.Modules.windowTitle.enable && S.NiriIpc.focusedTitle !== ""
M.WindowTitleModule {
id: _windowTitle
readonly property real _maxWidth: Math.max(0, centerSection.x - _windowTitleGroup.x - 2 * S.Theme.groupPadding - S.Theme.groupSpacing)

View file

@ -10,7 +10,7 @@ PanelWindow {
required property var screen
visible: M.NotifService.popups.length > 0 && !M.NiriIpc.overviewOpen
visible: M.NotifService.popups.length > 0 && !S.NiriIpc.overviewOpen
color: "transparent"
WlrLayershell.layer: WlrLayer.Overlay

View file

@ -24,6 +24,6 @@ PanelWindow {
C.HexWaveBackground {
anchors.fill: parent
running: M.NiriIpc.overviewOpen
running: S.NiriIpc.overviewOpen
}
}

View file

@ -4,16 +4,16 @@ import "../services" as S
M.BarIcon {
id: root
tooltip: "Power profile: " + (M.PowerProfileService.profile || "unknown")
tooltip: "Power profile: " + (S.PowerProfileService.profile || "unknown")
color: M.PowerProfileService.profile === "performance" ? S.Theme.base09 : M.PowerProfileService.profile === "power-saver" ? S.Theme.base0B : root.accentColor
color: S.PowerProfileService.profile === "performance" ? S.Theme.base09 : S.PowerProfileService.profile === "power-saver" ? S.Theme.base0B : root.accentColor
icon: {
if (M.PowerProfileService.profile === "performance")
if (S.PowerProfileService.profile === "performance")
return "\uF0E7";
if (M.PowerProfileService.profile === "power-saver")
if (S.PowerProfileService.profile === "power-saver")
return "\uF06C";
if (M.PowerProfileService.profile === "balanced")
if (S.PowerProfileService.profile === "balanced")
return "\uF24E";
return "\uF0E7";
}
@ -23,8 +23,8 @@ M.BarIcon {
cursorShape: Qt.PointingHandCursor
onClicked: {
const cycle = ["performance", "balanced", "power-saver"];
const idx = cycle.indexOf(M.PowerProfileService.profile);
M.PowerProfileService.set(cycle[(idx + 1) % cycle.length]);
const idx = cycle.indexOf(S.PowerProfileService.profile);
S.PowerProfileService.set(cycle[(idx + 1) % cycle.length]);
}
}
}

View file

@ -8,12 +8,12 @@ import "../services" as S
M.BarSection {
id: root
spacing: S.Theme.moduleSpacing
tooltip: M.NiriIpc.focusedAppId ? M.NiriIpc.focusedAppId + "\n" + M.NiriIpc.focusedTitle : M.NiriIpc.focusedTitle
tooltip: S.NiriIpc.focusedAppId ? S.NiriIpc.focusedAppId + "\n" + S.NiriIpc.focusedTitle : S.NiriIpc.focusedTitle
readonly property string _iconSource: {
if (!M.NiriIpc.focusedAppId)
if (!S.NiriIpc.focusedAppId)
return "";
const entry = DesktopEntries.heuristicLookup(M.NiriIpc.focusedAppId);
const entry = DesktopEntries.heuristicLookup(S.NiriIpc.focusedAppId);
return entry ? Quickshell.iconPath(entry.icon) : "";
}
@ -37,7 +37,7 @@ M.BarSection {
M.BarLabel {
id: _label
label: M.NiriIpc.focusedTitle
label: S.NiriIpc.focusedTitle
color: root.accentColor
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter

View file

@ -36,7 +36,7 @@ Row {
// Live updates via shared NiriIpc singleton
Connections {
target: M.NiriIpc
target: S.NiriIpc
function onWorkspacesChanged(workspaces) {
root._allWorkspaces = workspaces.sort((a, b) => a.idx - b.idx);
}

View file

@ -30,8 +30,6 @@ WeatherModule 1.0 WeatherModule.qml
PowerProfileModule 1.0 PowerProfileModule.qml
IdleInhibitorModule 1.0 IdleInhibitorModule.qml
NotificationsModule 1.0 NotificationsModule.qml
singleton NiriIpc 1.0 NiriIpc.qml
singleton PowerProfileService 1.0 PowerProfileService.qml
ProcessList 1.0 ProcessList.qml
singleton NotifService 1.0 NotifService.qml
NotifItem 1.0 NotifItem.qml

View file

@ -2,8 +2,7 @@ pragma Singleton
import QtQuick
import Quickshell.Io
import "." as M
import "../services" as S
import "." as S
QtObject {
id: root

View file

@ -2,3 +2,5 @@ module services
singleton Theme 1.0 Theme.qml
singleton SystemStats 1.0 SystemStats.qml
singleton Modules 1.0 Modules.qml
singleton NiriIpc 1.0 NiriIpc.qml
singleton PowerProfileService 1.0 PowerProfileService.qml