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-17 19:56:15 +02:00
1 parent 0537615b96
commit ace2860e7a
22 files changed
+594 -285

No files matched your search

-122
View File
@@ -1,122 +0,0 @@
#!/usr/bin/env nu
def apply-theme [selected: string] {
let choice = if $selected == "auto" {
let mode = (try { darkman get | str trim } catch { "" })
if $mode == "dark" {
"mocha"
} else if $mode == "light" {
"latte"
} else {
let color_scheme = (bash -lc "gsettings get org.gnome.desktop.interface color-scheme 2>/dev/null || true" | str trim)
if ($color_scheme | str contains "prefer-dark") {
"mocha"
} else if ($color_scheme | str contains "prefer-light") {
"latte"
} else {
let hour = (date now | format date "%H" | into int)
if ($hour >= 19 or $hour < 7) { "mocha" } else { "latte" }
}
}
} else {
$selected
}
let wanted_darkman = if $choice == "mocha" { "dark" } else { "light" }
let current_darkman = (try { darkman get | str trim } catch { "" })
if $current_darkman != "" and $current_darkman != $wanted_darkman {
try {
bash -c $"darkman set ($wanted_darkman) &"
} catch {}
}
let home = $env.HOME
let base = $"($home)/.config/themes/catppuccin/($choice)"
if not ($base | path exists) {
exit 1
}
let gtk_theme = (open $"($base)/gtk-theme-name" | str trim)
$choice | save -f $"($home)/.config/current-theme"
# Hypr palette. Configs must source ~/.config/hypr/theme.conf to use this.
ln -sfn $"($base)/hypr.conf" $"($home)/.config/hypr/theme.conf"
# Quickshell singleton theme.
cp -f $"($base)/quickshell/Theme.qml" $"($home)/.config/quickshell/Theme/Theme.qml"
# Wofi colors.
if ($"($home)/.config/wofi" | path exists) {
ln -sfn $"($base)/wofi.css" $"($home)/.config/wofi/style.css"
}
# Mako colors, only if mako config dir exists.
if ($"($home)/.config/mako" | path exists) {
ln -sfn $"($base)/mako.conf" $"($home)/.config/mako/config"
if (which makoctl | is-not-empty) { makoctl reload }
}
# Btop theme
if ($"($home)/.config/btop/btop.conf" | path exists) {
bash -lc $"sed -i 's|color_theme = \".*\"|color_theme = \"($home)/.config/btop/themes/catppuccin_($choice).theme\"|' \"($home)/.config/btop/btop.conf\""
if ($"($home)/.local/share/chezmoi/dot_config/btop/btop.conf" | path exists) {
bash -lc $"sed -i 's|color_theme = \".*\"|color_theme = \"($home)/.config/btop/themes/catppuccin_($choice).theme\"|' \"($home)/.local/share/chezmoi/dot_config/btop/btop.conf\""
}
}
# Helix theme
if ($"($home)/.config/helix/config.toml" | path exists) {
bash -lc $"sed -i 's/theme = \"catppuccin_.*_transparent\"/theme = \"catppuccin_($choice)_transparent\"/' \"($home)/.config/helix/config.toml\""
if ($"($home)/.local/share/chezmoi/dot_config/helix/config.toml" | path exists) {
bash -lc $"sed -i 's/theme = \"catppuccin_.*_transparent\"/theme = \"catppuccin_($choice)_transparent\"/' \"($home)/.local/share/chezmoi/dot_config/helix/config.toml\""
}
}
# Yazi theme
if ($"($home)/.config/yazi" | path exists) {
$"[flavor]\nuse = \"catppuccin-($choice)\"\n" | save -f $"($home)/.config/yazi/theme.toml"
}
# GTK theme, only if installed.
try {
bash -lc $"gsettings set org.gnome.desktop.interface gtk-theme ($gtk_theme)"
let color_scheme = if $choice == "mocha" { "prefer-dark" } else { "prefer-light" }
bash -lc $"gsettings set org.gnome.desktop.interface color-scheme ($color_scheme)"
try {
mkdir $"($home)/.config/gtk-3.0"
} catch {}
let prefer_dark = if $choice == "mocha" { "1" } else { "0" }
$"[Settings]\ngtk-theme-name=($gtk_theme)\ngtk-application-prefer-dark-theme=($prefer_dark)\n" | save -f $"($home)/.config/gtk-3.0/settings.ini"
} catch {
}
hyprctl reload
bash -lc "pkill quickshell 2>/dev/null; setsid quickshell >/tmp/quickshell-theme-switch.log 2>&1 < /dev/null &"
}
def main [
mode?: string
--auto
--mocha
--latte
] {
let valid = ["auto" "mocha" "latte"]
let selected = if $auto {
"auto"
} else if $mocha {
"mocha"
} else if $latte {
"latte"
} else if $mode == null {
($valid | str join "\n" | wofi --dmenu --prompt "Theme")
} else {
$mode
}
if ($selected not-in $valid) { exit }
apply-theme $selected
}
+51 -22
View File
@@ -4,8 +4,8 @@ const image_exts = ["jpg" "jpeg" "png" "webp"]
def wallpaper-dirs [] {
[
($"($env.HOME)/Nextcloud/Wallpaper")
($"($env.HOME)/Nextcloud/Wallpaper_32x9")
($"($env.HOME)/ownCloud/Personal/Wallpaper")
($"($env.HOME)/ownCloud/Personal/Wallpaper_32x9")
] | where {|dir| $dir | path exists }
}
@@ -14,39 +14,63 @@ def list-wallpapers [] {
| each {|dir| ls $dir }
| flatten
| where type == file
| where {|file| (($file.name | path parse | get extension | str downcase) in $image_exts) }
| where {|file| (($file.name | path parse | get extension | str lowercase) in $image_exts) }
| sort-by name
}
const thumb_size = "480x640"
def thumbnail-dir [] {
let dir = $"($env.HOME)/.cache/quickshell-wallpaper-thumbs"
mkdir $dir
$dir
}
def thumbnail-path [src: string] {
let hash = ($src | hash sha256 | str substring 0..24)
$"(thumbnail-dir)/($hash).jpg"
}
# Pre-rendered small JPEG cached in ~/.cache, so the picker never has to
# decode a multi-megapixel wallpaper just to show a thumbnail.
def ensure-thumbnail [src: string] {
let thumb = (thumbnail-path $src)
if not ($thumb | path exists) {
try {
magick $src -auto-orient -thumbnail $"($thumb_size)^" -gravity center -extent $thumb_size -quality 85 $thumb
} catch {}
}
$thumb
}
def list-wallpapers-with-thumbs [] {
list-wallpapers | get name | par-each {|f| { path: $f, thumb: (ensure-thumbnail $f) } }
}
def set-wallpaper [path: string] {
if not ($path | path exists) {
notify-send "Wallpaper not found" $path
try { notify-send "Wallpaper not found" $path }
exit 1
}
awww img $path --transition-type grow --transition-duration 1
try { awww img $path --transition-type grow --transition-duration 1 }
$path | save -f $"($env.HOME)/.config/current-wallpaper"
notify-send "Wallpaper applied" ($path | path basename)
}
def choose-wallpaper [] {
let files = (list-wallpapers)
if ($files | is-empty) {
notify-send "No wallpapers found" "~/Nextcloud/Wallpaper or ~/Nextcloud/Wallpaper_32x9"
exit 1
# An unhandled external-command failure aborts the rest of a nu script, so
# this must not depend on awww/notify-send succeeding above.
try {
bash -lc $"nu ~/.dotfiles/config/nushell/scripts/wallpaper-theme.nu \"($path)\""
} catch {|e|
try { notify-send "Theme update failed" $e.msg }
}
let choice = ($files | get name | path basename | str join "\n" | wofi --dmenu --prompt "Wallpaper")
if ($choice == "") { exit }
let selected = ($files | where {|file| ($file.name | path basename) == $choice } | get name | first)
set-wallpaper $selected
try { notify-send "Wallpaper applied" ($path | path basename) }
}
def random-wallpaper [] {
let files = (list-wallpapers)
if ($files | is-empty) {
notify-send "No wallpapers found" "~/Nextcloud/Wallpaper or ~/Nextcloud/Wallpaper_32x9"
notify-send "No wallpapers found" "~/ownCloud/Personal/Wallpaper or ~/ownCloud/Personal/Wallpaper_32x9"
exit 1
}
@@ -56,18 +80,23 @@ def random-wallpaper [] {
def current-wallpaper [] {
let file = $"($env.HOME)/.config/current-wallpaper"
if ($file | path exists) { open $file | str trim }
if ($file | path exists) { open $file | str trim } else { "" }
}
def main [
path?: string
--menu
--random
--set: string
--current
--list
--list-with-current
] {
if $list {
if $list_with_current {
{
wallpapers: (list-wallpapers-with-thumbs),
current: (current-wallpaper)
} | to json --raw
} else if $list {
list-wallpapers | get name | to json --raw
} else if $current {
current-wallpaper
@@ -78,6 +107,6 @@ def main [
} else if $path != null {
set-wallpaper $path
} else {
choose-wallpaper
notify-send "Wallpaper picker" "Use the mod+W wallpaper carousel instead"
}
}
+186
View File
@@ -0,0 +1,186 @@
#!/usr/bin/env nu
# Derives a Catppuccin flavor + accent from a wallpaper's average color and
# applies it system-wide. No manual override - the wallpaper is the source of truth.
def palette [] {
open ($"($env.HOME)/.dotfiles/config/themes/catppuccin/palette.json")
}
def average-color [path: string] {
let out = (magick $path -resize 1x1 txt:- | lines | skip 1 | first)
let matches = ($out | parse --regex '\((?P<r>\d+),(?P<g>\d+),(?P<b>\d+)\)')
if ($matches | is-empty) {
error make { msg: $"could not read average color from ($path)" }
}
let m = ($matches | first)
{ r: ($m.r | into int), g: ($m.g | into int), b: ($m.b | into int) }
}
def rgb-to-hsl [rgb: record<r: int, g: int, b: int>] {
let r = $rgb.r / 255
let g = $rgb.g / 255
let b = $rgb.b / 255
let max = ([$r $g $b] | math max)
let min = ([$r $g $b] | math min)
let l = ($max + $min) / 2
let delta = $max - $min
let s = if $delta == 0 {
0
} else {
$delta / (1 - (($l * 2 - 1) | math abs))
}
let h = if $delta == 0 {
0
} else if $max == $r {
(60 * ((($g - $b) / $delta) mod 6))
} else if $max == $g {
(60 * ((($b - $r) / $delta) + 2))
} else {
(60 * ((($r - $g) / $delta) + 4))
}
let h = if $h < 0 { $h + 360 } else { $h }
{ h: $h, s: $s, l: $l }
}
def hex-byte [] {
# "into int -r 16" misreads byte pairs like "0b" as a binary literal prefix.
$"0x($in)" | into int
}
def hue-dist [a: float, b: float] {
let diff = (($a - $b) | math abs)
[$diff, 360 - $diff] | math min
}
def pick-flavor [rgb: record<r: int, g: int, b: int>] {
let luma = (0.299 * $rgb.r + 0.587 * $rgb.g + 0.114 * $rgb.b) / 255
if $luma < 0.5 { "mocha" } else { "latte" }
}
def pick-accent [flavor: string, rgb: record<r: int, g: int, b: int>] {
let wallpaper_hsl = (rgb-to-hsl $rgb)
# Near-gray wallpapers don't carry a meaningful hue - fall back to mauve.
if $wallpaper_hsl.s < 0.12 {
return "mauve"
}
let accents = (palette | get $flavor | get accents)
$accents
| columns
| each {|name|
let hex = ($accents | get $name)
let r = ($hex | str substring 1..2 | hex-byte)
let g = ($hex | str substring 3..4 | hex-byte)
let b = ($hex | str substring 5..6 | hex-byte)
let accent_hsl = (rgb-to-hsl { r: $r, g: $g, b: $b })
{ name: $name, dist: (hue-dist $wallpaper_hsl.h $accent_hsl.h) }
}
| sort-by dist
| first
| get name
}
def write-theme-colors [flavor: string, accent_name: string] {
let p = (palette | get $flavor)
let accent = ($p.accents | get $accent_name)
let border = $"#1a($accent | str substring 1..)" # accent-tinted, ~10% opacity
let colors = [
$" property color background: \"#e6($p.crust | str substring 1..)\""
$" property color surface: \"#cc($p.mantle | str substring 1..)\""
$" property color surfaceHover: \"#f2($p.surface0 | str substring 1..)\""
$" property color overlay: \"#60($p.crust | str substring 1..)\""
""
$" property color primary: \"($accent)\""
$" property color secondary: \"($p.accents.lavender)\""
$" property color accent: \"($accent)\""
$" property color alert: \"($p.red)\""
$" property color success: \"($p.green)\""
$" property color warning: \"($p.yellow)\""
""
$" property color text: \"($p.text)\""
$" property color textMuted: \"($p.subtext0)\""
""
$" property color border: \"($border)\""
]
let theme_path = $"($env.HOME)/.config/quickshell/components/Shared/Theme.qml"
let lines = (open --raw $theme_path | lines)
let begin = ($lines | enumerate | where item == " // GENERATED:COLORS:BEGIN" | get index.0)
let end = ($lines | enumerate | where item == " // GENERATED:COLORS:END" | get index.0)
let new_lines = (
($lines | take ($begin + 1))
++ [" property QtObject colors: QtObject {"]
++ $colors
++ [" }"]
++ ($lines | skip $end)
)
($new_lines | str join "\n") + "\n" | save -f $theme_path
}
def propagate [flavor: string] {
let home = $env.HOME
let base = $"($home)/.config/themes/catppuccin/($flavor)"
let gtk_theme = (open $"($base)/gtk-theme-name" | str trim)
$flavor | save -f $"($home)/.config/current-theme"
let wanted_darkman = if $flavor == "mocha" { "dark" } else { "light" }
let current_darkman = (try { darkman get | str trim } catch { "" })
if $current_darkman != "" and $current_darkman != $wanted_darkman {
try { bash -c $"darkman set ($wanted_darkman) &" } catch {}
}
# Hypr palette. Configs must source ~/.config/hypr/theme.conf to use this.
ln -sfn $"($base)/hypr.conf" $"($home)/.config/hypr/theme.conf"
# Mako colors, only if mako config dir exists.
if ($"($home)/.config/mako" | path exists) {
ln -sfn $"($base)/mako.conf" $"($home)/.config/mako/config"
if (which makoctl | is-not-empty) { makoctl reload }
}
# Btop theme
if ($"($home)/.config/btop/btop.conf" | path exists) {
bash -lc $"sed -i 's|color_theme = \".*\"|color_theme = \"($home)/.config/btop/themes/catppuccin_($flavor).theme\"|' \"($home)/.config/btop/btop.conf\""
}
# Helix theme
if ($"($home)/.config/helix/config.toml" | path exists) {
bash -lc $"sed -i 's/theme = \"catppuccin_.*_transparent\"/theme = \"catppuccin_($flavor)_transparent\"/' \"($home)/.config/helix/config.toml\""
}
# Yazi theme
if ($"($home)/.config/yazi" | path exists) {
$"[flavor]\nuse = \"catppuccin-($flavor)\"\n" | save -f $"($home)/.config/yazi/theme.toml"
}
# GTK theme, only if installed.
try {
bash -lc $"gsettings set org.gnome.desktop.interface gtk-theme ($gtk_theme)"
let color_scheme = if $flavor == "mocha" { "prefer-dark" } else { "prefer-light" }
bash -lc $"gsettings set org.gnome.desktop.interface color-scheme ($color_scheme)"
try { mkdir $"($home)/.config/gtk-3.0" } catch {}
let prefer_dark = if $flavor == "mocha" { "1" } else { "0" }
$"[Settings]\ngtk-theme-name=($gtk_theme)\ngtk-application-prefer-dark-theme=($prefer_dark)\n" | save -f $"($home)/.config/gtk-3.0/settings.ini"
} catch {}
hyprctl reload
bash -lc "pkill quickshell 2>/dev/null; setsid quickshell >/tmp/quickshell-theme.log 2>&1 < /dev/null &"
}
def main [wallpaper_path: string] {
let rgb = (average-color $wallpaper_path)
let flavor = (pick-flavor $rgb)
let accent = (pick-accent $flavor $rgb)
write-theme-colors $flavor $accent
propagate $flavor
}
@@ -1,36 +0,0 @@
pragma Singleton
import QtQuick
QtObject {
// Catppuccin Latte
property color base: "#eff1f5"
property color mantle: "#e6e9ef"
property color crust: "#dce0e8"
property color surface0: "#ccd0da"
property color surface1: "#bcc0cc"
property color surface2: "#acb0be"
property color overlay0: "#9ca0b0"
property color overlay1: "#8c8fa1"
property color overlay2: "#7c7f93"
property color text: "#4c4f69"
property color subtext0: "#6c6f85"
property color subtext1: "#5c5f77"
property color mauve: "#8839ef"
property color flamingo: "#dd7878"
property color peach: "#fe640b"
property color sky: "#04a5e5"
property color green: "#40a02b"
property color yellow: "#df8e1d"
property color red: "#d20f39"
property color rosewater: "#dc8a78"
property real barHeight: 36
property real padding: 10
property real spacing: 10
property real fontPixelSize: 14
property string fontFamily: "Fira Code Nerd Font"
property real sectionRadius: 14
property real sectionPadding: 12
property real barMargin: 16
property real widgetSpacing: 8
}
@@ -1,36 +0,0 @@
pragma Singleton
import QtQuick
QtObject {
// Catppuccin Mocha
property color base: "#1e1e2e"
property color mantle: "#181825"
property color crust: "#11111b"
property color surface0: "#313244"
property color surface1: "#45475a"
property color surface2: "#585b70"
property color overlay0: "#6c7086"
property color overlay1: "#7f849c"
property color overlay2: "#9399b2"
property color text: "#cdd6f4"
property color subtext0: "#a6adc8"
property color subtext1: "#bac2de"
property color mauve: "#cba6f7"
property color flamingo: "#f2cdcd"
property color peach: "#fab387"
property color sky: "#89dceb"
property color green: "#a6e3a1"
property color yellow: "#f9e2af"
property color red: "#f38ba8"
property color rosewater: "#f5e0dc"
property real barHeight: 36
property real padding: 10
property real spacing: 10
property real fontPixelSize: 14
property string fontFamily: "Fira Code Nerd Font"
property real sectionRadius: 14
property real sectionPadding: 12
property real barMargin: 16
property real widgetSpacing: 8
}
+58
View File
@@ -0,0 +1,58 @@
{
"mocha": {
"base": "#1e1e2e",
"mantle": "#181825",
"crust": "#11111b",
"surface0": "#313244",
"surface1": "#45475a",
"text": "#cdd6f4",
"subtext0": "#a6adc8",
"green": "#a6e3a1",
"yellow": "#f9e2af",
"red": "#f38ba8",
"accents": {
"rosewater": "#f5e0dc",
"flamingo": "#f2cdcd",
"pink": "#f5c2e7",
"mauve": "#cba6f7",
"red": "#f38ba8",
"maroon": "#eba0ac",
"peach": "#fab387",
"yellow": "#f9e2af",
"green": "#a6e3a1",
"teal": "#94e2d5",
"sky": "#89dceb",
"sapphire": "#74c7ec",
"blue": "#89b4fa",
"lavender": "#b4befe"
}
},
"latte": {
"base": "#eff1f5",
"mantle": "#e6e9ef",
"crust": "#dce0e8",
"surface0": "#ccd0da",
"surface1": "#bcc0cc",
"text": "#4c4f69",
"subtext0": "#6c6f85",
"green": "#40a02b",
"yellow": "#df8e1d",
"red": "#d20f39",
"accents": {
"rosewater": "#dc8a78",
"flamingo": "#dd7878",
"pink": "#ea76cb",
"mauve": "#8839ef",
"red": "#d20f39",
"maroon": "#e64553",
"peach": "#fe640b",
"yellow": "#df8e1d",
"green": "#40a02b",
"teal": "#179299",
"sky": "#04a5e5",
"sapphire": "#209fb5",
"blue": "#1e66f5",
"lavender": "#7287fd"
}
}
}
+1
View File
@@ -68,6 +68,7 @@
easyeffects
lutris
claude-code
imagemagick
];
home.file = {
+1 -1
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
DIR="$HOME/Nextcloud/Wallpaper"
DIR="$HOME/ownCloud/Personal/Wallpaper"
INTERVAL=300 # seconds between changes
awww init 2>/dev/null
+1 -2
View File
@@ -192,8 +192,7 @@ hl.bind(mainMod .. " + comma", hl.dsp.layout("move -col"))
hl.bind(mainMod .. " + SHIFT + period", hl.dsp.layout("swapcol r"))
hl.bind(mainMod .. " + SHIFT + comma", hl.dsp.layout("swapcol l"))
-- Theme / wallpaper switchers
hl.bind(mainMod .. " + T", hl.dsp.exec_cmd("qs ipc call themeSwitcher open"))
-- Wallpaper switcher (drives theme flavor + accent automatically)
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd("qs ipc call wallpaperSwitcher open"))
hl.bind(mainMod .. " + SHIFT + W", hl.dsp.exec_cmd("qs ipc call wallpaperSwitcher random"))
@@ -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;
}
}
}
-36
View File
@@ -1,36 +0,0 @@
pragma Singleton
import QtQuick
QtObject {
// Mocha-like palette
property color bg: "#1e1e2e"
property color bgAlt: "#313244"
property color fg: "#cdd6f4"
property color fgAlt: "#a6adc8"
property color primary: "#89b4fa"
property color accent: "#f38ba8"
property color transparent: "transparent"
property int radius: 8
property int padding: 8
// Legacy / Catppuccin Aliases for imported Widgets
property string fontFamily: "sans-serif"
property int fontPixelSize: 14
property color base: "#1e1e2e"
property color crust: "#11111b"
property color text: "#cdd6f4"
property color subtext0: "#a6adc8"
property color surface0: "#313244"
property color surface1: "#45475a"
property color overlay1: "#7f849c"
property color overlay2: "#9399b2"
property color green: "#a6e3a1"
property color mauve: "#cba6f7"
property color lavender: "#b4befe"
property color red: "#f38ba8"
property font font: Qt.font({ family: fontFamily, pixelSize: fontPixelSize })
property font fontBold: Qt.font({ family: fontFamily, pixelSize: fontPixelSize, bold: true })
}
-1
View File
@@ -1 +0,0 @@
singleton Theme Theme.qml
+29
View File
@@ -9,6 +9,7 @@ import "components/Shared"
import "components/LogoutMenu"
import "components/ClipboardManager"
import "components/Notifications"
import "components/WallpaperPicker"
ShellRoot {
id: root
@@ -17,6 +18,7 @@ ShellRoot {
property bool commandPaletteOpen: false
property bool logoutMenuOpen: false
property bool clipboardManagerOpen: false
property bool wallpaperPickerOpen: false
IpcHandler {
target: "commandPalette"
@@ -61,6 +63,28 @@ ShellRoot {
}
}
IpcHandler {
target: "wallpaperSwitcher"
function open() {
wallpaperPickerOpen = !wallpaperPickerOpen;
if (wallpaperPickerOpen) {
commandPaletteOpen = false;
logoutMenuOpen = false;
clipboardManagerOpen = false;
}
}
function random() {
randomWallpaperProcess.running = false;
randomWallpaperProcess.running = true;
}
}
Process {
id: randomWallpaperProcess
command: ["nu", Quickshell.env("HOME") + "/.dotfiles/config/nushell/scripts/wallpaper-switch.nu", "--random"]
running: false
}
TrayTooltip {
id: trayTooltip
}
@@ -93,4 +117,9 @@ ShellRoot {
Notifications {
id: notifications
}
WallpaperPicker {
id: wallpaperPicker
rootState: root
}
}