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

@ -1,6 +1,7 @@
import QtQuick
import Quickshell
import "../services" as S
import NovaStats as NS
// NOT safe for lock screen - executes system commands (shutdown, reboot, logout, suspend)
Column {
@ -42,35 +43,35 @@ Column {
label: "Lock",
icon: "\uF023",
cmd: ["loginctl", "lock-session"],
color: S.Theme.base0D,
color: NS.ThemeService.base0D,
confirm: false
},
{
label: "Suspend",
icon: "\uF186",
cmd: ["systemctl", "suspend"],
color: S.Theme.base0E,
color: NS.ThemeService.base0E,
confirm: false
},
{
label: "Logout",
icon: "\uF2F5",
cmd: root._isNiri ? ["niri", "msg", "action", "quit"] : ["loginctl", "terminate-user", ""],
color: S.Theme.base0A,
color: NS.ThemeService.base0A,
confirm: false
},
{
label: "Reboot",
icon: "\uF021",
cmd: ["systemctl", "reboot"],
color: S.Theme.base09,
color: NS.ThemeService.base09,
confirm: true
},
{
label: "Shutdown",
icon: "\uF011",
cmd: ["systemctl", "poweroff"],
color: S.Theme.base08,
color: NS.ThemeService.base08,
confirm: true
}
]
@ -88,8 +89,8 @@ Column {
anchors.fill: parent
anchors.leftMargin: 4
anchors.rightMargin: 4
color: entryHover.hovered ? S.Theme.base02 : "transparent"
radius: S.Theme.radius
color: entryHover.hovered ? NS.ThemeService.base02 : "transparent"
radius: NS.ThemeService.radius
}
Text {
@ -99,8 +100,8 @@ Column {
anchors.leftMargin: 12
text: entry.modelData.icon
color: entry.modelData.color
font.pixelSize: S.Theme.fontSize + 1
font.family: S.Theme.iconFontFamily
font.pixelSize: NS.ThemeService.fontSize + 1
font.family: NS.ThemeService.iconFontFamily
}
Text {
@ -108,9 +109,9 @@ Column {
anchors.left: entryIcon.right
anchors.leftMargin: 10
text: entry.modelData.label
color: S.Theme.base05
font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily
color: NS.ThemeService.base05
font.pixelSize: NS.ThemeService.fontSize
font.family: NS.ThemeService.fontFamily
}
HoverHandler {
@ -138,9 +139,9 @@ Column {
Text {
anchors.centerIn: parent
text: root._confirmItem ? root._confirmItem.label + "?" : ""
color: root._confirmItem ? root._confirmItem.color : S.Theme.base05
font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily
color: root._confirmItem ? root._confirmItem.color : NS.ThemeService.base05
font.pixelSize: NS.ThemeService.fontSize
font.family: NS.ThemeService.fontFamily
font.bold: true
}
}
@ -155,18 +156,18 @@ Column {
Rectangle {
anchors.fill: parent
color: cancelHover.hovered ? S.Theme.base02 : S.Theme.base01
radius: S.Theme.radius
color: cancelHover.hovered ? NS.ThemeService.base02 : NS.ThemeService.base01
radius: NS.ThemeService.radius
border.width: 1
border.color: S.Theme.base03
border.color: NS.ThemeService.base03
}
Text {
anchors.centerIn: parent
text: "Cancel"
color: S.Theme.base05
font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily
color: NS.ThemeService.base05
font.pixelSize: NS.ThemeService.fontSize
font.family: NS.ThemeService.fontFamily
}
HoverHandler {
@ -187,21 +188,21 @@ Column {
anchors.fill: parent
color: {
if (!root._confirmItem)
return S.Theme.base02;
return NS.ThemeService.base02;
const c = root._confirmItem.color;
return confirmHover.hovered ? Qt.rgba(c.r, c.g, c.b, 0.3) : Qt.rgba(c.r, c.g, c.b, 0.15);
}
radius: S.Theme.radius
radius: NS.ThemeService.radius
border.width: 1
border.color: root._confirmItem ? root._confirmItem.color : S.Theme.base03
border.color: root._confirmItem ? root._confirmItem.color : NS.ThemeService.base03
}
Text {
anchors.centerIn: parent
text: "Confirm"
color: root._confirmItem ? root._confirmItem.color : S.Theme.base05
font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily
color: root._confirmItem ? root._confirmItem.color : NS.ThemeService.base05
font.pixelSize: NS.ThemeService.fontSize
font.family: NS.ThemeService.fontFamily
font.bold: true
}