Files
homelab/dotfiles/quickshell/widgets/systray/SysTray.qml
T
darmanandClaude Opus 5 b16cc93ff6 refactor(quickshell): move every color and font into a Theme singleton
The shell was running two unrelated palettes: an amber one (#FFD063 accent,
#EEEEEE text, #0F1012 panels) hardcoded as ~200 raw hex literals across the
launchers, sidebar, systray, vitals and notifications, and an orange one
(#e8722a) that only the dense bar had, tokenized as per-file properties.

This unifies on the ORANGE values under the AMBER naming scheme, and moves the
lot into widgets/theme/Theme.qml. `surface` takes the dense bar's void
(#0a0a0a) rather than the old panel background. Zero color and font literals
remain anywhere under widgets/ outside Theme.qml.

Collisions resolved, all near-duplicates that wanted to be one token:
  - #0F1012 + #0A0A0C + #0a0a0a -> surface
  - #EEEEEE + #dedede           -> text
  - #7A7B7D + #858585           -> muted
  - #292C30 + #22262C           -> raised
  - #FFD063 + #e8722a           -> accent

Two derived things rather than literals. accentSoft (the pale flash the
top/bottom bars show while a launcher is open) was a hand-picked #FFF3C0
against amber, which is simply wrong against orange; it is now
Qt.tint(accent, white 55%), a ratio checked against the original (amber tinted
55% gives #FFE9B8 vs the hand-picked #FFF3C0). And the dense bar had been
hand-encoding Qt.rgba(0.87,0.87,0.87,a) and Qt.rgba(0.91,0.45,0.16,a), which
are just text and accent at alpha -- now textAlpha(a)/accentAlpha(a), so they
track a palette change instead of silently drifting.

Fonts came along too. Digital-7 Mono is dropped for DepartureMono: it was
never packaged, relying on a manual ~/.dots/fonts/digital_7 install that does
not exist on terra, so `fc-match "Digital-7 Mono"` resolved to DejaVu Sans and
all 38 of those sites -- the launcher lists, sidebar clock, systray labels,
every vitals readout -- were silently rendering in a PROPORTIONAL fallback.
Numeric columns should visibly improve. readoutFont is an alias of displayFont
rather than a second literal so the two roles cannot drift apart.

quickshell/CLAUDE.md updated: it said "No shared theme/tokens file yet" and
told contributors to grep for the existing hex color, which would now
reintroduce exactly what this removes.

Verified: no file references Theme. without the import, none imports it
unused, and the whole shell -- launchers, sidebar, vitals, systray,
notifications, not just the harness -- hot-reloaded clean on terra.
tests/HeadlessSmoke.qml deliberately keeps its own copies; its value is having
no dependencies.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgcWkm3t6BDQktYHQvb8Hx
2026-08-28 07:56:25 +02:00

222 lines
7.8 KiB
QML

pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Services.SystemTray
import Quickshell.Widgets
import QtQuick
import QtQuick.Layouts
import QtQuick.Shapes
import qs.widgets.theme
// The right bar: a compact utility strip for the SystemTray icons, styled
// in the same family as the Launcher (V6 "Slant") and SideBar — accent
// color, chamfered corners, the readout font, the slash-trio motif — but with
// its own plain, evenly-chamfered panel rather than their ornate
// bracket-and-cap silhouette, since this is a secondary/utility bar rather
// than a hero surface.
Scope {
id: root
Variants {
model: Quickshell.screens
PanelWindow {
id: win
required property var modelData
screen: modelData
color: "transparent"
anchors {
top: true
right: true
bottom: true
}
margins {
top: 8
}
readonly property int pad: 10
implicitWidth: 64 + 2 * pad
Item {
id: frame
anchors.fill: parent
anchors.margins: win.pad
readonly property int chamfer: 14 // uniform corner cut on all four corners
Shape {
id: panelShape
anchors.fill: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: Theme.surface
strokeColor: Theme.accent
strokeWidth: 2
startX: frame.chamfer
startY: 0
PathLine {
x: panelShape.width - frame.chamfer
y: 0
}
PathLine {
x: panelShape.width
y: frame.chamfer
}
PathLine {
x: panelShape.width
y: panelShape.height - frame.chamfer
}
PathLine {
x: panelShape.width - frame.chamfer
y: panelShape.height
}
PathLine {
x: frame.chamfer
y: panelShape.height
}
PathLine {
x: 0
y: panelShape.height - frame.chamfer
}
PathLine {
x: 0
y: frame.chamfer
}
PathLine {
x: frame.chamfer
y: 0
}
}
}
// ── Content ────────────────────────────────────────────────
ColumnLayout {
anchors.fill: parent
anchors.topMargin: 20
anchors.bottomMargin: 20
anchors.leftMargin: 10
anchors.rightMargin: 10
spacing: 14
// Slash-trio deco, echoing the launcher/sidebar header motif.
Shape {
id: slashes
Layout.alignment: Qt.AlignHCenter
implicitWidth: 26
implicitHeight: 20
preferredRendererType: Shape.CurveRenderer
ShapePath {
strokeWidth: 0
fillColor: Theme.accent
startX: 6
startY: 0
PathLine { x: 10; y: 0 }
PathLine { x: 4; y: slashes.height }
PathLine { x: 0; y: slashes.height }
PathLine { x: 6; y: 0 }
}
ShapePath {
strokeWidth: 0
fillColor: Theme.accent
startX: 15
startY: 0
PathLine { x: 19; y: 0 }
PathLine { x: 13; y: slashes.height }
PathLine { x: 9; y: slashes.height }
PathLine { x: 15; y: 0 }
}
ShapePath {
strokeWidth: 0
fillColor: Theme.accent
startX: 24
startY: 0
PathLine { x: 28; y: 0 }
PathLine { x: 22; y: slashes.height }
PathLine { x: 18; y: slashes.height }
PathLine { x: 24; y: 0 }
}
}
// Slanted divider
Item {
Layout.fillWidth: true
implicitHeight: 4
Shape {
id: divider
anchors.fill: parent
preferredRendererType: Shape.CurveRenderer
ShapePath {
strokeWidth: 0
fillColor: Theme.accent
startX: 8
startY: 0
PathLine { x: divider.width; y: 0 }
PathLine { x: divider.width - 8; y: divider.height }
PathLine { x: 0; y: divider.height }
PathLine { x: 8; y: 0 }
}
}
}
Text {
Layout.alignment: Qt.AlignHCenter
text: "TRAY"
font.family: Theme.readoutFont
font.pointSize: 12
color: Theme.muted
}
ListView {
id: trayList
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
spacing: 10
boundsBehavior: Flickable.StopAtBounds
model: SystemTray.items
delegate: Item {
required property SystemTrayItem modelData
width: ListView.view.width
implicitHeight: 36
SysTrayItem {
anchors.horizontalCenter: parent.horizontalCenter
modelData: parent.modelData
}
}
}
Text {
Layout.alignment: Qt.AlignHCenter
visible: SystemTray.items.values.length === 0
text: "--"
font.family: Theme.readoutFont
font.pointSize: 14
color: Theme.muted
}
Text {
Layout.alignment: Qt.AlignHCenter
text: SystemTray.items.values.length
font.family: Theme.readoutFont
font.pointSize: 16
color: Theme.text
}
}
}
}
}
}