move Theme, SystemStats, Modules to shell/services/

This commit is contained in:
Damocles 2026-04-17 22:07:00 +02:00
parent 197f6976e0
commit 989182d603
59 changed files with 432 additions and 388 deletions

View file

@ -3,6 +3,7 @@ import QtQuick.Layouts
import Quickshell
import Quickshell.Wayland
import "." as M
import "../services" as S
PanelWindow {
id: bar
@ -18,13 +19,13 @@ PanelWindow {
right: true
}
implicitHeight: M.Theme.barHeight
implicitHeight: S.Theme.barHeight
exclusiveZone: implicitHeight
Rectangle {
anchors.fill: parent
color: M.Theme.base00
opacity: M.Theme.barOpacity
color: S.Theme.base00
opacity: S.Theme.barOpacity
}
Canvas {
@ -34,7 +35,7 @@ PanelWindow {
const ctx = getContext("2d");
const w = width;
const h = height;
const r = M.Theme.screenRadius;
const r = S.Theme.screenRadius;
const lw = 3;
const hw = lw / 2;
@ -42,8 +43,8 @@ PanelWindow {
// Glow wash behind the border
const glowGrad = ctx.createLinearGradient(0, 0, w, 0);
glowGrad.addColorStop(0, M.Theme.base0C.toString());
glowGrad.addColorStop(1, M.Theme.base09.toString());
glowGrad.addColorStop(0, S.Theme.base0C.toString());
glowGrad.addColorStop(1, S.Theme.base09.toString());
ctx.globalAlpha = 0.25;
ctx.fillStyle = glowGrad;
ctx.fillRect(0, 0, w, h);
@ -60,8 +61,8 @@ PanelWindow {
// Horizontal gradient for the border
const grad = ctx.createLinearGradient(0, 0, w, 0);
grad.addColorStop(0, M.Theme.base0C.toString());
grad.addColorStop(1, M.Theme.base09.toString());
grad.addColorStop(0, S.Theme.base0C.toString());
grad.addColorStop(1, S.Theme.base09.toString());
ctx.strokeStyle = grad;
ctx.lineWidth = lw;
@ -96,25 +97,25 @@ PanelWindow {
Item {
anchors.fill: parent
anchors.topMargin: M.Theme.groupSpacing
anchors.leftMargin: M.Theme.groupSpacing
anchors.rightMargin: M.Theme.groupSpacing
anchors.topMargin: S.Theme.groupSpacing
anchors.leftMargin: S.Theme.groupSpacing
anchors.rightMargin: S.Theme.groupSpacing
// ---- center (declared first so left/right can anchor to it) ----
RowLayout {
id: centerSection
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.groupSpacing
spacing: S.Theme.groupSpacing
M.BarGroup {
M.Privacy {}
M.Clock {
visible: M.Modules.clock.enable
visible: S.Modules.clock.enable
}
M.Notifications {
bar: bar
visible: M.Modules.notifications.enable
visible: S.Modules.notifications.enable
}
}
}
@ -124,14 +125,14 @@ PanelWindow {
anchors.left: parent.left
anchors.right: centerSection.left
anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.groupSpacing
spacing: S.Theme.groupSpacing
M.BarGroup {
id: workspacesGroup
leftEdge: true
M.Workspaces {
bar: bar
visible: M.Modules.workspaces.enable
visible: S.Modules.workspaces.enable
}
}
M.BarGroup {
@ -144,10 +145,10 @@ PanelWindow {
id: _windowTitleGroup
Layout.minimumWidth: 0
clip: true
visible: M.Modules.windowTitle.enable && M.NiriIpc.focusedTitle !== ""
visible: S.Modules.windowTitle.enable && M.NiriIpc.focusedTitle !== ""
M.WindowTitle {
id: _windowTitle
readonly property real _maxWidth: Math.max(0, centerSection.x - _windowTitleGroup.x - 2 * M.Theme.groupPadding - M.Theme.groupSpacing)
readonly property real _maxWidth: Math.max(0, centerSection.x - _windowTitleGroup.x - 2 * S.Theme.groupPadding - S.Theme.groupSpacing)
width: Math.min(naturalWidth, _maxWidth)
}
}
@ -161,7 +162,7 @@ PanelWindow {
anchors.left: centerSection.right
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: M.Theme.groupSpacing
spacing: S.Theme.groupSpacing
Item {
Layout.fillWidth: true
@ -173,7 +174,7 @@ PanelWindow {
bar: bar
}
M.Volume {
visible: M.Modules.volume.enable
visible: S.Modules.volume.enable
}
}
@ -181,7 +182,7 @@ PanelWindow {
M.BarGroup {
M.Network {
bar: bar
visible: M.Modules.network.enable
visible: S.Modules.network.enable
}
M.Bluetooth {
bar: bar
@ -192,30 +193,30 @@ PanelWindow {
M.BarGroup {
M.Backlight {}
M.PowerProfile {
visible: M.Modules.powerProfile.enable
visible: S.Modules.powerProfile.enable
}
M.IdleInhibitor {
visible: M.Modules.idleInhibitor.enable
visible: S.Modules.idleInhibitor.enable
}
}
// Stats
M.BarGroup {
M.Cpu {
visible: M.Modules.cpu.enable
visible: S.Modules.cpu.enable
}
M.Memory {
visible: M.Modules.memory.enable
visible: S.Modules.memory.enable
}
M.Gpu {}
M.Temperature {
visible: M.Modules.temperature.enable
visible: S.Modules.temperature.enable
}
M.Weather {
visible: M.Modules.weather.enable
visible: S.Modules.weather.enable
}
M.Disk {
visible: M.Modules.disk.enable
visible: S.Modules.disk.enable
}
}
@ -225,7 +226,7 @@ PanelWindow {
M.Battery {}
M.Power {
bar: bar
visible: M.Modules.power.enable
visible: S.Modules.power.enable
}
}
}