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 "../services" as S
import "../applets" as C
import NovaStats as NS
WlSessionLockSurface {
id: root
@ -11,7 +12,7 @@ WlSessionLockSurface {
required property WlSessionLock lock
required property LockAuth auth
color: S.Theme.base00
color: NS.ThemeService.base00
// Keyboard input via TextInput - engages Qt's full input pipeline including
// text-input protocol, which is more reliable than Keys on a plain Item in
@ -47,7 +48,7 @@ WlSessionLockSurface {
// Threat level: eased curve so fails 1-2 are subtle, 3+ ramps up.
// Max ~0.6 at fail 5 (previously that was fail 3).
readonly property bool _threatEnabled: S.Modules.lock.threatEffect ?? true
readonly property bool _threatEnabled: NS.ModulesService.lockThreatEffect ?? true
readonly property real _threat: {
if (!_threatEnabled || root.auth.failCount <= 0)
return 0;
@ -68,7 +69,7 @@ WlSessionLockSurface {
layer.effect: ShaderEffect {
property real uThreat: root._threat
property real uPulse: root._heartbeat
property color uColor: S.Theme.base08
property color uColor: NS.ThemeService.base08
fragmentShader: Quickshell.shellPath("modules/lock_threat.frag.qsb")
}
@ -77,7 +78,7 @@ WlSessionLockSurface {
// compositor fallback color (niri red) from bleeding through.
Rectangle {
anchors.fill: parent
color: S.Theme.base00
color: NS.ThemeService.base00
}
// Clear desktop screenshot from ScreenshotService - visible immediately.
@ -86,7 +87,7 @@ WlSessionLockSurface {
Image {
anchors.fill: parent
source: S.ScreenshotService.get(root.screen?.name ?? "")
visible: (S.Modules.lock.screenshot ?? true) && source !== "" && !S.Theme.reducedMotion
visible: (NS.ModulesService.lockScreenshot ?? true) && source !== "" && !S.ThemeUtil.reducedMotion
opacity: _unlockFade
fillMode: Image.PreserveAspectCrop
}
@ -118,7 +119,7 @@ WlSessionLockSurface {
Image {
anchors.fill: parent
source: S.ScreenshotService.get(root.screen?.name ?? "")
visible: (S.Modules.lock.screenshot ?? true) && source !== "" && !S.Theme.reducedMotion
visible: (NS.ModulesService.lockScreenshot ?? true) && source !== "" && !S.ThemeUtil.reducedMotion
fillMode: Image.PreserveAspectCrop
layer.enabled: true
@ -186,9 +187,9 @@ WlSessionLockSurface {
anchors.top: _lockInput.bottom
anchors.topMargin: 16
text: root.auth.message
color: S.Theme.base08
font.pixelSize: S.Theme.fontSize - 1
font.family: S.Theme.fontFamily
color: NS.ThemeService.base08
font.pixelSize: NS.ThemeService.fontSize - 1
font.family: NS.ThemeService.fontFamily
opacity: root.auth.message ? 1 : 0
Behavior on opacity {
@ -206,10 +207,10 @@ WlSessionLockSurface {
anchors.horizontalCenter: parent.horizontalCenter
visible: root.auth.failCount > 0
text: root.auth.failCount + (root.auth.failCount === 1 ? " failed attempt" : " failed attempts")
color: S.Theme.base08
color: NS.ThemeService.base08
opacity: Math.max(0.4, root._threat)
font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily
font.pixelSize: NS.ThemeService.fontSize - 2
font.family: NS.ThemeService.fontFamily
}
// Right column - widgets, fly in when wave exits screen
@ -261,7 +262,7 @@ WlSessionLockSurface {
interval: 30000
running: _keyInput.text.length > 0 && root.auth.state !== "busy"
onTriggered: {
if (!S.Theme.reducedMotion)
if (!S.ThemeUtil.reducedMotion)
_shakeAnim.restart();
_keyInput.text = "";
}
@ -371,7 +372,7 @@ WlSessionLockSurface {
SequentialAnimation {
id: _heartbeatAnim
loops: Animation.Infinite
running: root._threatEnabled && root.auth.failCount >= 3 && root.lock.secure && !S.Theme.reducedMotion
running: root._threatEnabled && root.auth.failCount >= 3 && root.lock.secure && !S.ThemeUtil.reducedMotion
// Systole (sharp spike)
NumberAnimation {
@ -417,8 +418,8 @@ WlSessionLockSurface {
// so the bar's ScreenCorners aren't visible. Draw our own.
component LockCorner: Canvas {
property int corner: 0
readonly property int _r: S.Theme.screenRadius
visible: _r > 0 && S.Modules.screenCorners.enable
readonly property int _r: NS.ThemeService.screenRadius
visible: _r > 0 && NS.ModulesService.screenCornersEnable
width: _r
height: _r
z: 999