feat: wallpaper-driven theming + native wallpaper picker

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013ZYoSQwwYWhJHLX6VBCGnF
This commit is contained in:
johannesandClaude Sonnet 5 committed 2026-09-21 16:16:35 +02:00
1 parent c1f4bdb80c
commit 3a299fccaf
22 files changed
+594 -285

No files matched your search

@@ -69,7 +69,7 @@ PanelWindow {
delegate: Rectangle {
width: 24
height: 24
radius: 12
radius: Theme.geometry.radiusTiny
color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover
Text {
@@ -112,7 +112,7 @@ PanelWindow {
Text {
id: clockText
anchors.centerIn: parent
text: Qt.formatDateTime(clock.date, "hh:mm")
text: Qt.formatDateTime(clock.date, "dddd, MMMM d · hh:mm")
color: Theme.colors.text
font.family: Theme.font.family
font.bold: true
@@ -256,7 +256,7 @@ PanelWindow {
Rectangle {
anchors.fill: parent
radius: Theme.geometry.radius / 2
radius: Theme.geometry.radiusTiny
color: hoverArea.containsMouse
? Theme.colors.surfaceHover
: (trayIcon.active ? Qt.alpha(Theme.colors.primary, 0.15) : "transparent")
@@ -264,7 +264,7 @@ PanelWindow {
Text {
anchors.centerIn: parent
text: trayIcon.glyph
font.family: "JetBrainsMono Nerd Font"
font.family: Theme.font.family
font.pixelSize: 13
color: trayIcon.active ? Theme.colors.primary : Theme.colors.text
}
@@ -48,7 +48,7 @@ PanelWindow {
Math.min(tooltipWindow.anchorX - width / 2, tooltipWindow.width - width - Theme.geometry.spacing)
)
y: tooltipWindow.anchorY
radius: Theme.geometry.radius / 2
radius: Theme.geometry.radiusMedium
color: Theme.colors.background
border.color: Theme.colors.border
border.width: 1
@@ -1,4 +1,5 @@
import QtQuick
import QtQuick.Effects
import Quickshell
import Quickshell.Wayland
import Quickshell.Io
@@ -35,7 +36,7 @@ PanelWindow {
width: 800
height: Math.min(600, (clipList.count > 0 ? clipList.contentHeight : 0) + (searchInput.text.length > 0 ? 50 + Theme.geometry.spacing : 0) + Theme.geometry.padding * 2)
anchors.centerIn: parent
radius: Theme.geometry.radius
radius: Theme.geometry.radiusMedium
color: Theme.colors.background
border.color: Theme.colors.border
border.width: 1
@@ -61,7 +62,7 @@ PanelWindow {
opacity: searchInput.text.length > 0 ? 1 : 0
clip: true
color: Theme.colors.surface
radius: Theme.geometry.radius
radius: Theme.geometry.radiusSmall
border.width: 1
border.color: searchInput.activeFocus ? Theme.colors.primary : Theme.colors.border
@@ -69,6 +70,16 @@ PanelWindow {
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
layer.enabled: searchInput.activeFocus
layer.effect: MultiEffect {
shadowEnabled: true
shadowColor: Theme.colors.primary
shadowOpacity: 0.35
shadowBlur: 0.4
shadowHorizontalOffset: 0
shadowVerticalOffset: 0
}
TextInput {
id: searchInput
anchors.fill: parent
@@ -150,8 +161,8 @@ PanelWindow {
width: clipList.width
height: 36
color: ListView.isCurrentItem ? Theme.colors.surfaceHover : "transparent"
radius: Theme.geometry.radius
radius: Theme.geometry.radiusTiny
Item {
anchors.fill: parent
anchors.leftMargin: Theme.geometry.padding
@@ -1,4 +1,5 @@
import QtQuick
import QtQuick.Effects
import Quickshell
import Quickshell.Wayland
import Quickshell.Services.Pipewire
@@ -60,7 +61,7 @@ PanelWindow {
width: 800
height: Math.min(600, (appList.count > 0 ? appList.contentHeight : 0) + (searchInput.text.length > 0 ? 50 + Theme.geometry.spacing : 0) + Theme.geometry.padding * 2)
anchors.centerIn: parent
radius: Theme.geometry.radius
radius: Theme.geometry.radiusMedium
color: Theme.colors.background
border.color: Theme.colors.border
border.width: 1
@@ -87,7 +88,7 @@ PanelWindow {
opacity: searchInput.text.length > 0 ? 1 : 0
clip: true
color: Theme.colors.surface
radius: Theme.geometry.radius
radius: Theme.geometry.radiusSmall
border.width: 1
border.color: searchInput.activeFocus ? Theme.colors.primary : Theme.colors.border
@@ -95,6 +96,16 @@ PanelWindow {
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
layer.enabled: searchInput.activeFocus
layer.effect: MultiEffect {
shadowEnabled: true
shadowColor: Theme.colors.primary
shadowOpacity: 0.35
shadowBlur: 0.4
shadowHorizontalOffset: 0
shadowVerticalOffset: 0
}
TextInput {
id: searchInput
anchors.fill: parent
@@ -261,8 +272,8 @@ PanelWindow {
width: appList.width
height: 36
color: ListView.isCurrentItem ? Theme.colors.surfaceHover : "transparent"
radius: Theme.geometry.radius
radius: Theme.geometry.radiusTiny
Item {
anchors.fill: parent
anchors.leftMargin: Theme.geometry.padding
@@ -171,7 +171,7 @@ PanelWindow {
width: 120
height: 120
radius: Theme.geometry.radius
radius: Theme.geometry.radiusMedium
color: Theme.colors.surface
border.color: isSelected ? (isDestructive ? Theme.colors.alert : Theme.colors.primary) : Theme.colors.border
border.width: isSelected ? 2 : 1
@@ -105,7 +105,7 @@ PanelWindow {
id: toast
width: list.width
height: content.implicitHeight + Theme.geometry.padding * 2
radius: Theme.geometry.radius
radius: Theme.geometry.radiusMedium
color: Qt.alpha(notifWindow.colorFor(model.urgency), 0.15)
border.color: Qt.alpha(notifWindow.colorFor(model.urgency), 0.3)
border.width: 1
@@ -1,4 +1,5 @@
import QtQuick
import QtQuick.Effects
import "."
Rectangle {
@@ -9,6 +10,8 @@ Rectangle {
property string text: ""
signal clicked()
// primary and accent are the same color (Theme.colors.primary === .accent);
// kept as separate variant names for call-site clarity.
readonly property bool filled: variant === "primary" || variant === "accent"
readonly property color tint: variant === "accent" ? Theme.colors.accent
: variant === "destructive" ? Theme.colors.alert
@@ -17,13 +20,22 @@ Rectangle {
implicitWidth: label.implicitWidth + Theme.geometry.padding * 2
implicitHeight: label.implicitHeight + Theme.geometry.padding
radius: Theme.geometry.radius
radius: Theme.geometry.radiusSmall
color: filled
? (mouseArea.pressed ? Qt.darker(tint, 1.1) : tint)
: (mouseArea.containsMouse ? Qt.alpha(tint, 0.22) : Qt.alpha(tint, 0.15))
border.width: filled ? 0 : 1
border.color: Qt.alpha(tint, 0.3)
layer.enabled: filled
layer.effect: MultiEffect {
shadowEnabled: true
shadowColor: button.tint
shadowOpacity: 0.5
shadowBlur: 0.6
shadowVerticalOffset: 2
}
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
Behavior on scale { SpringAnimation { spring: 4; damping: 0.3 } }
scale: mouseArea.pressed ? 0.97 : 1.0
@@ -11,7 +11,7 @@ Rectangle {
visible: false
z: 1000
width: 180
radius: 10
radius: Theme.geometry.radiusMedium
color: Theme.colors.background
border.color: Theme.colors.border
border.width: 1
@@ -43,7 +43,7 @@ Rectangle {
delegate: Rectangle {
width: column.width
height: modelData.separator ? 1 : 28
radius: modelData.separator ? 0 : 6
radius: modelData.separator ? 0 : Theme.geometry.radiusTiny
color: modelData.separator
? Theme.colors.border
: (itemMouse.containsMouse ? Theme.colors.surfaceHover : "transparent")
@@ -4,27 +4,33 @@ import QtQuick
QtObject {
id: theme
// Regenerated by wallpaper-theme.nu on every wallpaper change - don't
// hand-edit between these markers, it gets overwritten.
// GENERATED:COLORS:BEGIN
property QtObject colors: QtObject {
property color background: "#e611111b" // Opaque dark for better readability
property color surface: "#e6181825"
property color background: "#e611111b"
property color surface: "#cc181825"
property color surfaceHover: "#f2313244"
property color overlay: "#6011111b" // Translucent dark for full screen dim
property color primary: "#89b4fa"
property color overlay: "#6011111b"
property color primary: "#74c7ec"
property color secondary: "#b4befe"
property color accent: "#cba6f7"
property color accent: "#74c7ec"
property color alert: "#f38ba8"
property color success: "#a6e3a1"
property color warning: "#f9e2af"
property color text: "#cdd6f4"
property color textMuted: "#a6adc8"
property color border: "#30ffffff"
property color border: "#1a74c7ec"
}
// GENERATED:COLORS:END
property QtObject geometry: QtObject {
property int radius: 16
property int radiusTiny: 6
property int radiusSmall: 8
property int radiusMedium: 10
property int pillRadius: 100
property int padding: 12
property int spacing: 8
@@ -37,6 +43,6 @@ QtObject {
}
property QtObject font: QtObject {
property string family: "Inter"
property string family: "JetBrainsMono Nerd Font"
}
}
@@ -0,0 +1,198 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Io
import "../Shared"
PanelWindow {
id: pickerWindow
property QtObject rootState
property var wallpapers: []
property int currentIndex: 0
property string currentWallpaperPath: ""
readonly property string scriptPath: Quickshell.env("HOME") + "/.dotfiles/config/nushell/scripts/wallpaper-switch.nu"
visible: rootState.wallpaperPickerOpen
anchors {
top: true
bottom: true
left: true
right: true
}
exclusiveZone: 0
color: "transparent"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.namespace: "quickshell-wallpaper-picker"
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
Process {
id: listProcess
command: ["nu", pickerWindow.scriptPath, "--list-with-current"]
running: false
stdout: StdioCollector {
onStreamFinished: {
try {
let data = JSON.parse(this.text);
pickerWindow.wallpapers = data.wallpapers ?? [];
pickerWindow.currentWallpaperPath = data.current ?? "";
} catch (e) {
pickerWindow.wallpapers = [];
pickerWindow.currentWallpaperPath = "";
}
pickerWindow.selectInitialIndex();
}
}
}
Process {
id: applyProcess
running: false
}
function wrappedIndex(i) {
let len = wallpapers.length;
return len > 0 ? ((i % len) + len) % len : 0;
}
function selectInitialIndex() {
if (wallpapers.length === 0) return;
let idx = currentWallpaperPath.length > 0
? wallpapers.findIndex(w => w.path === currentWallpaperPath)
: -1;
currentIndex = idx >= 0 ? idx : 0;
}
function applySelection() {
if (wallpapers.length === 0) return;
applyProcess.command = ["nu", pickerWindow.scriptPath, "--set", wallpapers[currentIndex].path];
applyProcess.running = true;
rootState.wallpaperPickerOpen = false;
}
onVisibleChanged: {
if (visible) {
listProcess.running = true;
}
}
MouseArea {
anchors.fill: parent
onClicked: rootState.wallpaperPickerOpen = false
}
Rectangle {
anchors.fill: parent
color: Theme.colors.overlay
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationNormal } }
opacity: pickerWindow.visible ? 1 : 0
MouseArea {
anchors.fill: parent
onClicked: rootState.wallpaperPickerOpen = false
}
// Fixed slots, no sliding: only which wallpaper each slot shows changes.
Row {
id: carousel
anchors.centerIn: parent
spacing: Theme.geometry.spacing * 3
Repeater {
model: 5
delegate: Item {
id: delegateRoot
readonly property int offset: index - 2
readonly property bool isCurrent: offset === 0
readonly property int wpIndex: pickerWindow.wrappedIndex(pickerWindow.currentIndex + offset)
readonly property var wp: pickerWindow.wallpapers.length > 0 ? pickerWindow.wallpapers[wpIndex] : null
width: isCurrent ? 260 : 170
height: 340
Rectangle {
anchors.centerIn: parent
width: isCurrent ? 240 : 150
height: isCurrent ? 320 : 200
radius: Theme.geometry.radiusMedium
color: Theme.colors.surface
border.color: delegateRoot.isCurrent ? Theme.colors.primary : Theme.colors.border
border.width: delegateRoot.isCurrent ? 2 : 1
opacity: delegateRoot.isCurrent ? 1.0 : 0.5
clip: true
Image {
anchors.fill: parent
anchors.margins: 4
source: delegateRoot.wp ? "file://" + delegateRoot.wp.thumb : ""
fillMode: Image.PreserveAspectCrop
asynchronous: true
cache: true
}
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: {
if (delegateRoot.isCurrent) {
pickerWindow.applySelection();
} else {
pickerWindow.currentIndex = delegateRoot.wpIndex;
}
}
}
}
}
}
Text {
anchors.top: carousel.bottom
anchors.topMargin: Theme.geometry.spacing * 2
anchors.horizontalCenter: parent.horizontalCenter
text: pickerWindow.wallpapers.length > 0
? (pickerWindow.wallpapers[pickerWindow.currentIndex]?.path ?? "").split("/").pop()
: "No wallpapers found"
color: Theme.colors.text
font.family: Theme.font.family
}
}
Item {
id: keyHandler
anchors.fill: parent
focus: true
Connections {
target: pickerWindow
function onVisibleChanged() {
if (pickerWindow.visible) keyHandler.forceActiveFocus();
}
}
Keys.onEscapePressed: (event) => {
rootState.wallpaperPickerOpen = false;
event.accepted = true;
}
Keys.onLeftPressed: (event) => {
pickerWindow.currentIndex = pickerWindow.wrappedIndex(pickerWindow.currentIndex - 1);
event.accepted = true;
}
Keys.onRightPressed: (event) => {
pickerWindow.currentIndex = pickerWindow.wrappedIndex(pickerWindow.currentIndex + 1);
event.accepted = true;
}
Keys.onReturnPressed: (event) => {
pickerWindow.applySelection();
event.accepted = true;
}
}
}