Theme presets, and make the bar itself actually re-theme (colors + opacity)

Presets (theme/presets.py): named snapshots of the whole palette, saved/loaded/
deleted from a new bookmark button on the theme widget. Stored outside the
repo in ~/.local/share/quickshell/theme-presets/ (JSON, per-machine data, same
precedent as the wallpaper history). A built-in Default entry can't be
overwritten or deleted.

Wiring that up exposed a real gap: the bar's own colors were hand-matched
hardcoded QML literals, not actually driven by theme/colors.toml, and opacity
wasn't themeable anywhere yet. Fixed both:
- colors.toml gains bar_color/pill_color/popup_color (paired with the existing
  *_opacity floats) plus generic opacity support in render.py (--set now
  accepts a 0-1 float, not just #rrggbb)
- Bar.qml now fetches the palette via render.py --dump and rebinds every
  matching hardcoded hex literal (accent, foreground, color1/2/3/5/6/8/12,
  the bar/pill/popup backgrounds, the logo tint and the bar's bottom border)
  to it; kitty's background_opacity is template-driven instead of a second
  hardcoded line fighting the themed one
- both the bar and the widget listen on their own Quickshell IPC target
  (render.py/presets.py ping both after every change) so edits reload with no
  restart, matching the "instant" promise the color editor already had
- the theme widget's color popup gained a slider + matching color swatch per
  surface (Bar/Pills/Popups/Terminal) below the existing role list, and its
  role labels now say what each color actually paints instead of "Color N"
  (verified against the templates and Bar.qml's literals, not guessed) with
  unused roles honestly marked as such
- the CPU pill's icon color is deliberately hardcoded again after this -
  it coincidentally shared color12's hex value with the help icon/detail
  text, so theming color12 was recoloring it too

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dujsk9jYfxUVLtb5B8eC94
This commit is contained in:
nico
2026-09-28 22:45:09 +02:00
parent e66691b469
commit 63a56f4a01
10 changed files with 813 additions and 124 deletions

View File

@@ -19,6 +19,30 @@ Variants {
property bool windowSwitcherOpen: false
property bool helpOpen: false
// Bar/pill/popup opacity from theme/colors.toml - defaults match what was hardcoded
// here before theming picked these up, so nothing changes until a fetch lands.
property real barOpacity: 0.18
property real pillOpacity: 0.85
property real popupOpacity: 0.90
// Bar colors from theme/colors.toml - defaults match what was hardcoded as literal hex
// strings throughout this file before theming picked them up (see README's Theming
// section for exactly which role paints what). Keyed exactly like colors.toml so the
// fetch below can copy straight across.
property var palette: ({
accent: "#1793d1", foreground: "#c0caf5",
color1: "#f7768e", color2: "#a6e3a1", color3: "#f9e2af",
color5: "#cba6f7", color6: "#89dceb", color8: "#565f89", color12: "#7aa2f7",
bar_color: "#12131b", pill_color: "#1a1b26", popup_color: "#1a1b26",
})
// "#rrggbb" + 0-1 alpha -> "#aarrggbb", so bar/pill/popup backgrounds can have both an
// editable color *and* an editable opacity instead of a fixed base tint.
function argb(hex, alpha) {
var a = Math.round(Math.max(0, Math.min(1, alpha)) * 255).toString(16).padStart(2, "0")
return "#" + a + hex.slice(1)
}
// Kept in sync with the Hotkeys section of README.md by hand: Hyprland's Lua config binds
// everything through one opaque "__lua" dispatcher, so hyprctl binds -j can't recover a
// human-readable action for any of them - there's nothing meaningful left to auto-fetch.
@@ -181,6 +205,38 @@ Variants {
}
}
Loader {
active: modelData === Quickshell.screens[0]
sourceComponent: Item {
Process {
id: themeDump
command: ["python3", "/home/nico/.config/theme/render.py", "--dump"]
stdout: StdioCollector { id: themeDumpCollector }
onExited: {
try {
var c = JSON.parse(themeDumpCollector.text)
if ("bar_opacity" in c) root.barOpacity = c.bar_opacity
if ("pill_opacity" in c) root.pillOpacity = c.pill_opacity
if ("popup_opacity" in c) root.popupOpacity = c.popup_opacity
var p = {}
for (var key in root.palette) p[key] = (key in c) ? c[key] : root.palette[key]
root.palette = p
} catch (e) {}
}
}
IpcHandler {
target: "theme"
function changed(): void {
themeDump.running = true
}
}
Timer { interval: 300; running: true; repeat: false; onTriggered: themeDump.running = true }
}
}
property string hovered: ""
property bool menuOpen: false
property bool calendarOpen: false
@@ -298,14 +354,14 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: (bellArea.containsMouse || bar.notifOpen) ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: (bellArea.containsMouse || bar.notifOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Text {
anchors.centerIn: parent
text: bar.notifList.length > 0 ? "\uf0f3" : "\uf0a2"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: (bellArea.containsMouse || bar.notifOpen) ? "#0f111a" : (bar.notifList.length > 0 ? "#1793d1" : "#565f89")
color: (bellArea.containsMouse || bar.notifOpen) ? "#0f111a" : (bar.notifList.length > 0 ? root.palette.accent : root.palette.color8)
}
Rectangle {
@@ -314,7 +370,7 @@ Variants {
width: Math.max(14, badgeText.implicitWidth + 6)
height: 14
radius: 7
color: "#f7768e"
color: root.palette.color1
Text {
id: badgeText
anchors.centerIn: parent
@@ -461,13 +517,13 @@ Variants {
Rectangle {
anchors.fill: parent
color: Qt.rgba(0.071, 0.075, 0.106, 0.18)
color: root.argb(root.palette.bar_color, root.barOpacity)
}
Rectangle {
anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
height: 1
color: Qt.rgba(0.090, 0.576, 0.820, 0.45)
color: root.argb(root.palette.accent, 0.45)
}
// ================= LEFT =================
@@ -480,7 +536,7 @@ Variants {
Layout.preferredWidth: logoText.implicitWidth + 28
Layout.preferredHeight: 26
radius: 10
color: Qt.rgba(0.090, 0.576, 0.820, 0.12)
color: root.argb(root.palette.accent, 0.12)
Text {
id: logoText
@@ -488,7 +544,7 @@ Variants {
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 18
color: "#1793d1"
color: root.palette.accent
}
MouseArea {
@@ -502,7 +558,7 @@ Variants {
Layout.preferredWidth: visible ? wsRow.implicitWidth + 8 : 0
Layout.preferredHeight: 26
radius: 10
color: Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: root.argb(root.palette.pill_color, root.pillOpacity)
RowLayout {
id: wsRow
@@ -526,7 +582,7 @@ Variants {
Layout.preferredWidth: 22
Layout.preferredHeight: 20
radius: 8
color: active ? "#1793d1" : (wsArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.22) : "transparent")
color: active ? root.palette.accent : (wsArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.22) : "transparent")
Text {
anchors.centerIn: parent
@@ -540,7 +596,7 @@ Variants {
}
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: wsBtn.active ? "#0f111a" : "#565f89"
color: wsBtn.active ? "#0f111a" : root.palette.color8
}
MouseArea {
@@ -594,21 +650,21 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
font.bold: centerContainer.showingMedia
color: "#c0caf5"
color: root.palette.foreground
}
Text {
visible: centerContainer.artistText !== ""
text: "—"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: "#1793d1"
color: root.palette.accent
}
Text {
visible: centerContainer.artistText !== ""
text: centerContainer.artistText
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: "#7aa2f7"
color: root.palette.color12
}
}
@@ -689,7 +745,7 @@ Variants {
text: root.isGerman ? "Keine Fenster geöffnet" : "No open windows"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#565f89"
color: root.palette.color8
}
Repeater {
@@ -728,7 +784,7 @@ Variants {
Layout.preferredWidth: 32
Layout.preferredHeight: 26
radius: 8
color: taskBtn.isActive ? "#1793d1" : (taskArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.22) : Qt.rgba(0.102, 0.106, 0.149, 0.85))
color: taskBtn.isActive ? root.palette.accent : (taskArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.22) : root.argb(root.palette.pill_color, root.pillOpacity))
Image {
visible: taskBtn.iconSource !== ""
@@ -746,7 +802,7 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
font.bold: true
color: taskBtn.isActive ? "#0f111a" : "#c0caf5"
color: taskBtn.isActive ? "#0f111a" : root.palette.foreground
}
// Multi-window indicator
@@ -759,7 +815,7 @@ Variants {
width: 14
height: 14
radius: 7
color: "#7aa2f7"
color: root.palette.color12
border.width: 1
border.color: Qt.rgba(0.102, 0.106, 0.149, 1)
@@ -810,7 +866,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 8
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -839,7 +895,7 @@ Variants {
Layout.fillWidth: true
implicitHeight: 24
radius: 6
color: groupRowArea.containsMouse ? "#1793d1" : "transparent"
color: groupRowArea.containsMouse ? root.palette.accent : "transparent"
Text {
anchors.fill: parent
@@ -850,7 +906,7 @@ Variants {
text: taskGroupRow.modelData.title
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: groupRowArea.containsMouse ? "#0f111a" : "#c0caf5"
color: groupRowArea.containsMouse ? "#0f111a" : root.palette.foreground
}
MouseArea {
@@ -886,7 +942,7 @@ Variants {
Layout.preferredWidth: visible ? trayRow.implicitWidth + 16 : 0
Layout.preferredHeight: 26
radius: 10
color: Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: root.argb(root.palette.pill_color, root.pillOpacity)
RowLayout {
id: trayRow
@@ -932,7 +988,7 @@ Variants {
Layout.preferredWidth: cpuRow.implicitWidth + 14
Layout.preferredHeight: 26
radius: 10
color: bar.hovered === "cpu" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: bar.hovered === "cpu" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Row {
id: cpuRow
@@ -942,6 +998,8 @@ Variants {
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
// Deliberately hardcoded, not theme-bound: sharing color12 with the
// help icon/detail text meant recoloring one recolored the other.
color: bar.hovered === "cpu" ? "#0f111a" : (bar.showCpuTemp ? (bar.tempCritical ? "#f7768e" : "#f9e2af") : "#7aa2f7")
}
Text {
@@ -950,7 +1008,7 @@ Variants {
font.pixelSize: 13
width: valueFont.advanceWidth("100%")
horizontalAlignment: Text.AlignRight
color: bar.hovered === "cpu" ? "#0f111a" : "#c0caf5"
color: bar.hovered === "cpu" ? "#0f111a" : root.palette.foreground
}
}
@@ -969,7 +1027,7 @@ Variants {
Layout.preferredWidth: memRow.implicitWidth + 20
Layout.preferredHeight: 26
radius: 10
color: bar.hovered === "mem" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: bar.hovered === "mem" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Row {
id: memRow
@@ -979,7 +1037,7 @@ Variants {
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: bar.hovered === "mem" ? "#0f111a" : "#89dceb"
color: bar.hovered === "mem" ? "#0f111a" : root.palette.color6
}
Text {
text: bar.memPct + "%"
@@ -987,7 +1045,7 @@ Variants {
font.pixelSize: 13
width: valueFont.advanceWidth("100%")
horizontalAlignment: Text.AlignRight
color: bar.hovered === "mem" ? "#0f111a" : "#c0caf5"
color: bar.hovered === "mem" ? "#0f111a" : root.palette.foreground
}
}
@@ -1005,7 +1063,7 @@ Variants {
Layout.preferredWidth: diskRow.implicitWidth + 20
Layout.preferredHeight: 26
radius: 10
color: bar.hovered === "disk" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: bar.hovered === "disk" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Row {
id: diskRow
@@ -1015,7 +1073,7 @@ Variants {
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: bar.hovered === "disk" ? "#0f111a" : "#c0caf5"
color: bar.hovered === "disk" ? "#0f111a" : root.palette.foreground
}
Text {
text: bar.currentDisk.pct + "%"
@@ -1023,7 +1081,7 @@ Variants {
font.pixelSize: 13
width: valueFont.advanceWidth("100%")
horizontalAlignment: Text.AlignRight
color: bar.hovered === "disk" ? "#0f111a" : "#c0caf5"
color: bar.hovered === "disk" ? "#0f111a" : root.palette.foreground
}
}
@@ -1042,7 +1100,7 @@ Variants {
Layout.preferredWidth: visible ? gpuRow.implicitWidth + 14 : 0
Layout.preferredHeight: 26
radius: 10
color: bar.hovered === "gpu" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: bar.hovered === "gpu" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Row {
id: gpuRow
@@ -1052,7 +1110,7 @@ Variants {
text: "󰢮"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: bar.hovered === "gpu" ? "#0f111a" : (bar.showGpuTemp ? "#f9e2af" : "#a6e3a1")
color: bar.hovered === "gpu" ? "#0f111a" : (bar.showGpuTemp ? root.palette.color3 : root.palette.color2)
}
Text {
text: bar.showGpuTemp ? (bar.gpuTemp + "°C") : (bar.gpuUtil + "%")
@@ -1060,7 +1118,7 @@ Variants {
font.pixelSize: 13
width: valueFont.advanceWidth("100%")
horizontalAlignment: Text.AlignRight
color: bar.hovered === "gpu" ? "#0f111a" : "#c0caf5"
color: bar.hovered === "gpu" ? "#0f111a" : root.palette.foreground
}
}
@@ -1079,7 +1137,7 @@ Variants {
Layout.preferredWidth: volRow.implicitWidth + 20
Layout.preferredHeight: 26
radius: 10
color: bar.hovered === "vol" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: bar.hovered === "vol" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Row {
id: volRow
@@ -1089,13 +1147,13 @@ Variants {
text: bar.volumeMuted ? "" : ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: bar.hovered === "vol" ? "#0f111a" : (bar.volumeMuted ? "#565f89" : "#cba6f7")
color: bar.hovered === "vol" ? "#0f111a" : (bar.volumeMuted ? root.palette.color8 : root.palette.color5)
}
Text {
text: (bar.volumeMuted ? (root.isGerman ? "muted" : "muted") : bar.volumePct + "%")
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: bar.hovered === "vol" ? "#0f111a" : "#c0caf5"
color: bar.hovered === "vol" ? "#0f111a" : root.palette.foreground
}
}
@@ -1125,11 +1183,11 @@ Variants {
Layout.preferredWidth: netRow.implicitWidth + 20
Layout.preferredHeight: 26
radius: 10
color: bar.hovered === "net" ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: bar.hovered === "net" ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
readonly property string icon: bar.connType === "wifi" ? "" : bar.connType === "ethernet" ? "󰈀" : "󰤭"
readonly property string statusText: bar.connType === "wifi" ? (bar.connName || "WLAN") : bar.connType === "ethernet" ? "LAN" : "offline"
readonly property color statusColor: bar.connType === "" ? "#565f89" : "#a6e3a1"
readonly property color statusColor: bar.connType === "" ? root.palette.color8 : root.palette.color2
Row {
id: netRow
@@ -1147,7 +1205,7 @@ Variants {
font.pixelSize: 13
elide: Text.ElideRight
width: Math.min(implicitWidth, 90)
color: bar.hovered === "net" ? "#0f111a" : "#c0caf5"
color: bar.hovered === "net" ? "#0f111a" : root.palette.foreground
}
}
@@ -1179,14 +1237,14 @@ Variants {
Layout.preferredWidth: visible ? 32 : 0
Layout.preferredHeight: 26
radius: 10
color: (helpArea.containsMouse || root.helpOpen) ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: (helpArea.containsMouse || root.helpOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Text {
anchors.centerIn: parent
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: (helpArea.containsMouse || root.helpOpen) ? "#0f111a" : "#7aa2f7"
color: (helpArea.containsMouse || root.helpOpen) ? "#0f111a" : root.palette.color12
}
MouseArea {
@@ -1204,14 +1262,14 @@ Variants {
Layout.preferredWidth: 100
Layout.preferredHeight: 26
radius: 10
color: (clockArea.containsMouse || bar.calendarOpen) ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: (clockArea.containsMouse || bar.calendarOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Text {
anchors.centerIn: parent
text: Qt.formatDateTime(bar.now, "dd.MM. hh:mm")
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: (clockArea.containsMouse || bar.calendarOpen) ? "#0f111a" : "#c0caf5"
color: (clockArea.containsMouse || bar.calendarOpen) ? "#0f111a" : root.palette.foreground
}
MouseArea {
@@ -1229,14 +1287,14 @@ Variants {
Layout.preferredWidth: 32
Layout.preferredHeight: 26
radius: 10
color: (powerArea.containsMouse || bar.menuOpen) ? "#1793d1" : Qt.rgba(0.102, 0.106, 0.149, 0.85)
color: (powerArea.containsMouse || bar.menuOpen) ? root.palette.accent : root.argb(root.palette.pill_color, root.pillOpacity)
Text {
anchors.centerIn: parent
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 15
color: (powerArea.containsMouse || bar.menuOpen) ? "#0f111a" : "#1793d1"
color: (powerArea.containsMouse || bar.menuOpen) ? "#0f111a" : root.palette.accent
}
MouseArea {
@@ -1268,7 +1326,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -1289,21 +1347,21 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
font.bold: true
color: "#1793d1"
color: root.palette.accent
}
Text {
visible: bar.hovered === "cpu"
text: (root.isGerman ? "Last (1/5/15 Min): " : "Load (1/5/15 min): ") + bar.load1 + " / " + bar.load5 + " / " + bar.load15
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
color: root.palette.foreground
}
Text {
visible: bar.hovered === "cpu" && bar.tempAvailable
text: (root.isGerman ? "Temperatur (Tctl): " : "Temperature (Tctl): ") + bar.tempC + "°C"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#7aa2f7"
color: root.palette.color12
}
GridLayout {
visible: bar.hovered === "cpu" && bar.perCore.length > 0
@@ -1319,7 +1377,7 @@ Variants {
text: "C" + index + ": " + modelData + "%"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
}
}
@@ -1328,14 +1386,14 @@ Variants {
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
Text {
visible: bar.hovered === "mem"
text: (root.isGerman ? "Belegt: " : "Used: ") + bar.memUsed.toFixed(1) + " / " + bar.memTotal.toFixed(1) + " GiB"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
color: root.palette.foreground
}
ColumnLayout {
visible: bar.hovered === "disk"
@@ -1358,19 +1416,19 @@ Variants {
font.bold: index === bar.diskIndex
elide: Text.ElideMiddle
Layout.fillWidth: true
color: index === bar.diskIndex ? "#c0caf5" : "#9aa5ce"
color: index === bar.diskIndex ? root.palette.foreground : "#9aa5ce"
}
Text {
text: modelData.pct + "%" + " · " + (root.isGerman ? "Belegt " : "Used ") + modelData.used.toFixed(0) + " / " + modelData.total.toFixed(0) + " GiB" + " · " + (root.isGerman ? "Frei " : "Free ") + modelData.avail.toFixed(0) + " GiB"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
Text {
text: "R: " + root.fmtRate(modelData.readKBps) + " W: " + root.fmtRate(modelData.writeKBps)
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
}
}
@@ -1380,28 +1438,28 @@ Variants {
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
Text {
visible: bar.hovered === "gpu"
text: (root.isGerman ? "Temperatur: " : "Temperature: ") + bar.gpuTemp + "°C"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#7aa2f7"
color: root.palette.color12
}
Text {
visible: bar.hovered === "gpu"
text: "VRAM: " + bar.gpuMemUsed + " / " + bar.gpuMemTotal + " MiB"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#565f89"
color: root.palette.color8
}
Text {
visible: bar.hovered === "gpu"
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
Text {
visible: bar.hovered === "vol"
@@ -1410,7 +1468,7 @@ Variants {
text: root.isGerman ? "Klick: Mixer · Rechtsklick: Stumm · Scroll: Lautstärke" : "Click: Mixer · Right-click: Mute · Scroll: Volume"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
}
}
@@ -1433,7 +1491,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -1448,13 +1506,13 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
font.bold: true
color: "#1793d1"
color: root.palette.accent
}
Text {
text: bar.connType === "" ? (root.isGerman ? "Nicht verbunden" : "Not connected") : (bar.connType === "wifi" ? (root.isGerman ? "WLAN" : "Wi-Fi") : (root.isGerman ? "Kabelgebunden" : "Wired"))
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
color: root.palette.foreground
}
Text {
visible: bar.connType === "wifi"
@@ -1463,33 +1521,33 @@ Variants {
wrapMode: Text.WrapAnywhere
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#a6e3a1"
color: root.palette.color2
}
Text {
text: (bar.showPublicIp ? (root.isGerman ? "Öffentliche IP: " : "Public IP: ") + (bar.publicIpLoading ? "…" : (bar.publicIp || "n/a")) : (root.isGerman ? "Lokale IP: " : "Local IP: ") + (bar.localIp || "n/a"))
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#7aa2f7"
color: root.palette.color12
}
Text {
visible: bar.netDevice !== ""
text: (root.isGerman ? "Gerät: " : "Device: ") + bar.netDevice
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#565f89"
color: root.palette.color8
}
Text {
visible: bar.connType !== ""
text: " " + root.fmtBitrate(bar.netRxKBps) + "  " + root.fmtBitrate(bar.netTxKBps)
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
color: root.palette.foreground
}
Text {
text: root.isGerman ? "Klicken zum Wechseln" : "Click to toggle"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
}
}
@@ -1512,7 +1570,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -1527,19 +1585,19 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
font.bold: true
color: "#c0caf5"
color: root.palette.foreground
}
Text {
text: (root.isGerman ? "KW " : "Week ") + root.isoWeek(bar.now)
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#7aa2f7"
color: root.palette.color12
}
Text {
text: Qt.formatDateTime(bar.now, "hh:mm:ss")
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#565f89"
color: root.palette.color8
}
}
}
@@ -1562,7 +1620,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -1572,7 +1630,7 @@ Variants {
text: root.isGerman ? "Zeigt alle Tastenkombinationen" : "Shows all keybinds"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
color: root.palette.foreground
}
}
}
@@ -1601,7 +1659,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 12
color: "#f01a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -1616,7 +1674,7 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 18
font.bold: true
color: "#c0caf5"
color: root.palette.foreground
}
Flickable {
@@ -1645,7 +1703,7 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 15
font.bold: true
color: "#1793d1"
color: root.palette.accent
}
Repeater {
@@ -1660,7 +1718,7 @@ Variants {
text: modelData.keys
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: "#7aa2f7"
color: root.palette.color12
Layout.preferredWidth: 225
wrapMode: Text.WrapAnywhere
}
@@ -1669,7 +1727,7 @@ Variants {
text: root.isGerman ? modelData.de : modelData.en
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: "#c0caf5"
color: root.palette.foreground
wrapMode: Text.WordWrap
}
}
@@ -1705,7 +1763,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 12
color: "#f01a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -1723,7 +1781,7 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
font.bold: true
color: "#c0caf5"
color: root.palette.foreground
}
Rectangle {
@@ -1731,7 +1789,7 @@ Variants {
Layout.preferredWidth: readAllText.implicitWidth + 16
Layout.preferredHeight: 24
radius: 8
color: readAllArea.containsMouse ? "#1793d1" : Qt.rgba(0.478, 0.635, 0.969, 0.15)
color: readAllArea.containsMouse ? root.palette.accent : Qt.rgba(0.478, 0.635, 0.969, 0.15)
Text {
id: readAllText
@@ -1739,7 +1797,7 @@ Variants {
text: "\uf00c " + (root.isGerman ? "Alle gelesen" : "Mark all read")
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: readAllArea.containsMouse ? "#0f111a" : "#c0caf5"
color: readAllArea.containsMouse ? "#0f111a" : root.palette.foreground
}
MouseArea {
@@ -1759,7 +1817,7 @@ Variants {
text: root.isGerman ? "Alles gelesen" : "All caught up"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#565f89"
color: root.palette.color8
}
ListView {
@@ -1777,7 +1835,7 @@ Variants {
radius: 10
color: cardArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.18) : Qt.rgba(0.478, 0.635, 0.969, 0.08)
border.width: modelData.urgency === "critical" ? 1 : 0
border.color: "#f7768e"
border.color: root.palette.color1
ColumnLayout {
id: cardCol
@@ -1792,13 +1850,13 @@ Variants {
elide: Text.ElideRight
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 10
color: "#1793d1"
color: root.palette.accent
}
Text {
text: "\uf00c"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: cardArea.containsMouse ? "#a6e3a1" : "#565f89"
color: cardArea.containsMouse ? root.palette.color2 : root.palette.color8
}
}
Text {
@@ -1810,7 +1868,7 @@ Variants {
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
font.bold: true
color: "#c0caf5"
color: root.palette.foreground
}
Text {
visible: modelData.body !== ""
@@ -1861,7 +1919,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -1877,7 +1935,7 @@ Variants {
Text {
text: "‹"
font.pixelSize: 16
color: "#7aa2f7"
color: root.palette.color12
MouseArea {
anchors.fill: parent
anchors.margins: -6
@@ -1898,13 +1956,13 @@ Variants {
text: Qt.formatDateTime(new Date(bar.viewYear, bar.viewMonth, 1), "MMMM yyyy")
font.bold: true
font.pixelSize: 13
color: "#c0caf5"
color: root.palette.foreground
}
Text {
text: "›"
font.pixelSize: 16
color: "#7aa2f7"
color: root.palette.color12
MouseArea {
anchors.fill: parent
anchors.margins: -6
@@ -1933,7 +1991,7 @@ Variants {
horizontalAlignment: Text.AlignHCenter
text: Qt.locale().dayName(index + 1, Locale.ShortFormat)
font.pixelSize: 11
color: "#565f89"
color: root.palette.color8
}
}
}
@@ -1951,7 +2009,7 @@ Variants {
horizontalAlignment: Text.AlignHCenter
text: modelData.weekNum
font.pixelSize: 10
color: "#565f89"
color: root.palette.color8
}
Repeater {
@@ -1962,12 +2020,12 @@ Variants {
Layout.preferredWidth: 24
Layout.preferredHeight: 22
radius: 6
color: modelData.isToday ? "#1793d1" : "transparent"
color: modelData.isToday ? root.palette.accent : "transparent"
Text {
anchors.centerIn: parent
text: modelData.day ?? ""
font.pixelSize: 11
color: modelData.isToday ? "#0f111a" : (modelData.day ? "#c0caf5" : "transparent")
color: modelData.isToday ? "#0f111a" : (modelData.day ? root.palette.foreground : "transparent")
}
}
}
@@ -2001,7 +2059,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -2072,7 +2130,7 @@ Variants {
Rectangle {
anchors.fill: parent
radius: 10
color: "#e61a1b26"
color: root.argb(root.palette.popup_color, root.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -2087,7 +2145,7 @@ Variants {
text: root.isGerman ? "Keine Fenster ge\u00f6ffnet" : "No open windows"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#565f89"
color: root.palette.color8
}
Repeater {
@@ -2099,7 +2157,7 @@ Variants {
Layout.fillWidth: true
implicitHeight: 30
radius: 8
color: winRowArea.containsMouse ? "#1793d1" : "transparent"
color: winRowArea.containsMouse ? root.palette.accent : "transparent"
RowLayout {
anchors.fill: parent
@@ -2112,7 +2170,7 @@ Variants {
text: winRow.modelData.workspace ? winRow.modelData.workspace.name : ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: winRowArea.containsMouse ? "#0f111a" : "#565f89"
color: winRowArea.containsMouse ? "#0f111a" : root.palette.color8
}
Text {
@@ -2121,7 +2179,7 @@ Variants {
text: winRow.modelData.title
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 13
color: winRowArea.containsMouse ? "#0f111a" : "#c0caf5"
color: winRowArea.containsMouse ? "#0f111a" : root.palette.foreground
}
}

View File

@@ -29,10 +29,23 @@ PanelWindow {
property bool wallpaperOpen: false
property bool colorsOpen: false
property bool presetsOpen: false
property var wallpapers: []
// ---- presets: named snapshots of the whole palette (theme/presets.py) ----
property var presetsDefault: ({ name: "Default", current: true })
property var presetsList: []
property string presetNameInput: ""
// ---- color roles: key -> current hex, kept in sync with theme/colors.toml ----
property var colorValues: ({})
readonly property real popupOpacity: colorValues.popup_opacity !== undefined ? colorValues.popup_opacity : 0.90
readonly property string popupColor: colorValues.popup_color !== undefined ? colorValues.popup_color : "#1a1b26"
function argb(hex, alpha) {
var a = Math.round(Math.max(0, Math.min(1, alpha)) * 255).toString(16).padStart(2, "0")
return "#" + a + hex.slice(1)
}
property string editingKey: ""
property string hexInput: ""
@@ -41,16 +54,48 @@ PanelWindow {
"color0", "color1", "color2", "color3", "color4", "color5", "color6", "color7",
"color8", "color9", "color10", "color11", "color12", "color13", "color14", "color15"]
// What each role actually paints, verified against theme/templates/ (border/urgency/accent
// colors) and the literal hex values hardcoded in Bar.qml (the bar isn't template-driven,
// its colors were hand-matched to the palette - see the Theming section of README.md).
// Several ANSI slots aren't wired up to anything yet (background, selection, color0/15) or
// currently equal their "bright" sibling 1:1 - labelled as such rather than guessed at.
readonly property var roleLabels: ({
accent: "Accent", cursor: "Cursor", foreground: "Foreground", background: "Background",
selection_foreground: isGerman ? "Auswahl (Text)" : "Selection (fg)",
selection_background: isGerman ? "Auswahl (Hintergrund)" : "Selection (bg)",
color0: "Color 0", color1: "Color 1", color2: "Color 2", color3: "Color 3",
color4: "Color 4", color5: "Color 5", color6: "Color 6", color7: "Color 7",
color8: "Color 8", color9: "Color 9", color10: "Color 10", color11: "Color 11",
color12: "Color 12", color13: "Color 13", color14: "Color 14", color15: "Color 15",
accent: isGerman ? "Akzent (Hervorhebung)" : "Accent (highlights)",
cursor: isGerman ? "Cursor (Terminal)" : "Cursor (terminal)",
foreground: isGerman ? "Vordergrund (Text)" : "Foreground (text)",
background: isGerman ? "Hintergrund (Terminal, mako)" : "Background (terminal, mako)",
selection_foreground: isGerman ? "Auswahltext (ungenutzt)" : "Selection text (unused)",
selection_background: isGerman ? "Auswahlhintergrund (ungenutzt)" : "Selection bg (unused)",
color0: isGerman ? "Schwarz (ungenutzt)" : "Black (unused)",
color1: isGerman ? "Rot (kritisch, Badges)" : "Red (critical, badges)",
color2: isGerman ? "Grün (GPU-Icon, verbunden)" : "Green (GPU icon, connected)",
color3: isGerman ? "Gelb (Temp-Warnung)" : "Yellow (temp warning)",
color4: isGerman ? "Blau (Rahmenfarben)" : "Blue (border colors)",
color5: isGerman ? "Magenta (Lautstärke-Icon)" : "Magenta (volume icon)",
color6: isGerman ? "Cyan (RAM-Icon)" : "Cyan (RAM icon)",
color7: isGerman ? "Weiß (= Vordergrund)" : "White (= Foreground)",
color8: isGerman ? "Gedämpft (inaktiv, Hinweise)" : "Muted (inactive, hints)",
color9: isGerman ? "Hellrot (= Rot)" : "Bright red (= Red)",
color10: isGerman ? "Hellgrün (= Grün)" : "Bright green (= Green)",
color11: isGerman ? "Hellgelb (= Gelb)" : "Bright yellow (= Yellow)",
color12: isGerman ? "Hellblau (Detailtext, Hilfe)" : "Bright blue (detail text, help)",
color13: isGerman ? "Hellmagenta (= Magenta)" : "Bright magenta (= Magenta)",
color14: isGerman ? "Hellcyan (= Cyan)" : "Bright cyan (= Cyan)",
color15: isGerman ? "Hellweiß (ungenutzt)" : "Bright white (unused)",
bar_color: isGerman ? "Bar-Hintergrund" : "Bar background",
pill_color: isGerman ? "Pill-Hintergrund" : "Pill background",
popup_color: isGerman ? "Popup-Hintergrund" : "Popup background",
})
// colorKey pairs each opacity with the color it fades - clicking its swatch jumps into
// the same role editor (step 2 below) used for every other color.
readonly property var opacityFields: [
{ key: "bar_opacity", colorKey: "bar_color", label: isGerman ? "Bar" : "Bar" },
{ key: "pill_opacity", colorKey: "pill_color", label: isGerman ? "Pills" : "Pills" },
{ key: "popup_opacity", colorKey: "popup_color", label: isGerman ? "Popups" : "Popups" },
{ key: "terminal_opacity", colorKey: "background", label: isGerman ? "Terminal" : "Terminal" },
]
// A curated set of preset swatches for the color picker - independent of the current
// theme, so it always offers real alternatives instead of just the colors already in use.
readonly property var presetPalette: [
@@ -62,6 +107,10 @@ PanelWindow {
function refreshColors() { colorsDump.running = true }
function refreshWallpapers() { wallpaperList.running = true }
function refreshPresets() {
presetsDefaultProc.running = true
presetsListProc.running = true
}
Process {
id: colorsDump
@@ -78,6 +127,51 @@ PanelWindow {
onExited: widget.refreshColors()
}
Process {
id: opacitySet
stdout: StdioCollector {}
onExited: widget.refreshColors()
}
Process {
id: presetsDefaultProc
command: ["python3", widget.themeDir + "/presets.py", "default"]
stdout: StdioCollector { id: presetsDefaultCollector }
onExited: {
try { widget.presetsDefault = JSON.parse(presetsDefaultCollector.text) } catch (e) {}
}
}
Process {
id: presetsListProc
command: ["python3", widget.themeDir + "/presets.py", "list"]
stdout: StdioCollector { id: presetsListCollector }
onExited: {
try { widget.presetsList = JSON.parse(presetsListCollector.text) } catch (e) {}
}
}
Process {
id: presetsSave
stdout: StdioCollector {}
onExited: widget.refreshPresets()
}
Process {
id: presetsLoad
stdout: StdioCollector {}
onExited: {
widget.refreshPresets()
widget.refreshColors()
}
}
Process {
id: presetsDelete
stdout: StdioCollector {}
onExited: widget.refreshPresets()
}
Process {
id: wallpaperList
command: ["python3", widget.themeDir + "/wallpaper.py", "list"]
@@ -100,9 +194,19 @@ PanelWindow {
onExited: widget.refreshWallpapers()
}
IpcHandler {
target: "theme-widget"
function changed(): void {
widget.refreshColors()
widget.refreshPresets()
}
}
Component.onCompleted: {
refreshColors()
refreshWallpapers()
refreshPresets()
}
Rectangle {
@@ -138,6 +242,7 @@ PanelWindow {
hoverEnabled: true
onClicked: {
widget.colorsOpen = false
widget.presetsOpen = false
widget.wallpaperOpen = !widget.wallpaperOpen
if (widget.wallpaperOpen) widget.refreshWallpapers()
}
@@ -163,6 +268,7 @@ PanelWindow {
hoverEnabled: true
onClicked: {
widget.wallpaperOpen = false
widget.presetsOpen = false
widget.colorsOpen = !widget.colorsOpen
if (widget.colorsOpen) {
widget.editingKey = ""
@@ -171,6 +277,35 @@ PanelWindow {
}
}
}
Rectangle {
width: 30; height: 26
radius: 8
color: (presetArea.containsMouse || widget.presetsOpen) ? "#1793d1" : "transparent"
Text {
anchors.centerIn: parent
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 14
color: (presetArea.containsMouse || widget.presetsOpen) ? "#0f111a" : "#a6e3a1"
}
MouseArea {
id: presetArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
widget.wallpaperOpen = false
widget.colorsOpen = false
widget.presetsOpen = !widget.presetsOpen
if (widget.presetsOpen) {
widget.presetNameInput = ""
widget.refreshPresets()
}
}
}
}
}
}
@@ -198,7 +333,7 @@ PanelWindow {
Rectangle {
anchors.fill: parent
radius: 12
color: "#f01a1b26"
color: widget.argb(widget.popupColor, widget.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -319,7 +454,7 @@ PanelWindow {
screen: widget.screen
anchors { top: true; left: true }
margins { top: 48; left: 10 }
implicitWidth: 340
implicitWidth: 460
implicitHeight: colorsCol.implicitHeight + 24
color: "transparent"
WlrLayershell.namespace: "theme-widget-colors"
@@ -334,7 +469,7 @@ PanelWindow {
Rectangle {
anchors.fill: parent
radius: 12
color: "#f01a1b26"
color: widget.argb(widget.popupColor, widget.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
@@ -408,6 +543,115 @@ PanelWindow {
}
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
Layout.topMargin: 2
color: Qt.rgba(0.478, 0.635, 0.969, 0.2)
}
Text {
text: widget.isGerman ? "Transparenz" : "Opacity"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
font.bold: true
color: "#565f89"
}
Repeater {
model: widget.opacityFields
RowLayout {
required property var modelData
Layout.fillWidth: true
spacing: 8
readonly property real liveValue: widget.colorValues[modelData.key] !== undefined ? widget.colorValues[modelData.key] : 1
property real dragValue: liveValue
readonly property real shownValue: track.pressed ? dragValue : liveValue
Text {
Layout.preferredWidth: 52
text: modelData.label
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#c0caf5"
}
Rectangle {
Layout.preferredWidth: 16
Layout.preferredHeight: 16
radius: 4
color: widget.colorValues[modelData.colorKey] || "#000000"
border.width: 1
border.color: Qt.rgba(1, 1, 1, 0.2)
MouseArea {
anchors.fill: parent
onClicked: {
widget.editingKey = modelData.colorKey
widget.hexInput = widget.colorValues[modelData.colorKey] || ""
}
}
}
Item {
Layout.fillWidth: true
Layout.preferredHeight: 20
Rectangle {
id: sliderTrack
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: 6
radius: 3
color: Qt.rgba(0.478, 0.635, 0.969, 0.15)
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: sliderTrack.width * Math.max(0, Math.min(1, shownValue))
height: 6
radius: 3
color: "#1793d1"
}
Rectangle {
anchors.verticalCenter: parent.verticalCenter
x: Math.max(0, Math.min(sliderTrack.width, sliderTrack.width * shownValue)) - width / 2
width: 14; height: 14
radius: 7
color: "#c0caf5"
border.width: track.pressed ? 2 : 0
border.color: "#1793d1"
}
MouseArea {
id: track
anchors.fill: parent
preventStealing: true
function valueAt(mx) {
return Math.max(0, Math.min(1, mx / width))
}
onPressed: (mouse) => { dragValue = valueAt(mouse.x) }
onPositionChanged: (mouse) => { if (pressed) dragValue = valueAt(mouse.x) }
onReleased: {
opacitySet.command = ["python3", widget.themeDir + "/render.py", "--set", modelData.key, dragValue.toFixed(2)]
opacitySet.running = true
}
}
}
Text {
Layout.preferredWidth: 34
horizontalAlignment: Text.AlignRight
text: Math.round(shownValue * 100) + "%"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#565f89"
}
}
}
}
// ---- step 2: pick a new color for widget.editingKey ----
@@ -535,4 +779,234 @@ PanelWindow {
}
}
}
// ================= PRESETS POPUP =================
LazyLoader {
active: widget.presetsOpen
PanelWindow {
id: presetsWindow
screen: widget.screen
anchors { top: true; left: true }
margins { top: 48; left: 10 }
implicitWidth: 320
implicitHeight: presetsCol.implicitHeight + 24
color: "transparent"
WlrLayershell.namespace: "theme-widget-presets"
WlrLayershell.layer: WlrLayer.Top
HyprlandFocusGrab {
windows: [ presetsWindow ]
active: true
onCleared: widget.presetsOpen = false
}
Rectangle {
anchors.fill: parent
radius: 12
color: widget.argb(widget.popupColor, widget.popupOpacity)
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.35)
ColumnLayout {
id: presetsCol
anchors.fill: parent
anchors.margins: 12
spacing: 8
Text {
text: widget.isGerman ? "Gespeicherte Profile" : "Saved presets"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 15
font.bold: true
color: "#c0caf5"
}
RowLayout {
Layout.fillWidth: true
spacing: 8
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 30
radius: 6
color: "#0f111a"
border.width: 1
border.color: Qt.rgba(0.478, 0.635, 0.969, 0.3)
TextInput {
anchors.fill: parent
anchors.margins: 6
text: widget.presetNameInput
onTextEdited: widget.presetNameInput = text
maximumLength: 40
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
selectByMouse: true
validator: RegularExpressionValidator { regularExpression: /[A-Za-z0-9 _-]*/ }
Text {
visible: parent.text === ""
text: "Name…"
font: parent.font
color: "#565f89"
}
}
}
Rectangle {
Layout.preferredWidth: 70
Layout.preferredHeight: 30
radius: 6
readonly property bool valid: widget.presetNameInput.trim().length > 0
color: !valid ? Qt.rgba(0.478, 0.635, 0.969, 0.1) : (saveArea.containsMouse ? "#1793d1" : Qt.rgba(0.478, 0.635, 0.969, 0.25))
opacity: valid ? 1.0 : 0.5
Text {
anchors.centerIn: parent
text: widget.isGerman ? "Speichern" : "Save"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: saveArea.containsMouse ? "#0f111a" : "#c0caf5"
}
MouseArea {
id: saveArea
anchors.fill: parent
hoverEnabled: true
enabled: parent.valid
onClicked: {
presetsSave.command = ["python3", widget.themeDir + "/presets.py", "save", widget.presetNameInput.trim()]
presetsSave.running = true
widget.presetNameInput = ""
}
}
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 1
color: Qt.rgba(0.478, 0.635, 0.969, 0.2)
}
ColumnLayout {
Layout.fillWidth: true
spacing: 3
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 30
radius: 8
color: defaultArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.18) : (widget.presetsDefault.current ? Qt.rgba(0.478, 0.635, 0.969, 0.1) : "transparent")
RowLayout {
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 8
spacing: 6
Text {
Layout.fillWidth: true
text: widget.isGerman ? "Standard" : "Default"
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
}
Text {
visible: widget.presetsDefault.current
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#1793d1"
}
}
MouseArea {
id: defaultArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
presetsLoad.command = ["python3", widget.themeDir + "/presets.py", "load", "Default"]
presetsLoad.running = true
}
}
}
Repeater {
model: widget.presetsList
Rectangle {
required property var modelData
Layout.fillWidth: true
Layout.preferredHeight: 30
radius: 8
color: rowArea.containsMouse ? Qt.rgba(0.478, 0.635, 0.969, 0.18) : (modelData.current ? Qt.rgba(0.478, 0.635, 0.969, 0.1) : "transparent")
// Declared before the row content below, so the trash icon's own
// MouseArea (a descendant of a later sibling) sits on top of this
// one and claims its clicks first; this one gets the rest of the row.
MouseArea {
id: rowArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
presetsLoad.command = ["python3", widget.themeDir + "/presets.py", "load", modelData.name]
presetsLoad.running = true
}
}
RowLayout {
anchors.fill: parent
anchors.leftMargin: 8
anchors.rightMargin: 8
spacing: 6
Text {
Layout.fillWidth: true
text: modelData.name
elide: Text.ElideRight
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 12
color: "#c0caf5"
}
Text {
visible: modelData.current
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 11
color: "#1793d1"
}
Rectangle {
width: 20; height: 20
radius: 5
color: deleteArea.containsMouse ? "#f7768e" : "transparent"
Text {
anchors.centerIn: parent
text: ""
font.family: "JetBrainsMono Nerd Font"
font.pixelSize: 10
color: deleteArea.containsMouse ? "#0f111a" : "#565f89"
}
MouseArea {
id: deleteArea
anchors.fill: parent
hoverEnabled: true
onClicked: {
presetsDelete.command = ["python3", widget.themeDir + "/presets.py", "delete", modelData.name]
presetsDelete.running = true
}
}
}
}
}
}
}
}
}
}
}
}