plugin: rust-side modules + theme services with serde-typed config

This commit is contained in:
Damocles 2026-05-04 22:58:12 +02:00
parent a86e90e927
commit f34f3f2f4e
95 changed files with 2477 additions and 1011 deletions

View file

@ -4,6 +4,7 @@ import Quickshell
import Quickshell.Wayland
import "." as M
import "../services" as S
import NovaStats as NS
PanelWindow {
id: bar
@ -19,13 +20,13 @@ PanelWindow {
margins.right: S.DockState.reservedWidthAnimated
implicitHeight: S.Theme.barHeight
implicitHeight: NS.ThemeService.barHeight
exclusiveZone: implicitHeight
Rectangle {
anchors.fill: parent
color: S.Theme.base00
opacity: S.Theme.barOpacity
color: NS.ThemeService.base00
opacity: NS.ThemeService.barOpacity
}
Canvas {
@ -35,7 +36,7 @@ PanelWindow {
const ctx = getContext("2d");
const w = width;
const h = height;
const r = S.Theme.screenRadius;
const r = NS.ThemeService.screenRadius;
const lw = 3;
const hw = lw / 2;
@ -43,8 +44,8 @@ PanelWindow {
// Glow wash behind the border
const glowGrad = ctx.createLinearGradient(0, 0, w, 0);
glowGrad.addColorStop(0, S.Theme.base0C.toString());
glowGrad.addColorStop(1, S.Theme.base09.toString());
glowGrad.addColorStop(0, NS.ThemeService.base0C.toString());
glowGrad.addColorStop(1, NS.ThemeService.base09.toString());
ctx.globalAlpha = 0.25;
ctx.fillStyle = glowGrad;
ctx.fillRect(0, 0, w, h);
@ -61,8 +62,8 @@ PanelWindow {
// Horizontal gradient for the border
const grad = ctx.createLinearGradient(0, 0, w, 0);
grad.addColorStop(0, S.Theme.base0C.toString());
grad.addColorStop(1, S.Theme.base09.toString());
grad.addColorStop(0, NS.ThemeService.base0C.toString());
grad.addColorStop(1, NS.ThemeService.base09.toString());
ctx.strokeStyle = grad;
ctx.lineWidth = lw;
@ -97,16 +98,16 @@ PanelWindow {
Item {
anchors.fill: parent
anchors.topMargin: S.Theme.groupSpacing
anchors.leftMargin: S.Theme.groupSpacing
anchors.rightMargin: S.Theme.groupSpacing
anchors.topMargin: NS.ThemeService.groupSpacing
anchors.leftMargin: NS.ThemeService.groupSpacing
anchors.rightMargin: NS.ThemeService.groupSpacing
// ---- center (declared first so left/right can anchor to it) ----
RowLayout {
id: centerSection
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
spacing: S.Theme.groupSpacing
spacing: NS.ThemeService.groupSpacing
M.BarGroup {
M.PrivacyModule {}
@ -120,7 +121,7 @@ PanelWindow {
anchors.left: parent.left
anchors.right: centerSection.left
anchors.verticalCenter: parent.verticalCenter
spacing: S.Theme.groupSpacing
spacing: NS.ThemeService.groupSpacing
M.BarGroup {
id: workspacesGroup
@ -135,10 +136,10 @@ PanelWindow {
id: _windowTitleGroup
Layout.minimumWidth: 0
clip: true
visible: S.Modules.windowTitle.enable && S.NiriIpc.focusedTitle !== ""
visible: NS.ModulesService.windowTitleEnable && 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)
readonly property real _maxWidth: Math.max(0, centerSection.x - _windowTitleGroup.x - 2 * NS.ThemeService.groupPadding - NS.ThemeService.groupSpacing)
width: Math.min(naturalWidth, _maxWidth)
}
}
@ -152,7 +153,7 @@ PanelWindow {
anchors.left: centerSection.right
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: S.Theme.groupSpacing
spacing: NS.ThemeService.groupSpacing
Item {
Layout.fillWidth: true