Compare commits
14
Commits
main
...
d503ff7496
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d503ff7496 | ||
|
|
c3c1f29df0 | ||
|
|
215d8b7d8e | ||
|
|
5a004b8be5 | ||
|
|
44cf203da4 | ||
|
|
fef7cacc9e | ||
|
|
832d2544da | ||
|
|
c7fb3f9c02 | ||
|
|
78c23b35ca | ||
|
|
ab24daec95 | ||
|
|
17281a04cd | ||
|
|
acc593a1e4 | ||
|
|
4d56835ade | ||
|
|
bb0ff9089f |
No files matched your search
@@ -1 +1,3 @@
|
|||||||
result
|
result
|
||||||
|
|
||||||
|
hyprland-gui.lua
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ const image_exts = ["jpg" "jpeg" "png" "webp"]
|
|||||||
|
|
||||||
def wallpaper-dirs [] {
|
def wallpaper-dirs [] {
|
||||||
[
|
[
|
||||||
($"($env.HOME)/Nextcloud/Wallpaper")
|
($"($env.HOME)/ownCloud/Personal/Wallpaper")
|
||||||
($"($env.HOME)/Nextcloud/Wallpaper_32x9")
|
($"($env.HOME)/ownCloud/Personal/Wallpaper_32x9")
|
||||||
] | where {|dir| $dir | path exists }
|
] | where {|dir| $dir | path exists }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,39 +14,63 @@ def list-wallpapers [] {
|
|||||||
| each {|dir| ls $dir }
|
| each {|dir| ls $dir }
|
||||||
| flatten
|
| flatten
|
||||||
| where type == file
|
| 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
|
| 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] {
|
def set-wallpaper [path: string] {
|
||||||
if not ($path | path exists) {
|
if not ($path | path exists) {
|
||||||
notify-send "Wallpaper not found" $path
|
try { notify-send "Wallpaper not found" $path }
|
||||||
exit 1
|
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"
|
$path | save -f $"($env.HOME)/.config/current-wallpaper"
|
||||||
notify-send "Wallpaper applied" ($path | path basename)
|
|
||||||
}
|
|
||||||
|
|
||||||
def choose-wallpaper [] {
|
# An unhandled external-command failure aborts the rest of a nu script, so
|
||||||
let files = (list-wallpapers)
|
# this must not depend on awww/notify-send succeeding above.
|
||||||
if ($files | is-empty) {
|
try {
|
||||||
notify-send "No wallpapers found" "~/Nextcloud/Wallpaper or ~/Nextcloud/Wallpaper_32x9"
|
bash -lc $"nu ~/.dotfiles/config/nushell/scripts/wallpaper-theme.nu \"($path)\""
|
||||||
exit 1
|
} catch {|e|
|
||||||
|
try { notify-send "Theme update failed" $e.msg }
|
||||||
}
|
}
|
||||||
|
|
||||||
let choice = ($files | get name | path basename | str join "\n" | wofi --dmenu --prompt "Wallpaper")
|
try { notify-send "Wallpaper applied" ($path | path basename) }
|
||||||
if ($choice == "") { exit }
|
|
||||||
|
|
||||||
let selected = ($files | where {|file| ($file.name | path basename) == $choice } | get name | first)
|
|
||||||
set-wallpaper $selected
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def random-wallpaper [] {
|
def random-wallpaper [] {
|
||||||
let files = (list-wallpapers)
|
let files = (list-wallpapers)
|
||||||
if ($files | is-empty) {
|
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
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,18 +80,23 @@ def random-wallpaper [] {
|
|||||||
|
|
||||||
def current-wallpaper [] {
|
def current-wallpaper [] {
|
||||||
let file = $"($env.HOME)/.config/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 [
|
def main [
|
||||||
path?: string
|
path?: string
|
||||||
--menu
|
|
||||||
--random
|
--random
|
||||||
--set: string
|
--set: string
|
||||||
--current
|
--current
|
||||||
--list
|
--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
|
list-wallpapers | get name | to json --raw
|
||||||
} else if $current {
|
} else if $current {
|
||||||
current-wallpaper
|
current-wallpaper
|
||||||
@@ -78,6 +107,6 @@ def main [
|
|||||||
} else if $path != null {
|
} else if $path != null {
|
||||||
set-wallpaper $path
|
set-wallpaper $path
|
||||||
} else {
|
} else {
|
||||||
choose-wallpaper
|
notify-send "Wallpaper picker" "Use the mod+W wallpaper carousel instead"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
#!/usr/bin/env nu
|
||||||
|
# Derives a Catppuccin flavor + a trio of accents from a wallpaper's dominant
|
||||||
|
# colors and applies it system-wide. No manual override - the wallpaper is
|
||||||
|
# the source of truth. Colors are always Catppuccin swatches - we only ever
|
||||||
|
# change *which* swatches get used, never introduce outside colors.
|
||||||
|
|
||||||
|
def palette [] {
|
||||||
|
open ($"($env.HOME)/.dotfiles/config/themes/catppuccin/palette.json")
|
||||||
|
}
|
||||||
|
|
||||||
|
def hex-byte [] {
|
||||||
|
# "into int -r 16" misreads byte pairs like "0b" as a binary literal prefix.
|
||||||
|
$"0x($in)" | 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 hue-dist [a: float, b: float] {
|
||||||
|
let diff = (($a - $b) | math abs)
|
||||||
|
[$diff, 360 - $diff] | math min
|
||||||
|
}
|
||||||
|
|
||||||
|
# Wallpaper's dominant colors, ranked by pixel count (descending). Replaces
|
||||||
|
# the old single 1x1-resize average-color sample, which always produced one
|
||||||
|
# flat blend no matter how many distinct colors the wallpaper actually had.
|
||||||
|
def dominant-colors [path: string, n: int] {
|
||||||
|
let out = (magick $path -resize 100x100 -colors $n +dither -format %c histogram:info:-)
|
||||||
|
$out
|
||||||
|
| lines
|
||||||
|
| parse --regex '(?P<count>\d+):.*#(?P<hex>[0-9A-Fa-f]{6})'
|
||||||
|
| insert count_n { |row| $row.count | into int }
|
||||||
|
| sort-by count_n --reverse
|
||||||
|
| each { |row|
|
||||||
|
let r = ($row.hex | str substring 0..1 | hex-byte)
|
||||||
|
let g = ($row.hex | str substring 2..3 | hex-byte)
|
||||||
|
let b = ($row.hex | str substring 4..5 | hex-byte)
|
||||||
|
{ r: $r, g: $g, b: $b, hsl: (rgb-to-hsl { r: $r, g: $g, b: $b }) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def accent-list [flavor: string] {
|
||||||
|
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)
|
||||||
|
{ name: $name, hsl: (rgb-to-hsl { r: $r, g: $g, b: $b }) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Maps up to `want` of the wallpaper's dominant swatches onto distinct
|
||||||
|
# Catppuccin accent swatches (at least `min_sep` degrees of hue apart), so
|
||||||
|
# the shell gets a coherent multi-accent palette instead of one flat color.
|
||||||
|
# Near-gray swatches (no meaningful hue) are skipped. If the wallpaper
|
||||||
|
# doesn't carry enough distinct hues, remaining slots are filled from a
|
||||||
|
# fixed, pleasant fallback order so the palette never collapses to
|
||||||
|
# monochrome.
|
||||||
|
def pick-accents [flavor: string, swatches: list, want: int, min_sep: float] {
|
||||||
|
let accents = (accent-list $flavor)
|
||||||
|
mut chosen_names = []
|
||||||
|
mut chosen_hues = []
|
||||||
|
|
||||||
|
for sw in $swatches {
|
||||||
|
if ($chosen_names | length) >= $want { continue }
|
||||||
|
if $sw.hsl.s < 0.12 { continue }
|
||||||
|
|
||||||
|
let names_snapshot = $chosen_names
|
||||||
|
let hues_snapshot = $chosen_hues
|
||||||
|
|
||||||
|
let candidates = (
|
||||||
|
$accents
|
||||||
|
| where {|a| not ($names_snapshot | any {|c| $c == $a.name }) }
|
||||||
|
| each {|a|
|
||||||
|
let dists_to_chosen = ($hues_snapshot | each {|ch| hue-dist $a.hsl.h $ch })
|
||||||
|
let min_dist_to_chosen = if ($dists_to_chosen | is-empty) { 999.0 } else { $dists_to_chosen | math min }
|
||||||
|
{ name: $a.name, dist_to_swatch: (hue-dist $sw.hsl.h $a.hsl.h), min_dist_to_chosen: $min_dist_to_chosen }
|
||||||
|
}
|
||||||
|
| where min_dist_to_chosen >= $min_sep
|
||||||
|
| sort-by dist_to_swatch
|
||||||
|
)
|
||||||
|
|
||||||
|
if ($candidates | is-empty) { continue }
|
||||||
|
let pick = ($candidates | first)
|
||||||
|
$chosen_names = ($chosen_names | append $pick.name)
|
||||||
|
$chosen_hues = ($chosen_hues | append (($accents | where name == $pick.name | first).hsl.h))
|
||||||
|
}
|
||||||
|
|
||||||
|
let fallback_order = ["mauve" "sapphire" "peach" "green" "pink" "yellow" "teal" "blue" "flamingo"]
|
||||||
|
for fb in $fallback_order {
|
||||||
|
if ($chosen_names | length) >= $want { continue }
|
||||||
|
if ($chosen_names | any {|c| $c == $fb }) { continue }
|
||||||
|
$chosen_names = ($chosen_names | append $fb)
|
||||||
|
}
|
||||||
|
|
||||||
|
$chosen_names
|
||||||
|
}
|
||||||
|
|
||||||
|
def container-tint [hex: string] {
|
||||||
|
# accent-tinted, ~14% opacity - a soft fill for badges/containers
|
||||||
|
$"#24($hex | str substring 1..)"
|
||||||
|
}
|
||||||
|
|
||||||
|
def write-theme-colors [flavor: string, accent_names: list] {
|
||||||
|
let p = (palette | get $flavor)
|
||||||
|
let primary = ($p.accents | get $accent_names.0)
|
||||||
|
let secondary = ($p.accents | get $accent_names.1)
|
||||||
|
let tertiary = ($p.accents | get $accent_names.2)
|
||||||
|
let info = $p.accents.sapphire
|
||||||
|
let border = $"#1a($primary | 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: \"($primary)\""
|
||||||
|
$" property color secondary: \"($secondary)\""
|
||||||
|
$" property color tertiary: \"($tertiary)\""
|
||||||
|
$" property color accent: \"($primary)\""
|
||||||
|
""
|
||||||
|
$" property color primaryContainer: \"(container-tint $primary)\""
|
||||||
|
$" property color secondaryContainer: \"(container-tint $secondary)\""
|
||||||
|
$" property color tertiaryContainer: \"(container-tint $tertiary)\""
|
||||||
|
""
|
||||||
|
$" property color alert: \"($p.red)\""
|
||||||
|
$" property color alertContainer: \"(container-tint $p.red)\""
|
||||||
|
$" property color success: \"($p.green)\""
|
||||||
|
$" property color successContainer: \"(container-tint $p.green)\""
|
||||||
|
$" property color warning: \"($p.yellow)\""
|
||||||
|
$" property color warningContainer: \"(container-tint $p.yellow)\""
|
||||||
|
$" property color info: \"($info)\""
|
||||||
|
$" property color infoContainer: \"(container-tint $info)\""
|
||||||
|
""
|
||||||
|
$" property color text: \"($p.text)\""
|
||||||
|
$" property color textMuted: \"($p.subtext0)\""
|
||||||
|
$" property color textOnAccent: \"#e6($p.crust | str substring 1..)\""
|
||||||
|
""
|
||||||
|
$" 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 swatches = (dominant-colors $wallpaper_path 8)
|
||||||
|
let top = ($swatches | first)
|
||||||
|
let flavor = (pick-flavor { r: $top.r, g: $top.g, b: $top.b })
|
||||||
|
let accent_names = (pick-accents $flavor $swatches 3 40.0)
|
||||||
|
|
||||||
|
write-theme-colors $flavor $accent_names
|
||||||
|
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
|
|
||||||
}
|
|
||||||
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -57,7 +57,6 @@
|
|||||||
unzip
|
unzip
|
||||||
obsidian
|
obsidian
|
||||||
htop
|
htop
|
||||||
btop
|
|
||||||
mpv
|
mpv
|
||||||
jellytui
|
jellytui
|
||||||
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
|
||||||
@@ -66,6 +65,10 @@
|
|||||||
cliphist
|
cliphist
|
||||||
hyprmod.packages.${pkgs.stdenv.hostPlatform.system}.default
|
hyprmod.packages.${pkgs.stdenv.hostPlatform.system}.default
|
||||||
librepods
|
librepods
|
||||||
|
easyeffects
|
||||||
|
lutris
|
||||||
|
claude-code
|
||||||
|
imagemagick
|
||||||
];
|
];
|
||||||
|
|
||||||
home.file = {
|
home.file = {
|
||||||
@@ -91,6 +94,10 @@
|
|||||||
source = ./agents;
|
source = ./agents;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
};
|
};
|
||||||
|
".claude/skills" = {
|
||||||
|
source = ./agents/skills;
|
||||||
|
recursive = true;
|
||||||
|
};
|
||||||
".pi/agent/settings.json".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/pi/agent/settings.json";
|
".pi/agent/settings.json".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/pi/agent/settings.json";
|
||||||
".pi/extensions".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/pi/extensions";
|
".pi/extensions".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.dotfiles/pi/extensions";
|
||||||
};
|
};
|
||||||
@@ -190,5 +197,10 @@
|
|||||||
colorScheme = "mocha";
|
colorScheme = "mocha";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
programs.btop = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.btop.override { cudaSupport = true; };
|
||||||
|
};
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
DIR="$HOME/Nextcloud/Wallpaper"
|
DIR="$HOME/ownCloud/Personal/Wallpaper"
|
||||||
INTERVAL=300 # seconds between changes
|
INTERVAL=300 # seconds between changes
|
||||||
|
|
||||||
awww init 2>/dev/null
|
awww init 2>/dev/null
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ update_ms = 1000
|
|||||||
|
|
||||||
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
#* Processes sorting, "pid" "program" "arguments" "threads" "user" "memory" "cpu lazy" "cpu direct",
|
||||||
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
#* "cpu lazy" sorts top process over time (easier to follow), "cpu direct" updates top process directly.
|
||||||
proc_sorting = "cpu lazy"
|
proc_sorting = "memory"
|
||||||
|
|
||||||
#* Reverse sorting order, True or False.
|
#* Reverse sorting order, True or False.
|
||||||
proc_reversed = false
|
proc_reversed = false
|
||||||
@@ -192,7 +192,7 @@ show_swap = true
|
|||||||
swap_disk = true
|
swap_disk = true
|
||||||
|
|
||||||
#* If mem box should be split to also show disks info.
|
#* If mem box should be split to also show disks info.
|
||||||
show_disks = true
|
show_disks = false
|
||||||
|
|
||||||
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
|
#* Filter out non physical disks. Set this to False to include network disks, RAM disks and similar.
|
||||||
only_physical = true
|
only_physical = true
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
general {
|
general {
|
||||||
lock_cmd = hyprlock
|
lock_cmd = qs ipc call lockScreen lock
|
||||||
before_sleep_cmd = loginctl lock-session
|
before_sleep_cmd = loginctl lock-session
|
||||||
after_sleep_cmd = hyprctl dispatch dpms on
|
after_sleep_cmd = hyprctl dispatch dpms on
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
-- Generated by HyprMod
|
|
||||||
|
|
||||||
-- Settings
|
|
||||||
hl.config({
|
|
||||||
ecosystem = {
|
|
||||||
enforce_permissions = true,
|
|
||||||
no_donation_nag = true,
|
|
||||||
no_update_news = true,
|
|
||||||
},
|
|
||||||
misc = {
|
|
||||||
animate_mouse_windowdragging = true,
|
|
||||||
disable_splash_rendering = true,
|
|
||||||
vrr = 1,
|
|
||||||
},
|
|
||||||
xwayland = {
|
|
||||||
force_zero_scaling = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Monitors
|
|
||||||
hl.monitor({
|
|
||||||
output = "desc:Samsung Electric Company Odyssey G85SB H1AK500000",
|
|
||||||
disabled = false,
|
|
||||||
mode = "3440x1440@174.96Hz",
|
|
||||||
position = "1920x180",
|
|
||||||
scale = 1,
|
|
||||||
bitdepth = 10,
|
|
||||||
vrr = 1,
|
|
||||||
cm = "hdr",
|
|
||||||
sdrbrightness = 0.5,
|
|
||||||
sdr_min_luminance = 0,
|
|
||||||
sdr_max_luminance = 400,
|
|
||||||
min_luminance = 0,
|
|
||||||
max_luminance = 400,
|
|
||||||
max_avg_luminance = 248,
|
|
||||||
})
|
|
||||||
hl.monitor({
|
|
||||||
output = "desc:Iiyama North America PL2730H 1153680901995",
|
|
||||||
disabled = false,
|
|
||||||
mode = "1920x1080@74.97Hz",
|
|
||||||
position = "0x360",
|
|
||||||
scale = 1,
|
|
||||||
cm = "srgb",
|
|
||||||
})
|
|
||||||
hl.monitor({
|
|
||||||
output = "HDMI-A-2",
|
|
||||||
disabled = true,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Autostart
|
|
||||||
hl.on("hyprland.start", function()
|
|
||||||
hl.exec_cmd("hyprpm reload -n")
|
|
||||||
end)
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
require("hyprland-gui")
|
require("hyprland-gui")
|
||||||
|
|
||||||
local hypr_dir = (os.getenv("XDG_CONFIG_HOME") or (os.getenv("HOME") .. "/.config")) .. "/hypr"
|
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
--- MONITORS ---
|
--- MONITORS ---
|
||||||
@@ -24,10 +24,10 @@ hl.monitor({
|
|||||||
|
|
||||||
local terminal = "ghostty"
|
local terminal = "ghostty"
|
||||||
local fileManager = "nemo"
|
local fileManager = "nemo"
|
||||||
local menu = "qs ipc call appLauncher open"
|
local menu = "quickshell ipc call commandPalette toggle"
|
||||||
local clipboard = "qs ipc call clipboardPicker open"
|
local clipboard = "qs ipc call clipboardPicker open"
|
||||||
local lock = "hyprlock"
|
local lock = "qs ipc call lockScreen lock"
|
||||||
local powermenu = "qs ipc call powerMenu open"
|
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
--- AUTOSTART ---
|
--- AUTOSTART ---
|
||||||
@@ -176,10 +176,11 @@ local mainMod = "SUPER"
|
|||||||
-- Apps
|
-- Apps
|
||||||
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal))
|
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(terminal))
|
||||||
hl.bind(mainMod .. " + Q", hl.dsp.window.close())
|
hl.bind(mainMod .. " + Q", hl.dsp.window.close())
|
||||||
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd(powermenu))
|
hl.bind(mainMod .. " + M", hl.dsp.exec_cmd("quickshell ipc call logoutMenu toggle"))
|
||||||
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager))
|
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager))
|
||||||
hl.bind(mainMod .. " + H", hl.dsp.window.float({ action = "toggle" }))
|
hl.bind(mainMod .. " + H", hl.dsp.window.float({ action = "toggle" }))
|
||||||
hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(menu))
|
hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(menu))
|
||||||
|
hl.bind(mainMod .. " + V", hl.dsp.exec_cmd("quickshell ipc call clipboardManager toggle"))
|
||||||
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
|
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
|
||||||
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ action = "toggle" }))
|
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ action = "toggle" }))
|
||||||
hl.bind(mainMod .. " + L", hl.dsp.exec_cmd(lock))
|
hl.bind(mainMod .. " + L", hl.dsp.exec_cmd(lock))
|
||||||
@@ -191,19 +192,18 @@ hl.bind(mainMod .. " + comma", hl.dsp.layout("move -col"))
|
|||||||
hl.bind(mainMod .. " + SHIFT + period", hl.dsp.layout("swapcol r"))
|
hl.bind(mainMod .. " + SHIFT + period", hl.dsp.layout("swapcol r"))
|
||||||
hl.bind(mainMod .. " + SHIFT + comma", hl.dsp.layout("swapcol l"))
|
hl.bind(mainMod .. " + SHIFT + comma", hl.dsp.layout("swapcol l"))
|
||||||
|
|
||||||
-- Theme / wallpaper switchers
|
-- Wallpaper switcher (drives theme flavor + accent automatically)
|
||||||
hl.bind(mainMod .. " + T", hl.dsp.exec_cmd("qs ipc call themeSwitcher open"))
|
|
||||||
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd("qs ipc call wallpaperSwitcher open"))
|
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"))
|
hl.bind(mainMod .. " + SHIFT + W", hl.dsp.exec_cmd("qs ipc call wallpaperSwitcher random"))
|
||||||
|
|
||||||
-- Brightness
|
-- Brightness
|
||||||
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set 10%-"), { locked = true })
|
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd("brightnessctl set 10%+ && quickshell ipc call osd showBrightness"), { locked = true })
|
||||||
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 10%-"), { locked = true })
|
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd("brightnessctl set 10%- && quickshell ipc call osd showBrightness"), { locked = true })
|
||||||
|
|
||||||
-- Media
|
-- Media
|
||||||
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"), { locked = true })
|
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ && quickshell ipc call osd showVolume"), { locked = true })
|
||||||
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-"), { locked = true })
|
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd("wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%- && quickshell ipc call osd showVolume"), { locked = true })
|
||||||
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"), { locked = true })
|
hl.bind("XF86AudioMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle && quickshell ipc call osd showVolume"), { locked = true })
|
||||||
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true })
|
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"), { locked = true })
|
||||||
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||||
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
hl.bind("XF86AudioPause", hl.dsp.exec_cmd("playerctl play-pause"), { locked = true })
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
../themes/catppuccin/mocha/hypr.conf
|
/home/johannes/.config/themes/catppuccin/mocha/hypr.conf
|
||||||
@@ -1,191 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell.Widgets as QSW
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
FloatingWindow {
|
|
||||||
id: win
|
|
||||||
title: "App Launcher"
|
|
||||||
visible: false
|
|
||||||
implicitWidth: 760
|
|
||||||
implicitHeight: 560
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
property var apps: []
|
|
||||||
property string query: ""
|
|
||||||
property int selectedIndex: 0
|
|
||||||
property bool mouseWasInside: false
|
|
||||||
property var filteredApps: apps.filter(function(app) {
|
|
||||||
const q = query.toLowerCase()
|
|
||||||
return q.length === 0 || app.name.toLowerCase().indexOf(q) >= 0 || app.comment.toLowerCase().indexOf(q) >= 0 || app.id.toLowerCase().indexOf(q) >= 0
|
|
||||||
})
|
|
||||||
|
|
||||||
function shellQuote(s) { return "'" + String(s).replace(/'/g, "'\\''") + "'" }
|
|
||||||
function focusSearch() { Qt.callLater(function() { search.focus = true; search.forceActiveFocus(); search.cursorPosition = search.text.length }) }
|
|
||||||
function clampIndex(index) { if (filteredApps.length === 0) return 0; return Math.max(0, Math.min(filteredApps.length - 1, index)) }
|
|
||||||
function selectIndex(index) { selectedIndex = clampIndex(index) }
|
|
||||||
function open() { mouseWasInside = false; query = ""; visible = true; refresh(); focusSearch() }
|
|
||||||
function toggle() { visible = !visible; if (visible) { mouseWasInside = false; query = ""; refresh(); focusSearch() } }
|
|
||||||
function refresh() { appList.running = true }
|
|
||||||
function launchSelected() {
|
|
||||||
if (filteredApps.length === 0) return
|
|
||||||
const id = filteredApps[selectedIndex].id
|
|
||||||
const path = filteredApps[selectedIndex].path
|
|
||||||
const hist = Quickshell.env("HOME") + "/.cache/quickshell/app-launcher-history"
|
|
||||||
launchProcess.command = ["bash", "-c", "mkdir -p ~/.cache/quickshell; { printf '%s\\n' " + shellQuote(id) + "; grep -vxF " + shellQuote(id) + " " + shellQuote(hist) + " 2>/dev/null | head -n 29; } > " + shellQuote(hist + ".tmp") + " && mv " + shellQuote(hist + ".tmp") + " " + shellQuote(hist) + "; uwsm app " + shellQuote(path) + " > ~/.cache/quickshell/launch.log 2>&1 & disown"]
|
|
||||||
console.log("launching: " + launchProcess.command.join(" "))
|
|
||||||
launchProcess.running = true
|
|
||||||
visible = false
|
|
||||||
}
|
|
||||||
|
|
||||||
onQueryChanged: { selectedIndex = 0; focusSearch() }
|
|
||||||
onFilteredAppsChanged: selectedIndex = clampIndex(selectedIndex)
|
|
||||||
onSelectedIndexChanged: if (visible) Qt.callLater(function() { list.positionViewAtIndex(selectedIndex, ListView.Contain) })
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "appLauncher"
|
|
||||||
function open() { win.open() }
|
|
||||||
function toggle() { win.toggle() }
|
|
||||||
function refresh() { win.refresh() }
|
|
||||||
}
|
|
||||||
|
|
||||||
FocusScope {
|
|
||||||
id: root
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: win.visible
|
|
||||||
|
|
||||||
function handleKey(event) {
|
|
||||||
if (event.text && event.text.length > 0 && event.text >= " " && !(event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier))) {
|
|
||||||
if (!search.activeFocus) {
|
|
||||||
win.query += event.text
|
|
||||||
win.focusSearch()
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (event.key === Qt.Key_Backspace && !search.activeFocus && win.query.length > 0) { win.query = win.query.slice(0, -1); win.focusSearch(); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Down || event.key === Qt.Key_J) { win.selectIndex(win.selectedIndex + 1); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Up || event.key === Qt.Key_K) { win.selectIndex(win.selectedIndex - 1); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { win.launchSelected(); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Escape) { win.visible = false; event.accepted = true }
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onPressed: function(event) { root.handleKey(event) }
|
|
||||||
|
|
||||||
MouseArea { anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton; onEntered: win.mouseWasInside = true; onExited: if (win.mouseWasInside) win.visible = false }
|
|
||||||
Rectangle { anchors.fill: parent; radius: 34; color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13); border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38); border.width: 1 }
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top
|
|
||||||
anchors.margins: 28; height: 52; radius: 21
|
|
||||||
color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.50)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
Text { anchors.left: parent.left; anchors.verticalCenter: parent.verticalCenter; anchors.leftMargin: 16; text: ""; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 5; color: Theme.mauve }
|
|
||||||
TextInput {
|
|
||||||
id: search
|
|
||||||
focus: true
|
|
||||||
activeFocusOnTab: true
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.leftMargin: 50; anchors.rightMargin: 16
|
|
||||||
text: win.query
|
|
||||||
onTextChanged: win.query = text
|
|
||||||
clip: true
|
|
||||||
font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 2
|
|
||||||
color: Theme.text
|
|
||||||
selectionColor: Theme.mauve
|
|
||||||
selectedTextColor: Theme.base
|
|
||||||
Text { visible: search.text.length === 0; text: "Launch app…"; font: search.font; color: Theme.overlay1 }
|
|
||||||
Keys.onPressed: function(event) { root.handleKey(event) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 60
|
|
||||||
repeat: true
|
|
||||||
running: win.visible && !search.activeFocus
|
|
||||||
onTriggered: win.focusSearch()
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: list
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: footer.top
|
|
||||||
anchors.leftMargin: 28; anchors.rightMargin: 28; anchors.topMargin: 96; anchors.bottomMargin: 14
|
|
||||||
model: win.filteredApps
|
|
||||||
spacing: 10
|
|
||||||
clip: true
|
|
||||||
currentIndex: win.selectedIndex
|
|
||||||
delegate: Rectangle {
|
|
||||||
id: card
|
|
||||||
width: list.width
|
|
||||||
height: 68
|
|
||||||
radius: 20
|
|
||||||
color: index === win.selectedIndex ? Qt.rgba(Theme.mauve.r, Theme.mauve.g, Theme.mauve.b, 0.22) : Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.45)
|
|
||||||
border.color: index === win.selectedIndex ? Theme.mauve : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
border.width: index === win.selectedIndex ? 2 : 1
|
|
||||||
antialiasing: true
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.leftMargin: 12
|
|
||||||
width: 44
|
|
||||||
height: 44
|
|
||||||
radius: 14
|
|
||||||
color: Qt.rgba(Theme.surface0.r, Theme.surface0.g, Theme.surface0.b, 0.72)
|
|
||||||
|
|
||||||
QSW.IconImage {
|
|
||||||
id: appIcon
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: 32
|
|
||||||
height: 32
|
|
||||||
source: modelData.icon ? "image://icon/" + modelData.icon : ""
|
|
||||||
asynchronous: true
|
|
||||||
mipmap: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
visible: appIcon.status === Image.Error || appIcon.source === ""
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: modelData.name.length ? modelData.name[0].toUpperCase() : "?"
|
|
||||||
font.family: Theme.fontFamily
|
|
||||||
font.bold: true
|
|
||||||
font.pixelSize: Theme.fontPixelSize + 7
|
|
||||||
color: Theme.mauve
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.leftMargin: 70; anchors.rightMargin: 14
|
|
||||||
spacing: 2
|
|
||||||
Text { Layout.fillWidth: true; text: modelData.name; elide: Text.ElideRight; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 1; font.bold: true; color: Theme.text }
|
|
||||||
Text { Layout.fillWidth: true; text: (modelData.used ? "Recent · " : "") + (modelData.comment || modelData.id); elide: Text.ElideRight; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 2; color: modelData.used ? Theme.green : Theme.overlay2 }
|
|
||||||
}
|
|
||||||
MouseArea { anchors.fill: parent; onClicked: { if (index === win.selectedIndex) win.launchSelected(); else win.selectIndex(index); search.forceActiveFocus() } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: footer
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom
|
|
||||||
anchors.leftMargin: 42; anchors.rightMargin: 42; anchors.bottomMargin: 22
|
|
||||||
height: 44; radius: 18
|
|
||||||
color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
Text { anchors.centerIn: parent; text: win.filteredApps.length + " apps · type search · ↑/↓ select · Enter launch · Esc"; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 2; color: Theme.overlay2 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: appList
|
|
||||||
running: false
|
|
||||||
command: ["python3", "-c", "import configparser,glob,os,json;\nseen={};\nhist_path=os.path.expanduser('~/.cache/quickshell/app-launcher-history');\nhist=[]\ntry:\n hist=[x.strip() for x in open(hist_path, encoding='utf-8') if x.strip()]\nexcept Exception:\n pass\nrank={v:i for i,v in enumerate(hist)}\npaths=[f for d in os.environ.get('XDG_DATA_DIRS', '/usr/share').split(':') + ['~/.local/share'] for f in glob.glob(os.path.expanduser(d)+'/applications/*.desktop')];\nfor p in paths:\n cp=configparser.ConfigParser(interpolation=None); cp.optionxform=str\n try: cp.read(p, encoding='utf-8')\n except Exception: continue\n if not cp.has_section('Desktop Entry'): continue\n d=cp['Desktop Entry']\n if d.get('Type','Application')!='Application' or d.get('NoDisplay','false').lower()=='true' or d.get('Hidden','false').lower()=='true': continue\n name=d.get('Name','').strip()\n if not name: continue\n did=os.path.basename(p)\n appid=did[:-8] if did.endswith('.desktop') else did\n seen[appid]={'id':appid,'path':p,'name':name,'comment':d.get('Comment','').strip(),'icon':d.get('Icon','').strip(),'used': appid in rank}\nprint(json.dumps(sorted(seen.values(), key=lambda x:(rank.get(x['id'],999999), x['name'].lower()))))"]
|
|
||||||
stdout: StdioCollector { onStreamFinished: { try { win.apps = JSON.parse(text) } catch(e) { win.apps = [] }; win.selectedIndex = 0 } }
|
|
||||||
}
|
|
||||||
Process {
|
|
||||||
id: launchProcess
|
|
||||||
running: false
|
|
||||||
command: []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,447 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Io
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: barWindow
|
||||||
|
|
||||||
|
// Reference to global state
|
||||||
|
property QtObject rootState
|
||||||
|
// Shared overlay window that renders tray icon hover tooltips (see
|
||||||
|
// TrayTooltip.qml) so this bar's own surface can stay exactly as tall
|
||||||
|
// as the pill itself.
|
||||||
|
property QtObject trayTooltip
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Matches hyprland.lua's general.gaps_out (20) so the gap above the bar
|
||||||
|
// (this margin) and the gap below it (added by Hyprland once the
|
||||||
|
// exclusiveZone ends) read as the same size.
|
||||||
|
readonly property int hyprGapsOut: 20
|
||||||
|
|
||||||
|
margins {
|
||||||
|
top: hyprGapsOut
|
||||||
|
left: hyprGapsOut
|
||||||
|
right: hyprGapsOut
|
||||||
|
}
|
||||||
|
|
||||||
|
// No separate bottom buffer here — Hyprland's gaps_out already adds its
|
||||||
|
// own gap between the reserved zone and the tiled window below.
|
||||||
|
exclusiveZone: implicitHeight + margins.top
|
||||||
|
|
||||||
|
implicitHeight: 40
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Top
|
||||||
|
WlrLayershell.namespace: "quickshell-bar"
|
||||||
|
|
||||||
|
// Left Pill (Workspaces) - tinted with the primary accent.
|
||||||
|
Pill {
|
||||||
|
id: leftPill
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: parent.height
|
||||||
|
tint: Theme.colors.primary
|
||||||
|
glow: true
|
||||||
|
|
||||||
|
// Workspaces
|
||||||
|
Row {
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
Repeater {
|
||||||
|
model: Hyprland.workspaces.values
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
radius: Theme.geometry.radiusTiny
|
||||||
|
color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: modelData.id
|
||||||
|
color: modelData.active ? Theme.colors.textOnAccent : Theme.colors.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
font.bold: modelData.active
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: modelData.activate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Center Pill (Clock) - tinted with the secondary accent.
|
||||||
|
Pill {
|
||||||
|
id: centerPill
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: parent.height
|
||||||
|
tint: Theme.colors.secondary
|
||||||
|
glow: true
|
||||||
|
|
||||||
|
SystemClock {
|
||||||
|
id: clock
|
||||||
|
precision: SystemClock.Minutes
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: clockText
|
||||||
|
text: Qt.formatDateTime(clock.date, "hh:mm")
|
||||||
|
color: Theme.colors.secondary
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Right Pill (System tray: CPU/RAM/temp stats, WiFi, Bluetooth, Battery)
|
||||||
|
// Tinted with the tertiary accent; each stat/icon also carries its own
|
||||||
|
// color so the pill reads as a set of distinct signals, not one blob.
|
||||||
|
Pill {
|
||||||
|
id: rightPill
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
height: parent.height
|
||||||
|
tint: Theme.colors.tertiary
|
||||||
|
|
||||||
|
StatIndicator {
|
||||||
|
glyph: "" // nf-fa-microchip
|
||||||
|
text: sysStats.cpuPercent + "%"
|
||||||
|
tint: Theme.colors.tertiary
|
||||||
|
tooltip: "CPU usage: " + sysStats.cpuPercent + "%"
|
||||||
|
tooltipWindow: barWindow.trayTooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
StatIndicator {
|
||||||
|
visible: sysStats.cpuTemp.length > 0
|
||||||
|
glyph: "" // nf-fa-thermometer_half
|
||||||
|
text: sysStats.cpuTemp + "°"
|
||||||
|
tint: {
|
||||||
|
let t = Number(sysStats.cpuTemp);
|
||||||
|
if (t >= 80) return Theme.colors.alert;
|
||||||
|
if (t >= 65) return Theme.colors.warning;
|
||||||
|
return Theme.colors.textMuted;
|
||||||
|
}
|
||||||
|
tooltip: "CPU temp: " + sysStats.cpuTemp + "°C"
|
||||||
|
tooltipWindow: barWindow.trayTooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
StatIndicator {
|
||||||
|
glyph: "" // nf-fa-server
|
||||||
|
text: sysStats.ramPercent + "%"
|
||||||
|
tint: Theme.colors.secondary
|
||||||
|
tooltip: "RAM usage: " + sysStats.ramPercent + "%"
|
||||||
|
tooltipWindow: barWindow.trayTooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
TrayIcon {
|
||||||
|
glyph: "" // nf-fa-wifi
|
||||||
|
active: wifiPoll.connected
|
||||||
|
tint: Theme.colors.primary
|
||||||
|
tooltip: "WiFi: " + wifiPoll.ssid
|
||||||
|
visible: wifiPoll.connected
|
||||||
|
tooltipWindow: barWindow.trayTooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
TrayIcon {
|
||||||
|
glyph: "" // nf-fa-bluetooth_b
|
||||||
|
active: true
|
||||||
|
tint: Theme.colors.secondary
|
||||||
|
tooltip: "Bluetooth: " + bluetoothPoll.connectedDevices
|
||||||
|
visible: bluetoothPoll.connectedDevices.length > 0
|
||||||
|
tooltipWindow: barWindow.trayTooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
TrayIcon {
|
||||||
|
glyph: {
|
||||||
|
let p = battery.percentage;
|
||||||
|
if (!battery.isPresent) return ""; // nf-fa-plug (desktop/no battery)
|
||||||
|
if (p >= 0.9) return ""; // nf-fa-battery_full
|
||||||
|
if (p >= 0.65) return ""; // nf-fa-battery_three_quarters
|
||||||
|
if (p >= 0.4) return ""; // nf-fa-battery_half
|
||||||
|
if (p >= 0.15) return ""; // nf-fa-battery_quarter
|
||||||
|
return ""; // nf-fa-battery_empty
|
||||||
|
}
|
||||||
|
active: battery.state === UPowerDeviceState.Charging
|
||||||
|
tint: {
|
||||||
|
let p = battery.percentage;
|
||||||
|
if (p >= 0.5) return Theme.colors.success;
|
||||||
|
if (p >= 0.2) return Theme.colors.warning;
|
||||||
|
return Theme.colors.alert;
|
||||||
|
}
|
||||||
|
tooltip: battery.isPresent
|
||||||
|
? "Battery: " + Math.round(battery.percentage * 100) + "%"
|
||||||
|
+ (battery.state === UPowerDeviceState.Charging ? " (charging)" : "")
|
||||||
|
: "No battery"
|
||||||
|
visible: battery.isPresent
|
||||||
|
tooltipWindow: barWindow.trayTooltip
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject battery: UPower.displayDevice
|
||||||
|
|
||||||
|
// --- System stats (CPU%, CPU temp, RAM%) read straight from /proc and /sys ---
|
||||||
|
QtObject {
|
||||||
|
id: sysStats
|
||||||
|
property string cpuPercent: "0"
|
||||||
|
property string cpuTemp: ""
|
||||||
|
property string ramPercent: "0"
|
||||||
|
|
||||||
|
// Previous /proc/stat totals, for computing CPU% as a delta between polls.
|
||||||
|
property real prevTotal: -1
|
||||||
|
property real prevIdle: -1
|
||||||
|
}
|
||||||
|
|
||||||
|
FileView { id: statFile; path: "/proc/stat" }
|
||||||
|
FileView { id: memInfoFile; path: "/proc/meminfo" }
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 1000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: {
|
||||||
|
statFile.reload();
|
||||||
|
memInfoFile.reload();
|
||||||
|
|
||||||
|
// First line: "cpu user nice system idle iowait irq softirq ..."
|
||||||
|
let fields = statFile.text().split("\n")[0].trim().split(/\s+/).slice(1).map(Number);
|
||||||
|
let idle = fields[3] + fields[4];
|
||||||
|
let total = fields.reduce((a, b) => a + b, 0);
|
||||||
|
|
||||||
|
if (sysStats.prevTotal >= 0) {
|
||||||
|
let totalDelta = total - sysStats.prevTotal;
|
||||||
|
let idleDelta = idle - sysStats.prevIdle;
|
||||||
|
sysStats.cpuPercent = totalDelta > 0
|
||||||
|
? Math.round(100 * (totalDelta - idleDelta) / totalDelta).toString()
|
||||||
|
: "0";
|
||||||
|
}
|
||||||
|
sysStats.prevTotal = total;
|
||||||
|
sysStats.prevIdle = idle;
|
||||||
|
|
||||||
|
let mem = {};
|
||||||
|
for (const line of memInfoFile.text().split("\n")) {
|
||||||
|
let match = line.match(/^(\w+):\s+(\d+)/);
|
||||||
|
if (match) mem[match[1]] = Number(match[2]);
|
||||||
|
}
|
||||||
|
sysStats.ramPercent = mem.MemTotal > 0
|
||||||
|
? Math.round(100 * (mem.MemTotal - mem.MemAvailable) / mem.MemTotal).toString()
|
||||||
|
: "0";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Discover the CPU temp sensor's hwmon path once (the hwmonN numbering
|
||||||
|
// isn't stable across boots), then poll that fixed path via FileView.
|
||||||
|
FileView { id: cpuTempFile; watchChanges: false }
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: hwmonDiscovery
|
||||||
|
command: ["bash", "-c", "for h in /sys/class/hwmon/hwmon*; do n=$(cat \"$h/name\" 2>/dev/null); if [ \"$n\" = k10temp ] || [ \"$n\" = coretemp ] || [ \"$n\" = zenpower ]; then echo \"$h/temp1_input\"; break; fi; done"]
|
||||||
|
running: true
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
let path = this.text.trim();
|
||||||
|
if (path.length > 0) cpuTempFile.path = path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 1000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: {
|
||||||
|
if (cpuTempFile.path.length === 0) return;
|
||||||
|
cpuTempFile.reload();
|
||||||
|
let millideg = Number(cpuTempFile.text().trim());
|
||||||
|
if (millideg > 0) sysStats.cpuTemp = Math.round(millideg / 1000).toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- WiFi status (polled via nmcli; requires NetworkManager) ---
|
||||||
|
QtObject {
|
||||||
|
id: wifiPoll
|
||||||
|
property bool connected: false
|
||||||
|
property string ssid: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 5000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: wifiProcess.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: wifiProcess
|
||||||
|
command: ["bash", "-c", "nmcli -t -f ACTIVE,SSID dev wifi 2>/dev/null | awk -F: '$1==\"yes\"{print $2; exit}'"]
|
||||||
|
running: false
|
||||||
|
function restart() { running = false; running = true; }
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
let ssid = this.text.trim();
|
||||||
|
wifiPoll.connected = ssid.length > 0;
|
||||||
|
wifiPoll.ssid = ssid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Bluetooth status (polled via bluetoothctl) ---
|
||||||
|
QtObject {
|
||||||
|
id: bluetoothPoll
|
||||||
|
property bool available: true
|
||||||
|
property bool powered: false
|
||||||
|
property string connectedDevices: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
interval: 5000
|
||||||
|
running: true
|
||||||
|
repeat: true
|
||||||
|
triggeredOnStart: true
|
||||||
|
onTriggered: bluetoothProcess.restart()
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: bluetoothProcess
|
||||||
|
command: ["bash", "-c", "powered=$(bluetoothctl show 2>/dev/null | awk -F': ' '/Powered/{print $2}'); devices=$(bluetoothctl devices Connected 2>/dev/null | sed -E 's/^Device [0-9A-F:]+ //' | paste -sd, -); echo \"$powered|$devices\""]
|
||||||
|
running: false
|
||||||
|
function restart() { running = false; running = true; }
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
let parts = this.text.trim().split("|");
|
||||||
|
if (parts[0] === undefined || parts[0] === "") {
|
||||||
|
bluetoothPoll.available = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bluetoothPoll.available = true;
|
||||||
|
bluetoothPoll.powered = parts[0] === "yes";
|
||||||
|
bluetoothPoll.connectedDevices = parts[1] || "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inline component for a compact icon+text stat readout (CPU, temp, RAM).
|
||||||
|
// `tint` colors both the glyph and text, so each stat reads as its own
|
||||||
|
// signal instead of everything sharing one flat color.
|
||||||
|
component StatIndicator: Item {
|
||||||
|
id: statIndicator
|
||||||
|
property string glyph: ""
|
||||||
|
property alias text: statText.text
|
||||||
|
property color tint: Theme.colors.text
|
||||||
|
property string tooltip: ""
|
||||||
|
property QtObject tooltipWindow
|
||||||
|
|
||||||
|
width: statRow.width
|
||||||
|
height: 24
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: statRow
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: 4
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: statIndicator.glyph
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
color: statIndicator.tint
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: statText
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
color: statIndicator.tint
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: {
|
||||||
|
if (statIndicator.tooltipWindow && statIndicator.tooltip.length > 0) {
|
||||||
|
let pos = statIndicator.mapToGlobal(statIndicator.width / 2, statIndicator.height + Theme.geometry.spacing / 2);
|
||||||
|
statIndicator.tooltipWindow.showAt(pos.x, pos.y, statIndicator.tooltip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
if (statIndicator.tooltipWindow) statIndicator.tooltipWindow.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inline component for a hoverable tray icon. The tooltip itself is
|
||||||
|
// rendered by the shared TrayTooltip overlay window (see tooltipWindow)
|
||||||
|
// so it isn't clipped by this bar's small surface. `tint` is this icon's
|
||||||
|
// own identity color (wifi vs bluetooth vs battery-by-level, etc.).
|
||||||
|
component TrayIcon: Item {
|
||||||
|
id: trayIcon
|
||||||
|
property string glyph: ""
|
||||||
|
property string tooltip: ""
|
||||||
|
property bool active: false
|
||||||
|
property color tint: Theme.colors.primary
|
||||||
|
property QtObject tooltipWindow
|
||||||
|
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
radius: Theme.geometry.radiusTiny
|
||||||
|
color: hoverArea.containsMouse
|
||||||
|
? Theme.colors.surfaceHover
|
||||||
|
: (trayIcon.active ? Qt.alpha(trayIcon.tint, 0.15) : "transparent")
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: trayIcon.glyph
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
color: trayIcon.active ? trayIcon.tint : Theme.colors.text
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: hoverArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
onEntered: {
|
||||||
|
if (trayIcon.tooltipWindow && trayIcon.tooltip.length > 0) {
|
||||||
|
// Anchor on the icon's horizontal center; the tooltip
|
||||||
|
// window centers its bubble under this point itself.
|
||||||
|
let pos = trayIcon.mapToGlobal(trayIcon.width / 2, trayIcon.height + Theme.geometry.spacing / 2);
|
||||||
|
trayIcon.tooltipWindow.showAt(pos.x, pos.y, trayIcon.tooltip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
if (trayIcon.tooltipWindow) trayIcon.tooltipWindow.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
// Full-screen, click-through overlay used to render tray icon tooltips.
|
||||||
|
// Kept as its own window so the Bar's own surface can stay exactly as tall
|
||||||
|
// as the pill itself (no shadow/margin bloat from an oversized surface).
|
||||||
|
PanelWindow {
|
||||||
|
id: tooltipWindow
|
||||||
|
|
||||||
|
property string shownText: ""
|
||||||
|
property real anchorX: 0
|
||||||
|
property real anchorY: 0
|
||||||
|
|
||||||
|
function showAt(x, y, text) {
|
||||||
|
anchorX = x;
|
||||||
|
anchorY = y;
|
||||||
|
shownText = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide() {
|
||||||
|
shownText = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
bottom: true
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
color: "transparent"
|
||||||
|
visible: shownText.length > 0
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "quickshell-tray-tooltip"
|
||||||
|
|
||||||
|
// Never accept input; this window only ever draws a small label.
|
||||||
|
mask: Region {}
|
||||||
|
|
||||||
|
Tooltip {
|
||||||
|
// anchorX is the icon's horizontal center; center this bubble on it,
|
||||||
|
// clamped so it never runs past the screen edges.
|
||||||
|
x: Math.max(
|
||||||
|
Theme.geometry.spacing,
|
||||||
|
Math.min(tooltipWindow.anchorX - width / 2, tooltipWindow.width - width - Theme.geometry.spacing)
|
||||||
|
)
|
||||||
|
y: tooltipWindow.anchorY
|
||||||
|
text: tooltipWindow.shownText
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,279 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Io
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: clipboardWindow
|
||||||
|
property QtObject rootState
|
||||||
|
|
||||||
|
readonly property int headerHeight: 50
|
||||||
|
readonly property int footerHeight: 24
|
||||||
|
readonly property int emptyStateHeight: 40
|
||||||
|
|
||||||
|
visible: rootState.clipboardManagerOpen
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
bottom: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "quickshell-clipboard"
|
||||||
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: backdrop
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: rootState.clipboardManagerOpen = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Surface {
|
||||||
|
id: container
|
||||||
|
width: 800
|
||||||
|
height: Math.min(600,
|
||||||
|
headerHeight + Theme.geometry.spacing
|
||||||
|
+ (clipModel.count > 0 ? clipList.contentHeight : emptyStateHeight) + Theme.geometry.spacing
|
||||||
|
+ footerHeight
|
||||||
|
+ Theme.geometry.padding * 2)
|
||||||
|
anchors.centerIn: parent
|
||||||
|
tint: Theme.colors.secondary
|
||||||
|
glow: true
|
||||||
|
|
||||||
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } }
|
||||||
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } }
|
||||||
|
|
||||||
|
opacity: rootState.clipboardManagerOpen ? 1 : 0
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.geometry.padding
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: searchInput
|
||||||
|
width: parent.width
|
||||||
|
height: clipboardWindow.headerHeight
|
||||||
|
placeholder: "Search clipboard..."
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) focusInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
loadProcess.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
onEscapePressed: {
|
||||||
|
rootState.clipboardManagerOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
onUpPressed: {
|
||||||
|
if (clipList.currentIndex > 0) {
|
||||||
|
clipList.currentIndex--;
|
||||||
|
clipList.positionViewAtIndex(clipList.currentIndex, ListView.Contain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDownPressed: {
|
||||||
|
if (clipList.currentIndex < clipList.count - 1) {
|
||||||
|
clipList.currentIndex++;
|
||||||
|
clipList.positionViewAtIndex(clipList.currentIndex, ListView.Contain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onReturnPressed: {
|
||||||
|
if (clipList.currentIndex >= 0 && clipList.currentIndex < clipModel.count) {
|
||||||
|
let item = clipModel.get(clipList.currentIndex);
|
||||||
|
copyToClipboard(item.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDeleteRequested: {
|
||||||
|
if (clipList.currentIndex >= 0 && clipList.currentIndex < clipModel.count) {
|
||||||
|
let item = clipModel.get(clipList.currentIndex);
|
||||||
|
deleteFromClipboard(item.id, item.rawLine, clipList.currentIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
height: clipboardWindow.emptyStateHeight
|
||||||
|
visible: clipModel.count === 0
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: searchInput.text.length > 0 ? "No clipboard entries match “" + searchInput.text + "”" : "Clipboard is empty"
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: clipList
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - clipboardWindow.headerHeight - clipboardWindow.footerHeight - Theme.geometry.spacing * 2
|
||||||
|
visible: clipModel.count > 0
|
||||||
|
clip: true
|
||||||
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
|
||||||
|
model: ListModel { id: clipModel }
|
||||||
|
|
||||||
|
delegate: ListRow {
|
||||||
|
id: clipRow
|
||||||
|
width: clipList.width
|
||||||
|
selected: ListView.isCurrentItem
|
||||||
|
accent: Theme.colors.secondary
|
||||||
|
|
||||||
|
onEntered: clipList.currentIndex = index
|
||||||
|
onClicked: (mouse) => {
|
||||||
|
clipList.currentIndex = index;
|
||||||
|
if (mouse.button === Qt.RightButton) {
|
||||||
|
let pos = mapToItem(backdrop, mouse.x, mouse.y);
|
||||||
|
let itemId = model.id;
|
||||||
|
let rawLine = model.rawLine;
|
||||||
|
let itemIndex = index;
|
||||||
|
contextMenu.model = [
|
||||||
|
{ label: "Copy", icon: "", action: function() { copyToClipboard(itemId); } },
|
||||||
|
{ separator: true },
|
||||||
|
{ label: "Delete", icon: "", destructive: true, action: function() { deleteFromClipboard(itemId, rawLine, itemIndex); } }
|
||||||
|
];
|
||||||
|
contextMenu.openAt(pos.x, pos.y);
|
||||||
|
} else {
|
||||||
|
copyToClipboard(model.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: model.content
|
||||||
|
color: Theme.colors.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.label
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: deleteButton.left
|
||||||
|
anchors.rightMargin: Theme.geometry.spacing
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: deleteButton
|
||||||
|
text: ""
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
color: deleteMouse.containsMouse ? Theme.colors.alert : Theme.colors.textMuted
|
||||||
|
opacity: clipRow.hovered ? 1 : 0
|
||||||
|
|
||||||
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: deleteMouse
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -6
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: deleteFromClipboard(model.id, model.rawLine, index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HintBar {
|
||||||
|
width: parent.width
|
||||||
|
height: clipboardWindow.footerHeight
|
||||||
|
hints: [
|
||||||
|
{ key: "↵", label: "Copy" },
|
||||||
|
{ key: "Del", label: "Delete" },
|
||||||
|
{ key: "Esc", label: "Close" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
visible: contextMenu.visible
|
||||||
|
z: 999
|
||||||
|
onClicked: contextMenu.close()
|
||||||
|
}
|
||||||
|
|
||||||
|
ContextMenu {
|
||||||
|
id: contextMenu
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: loadProcess
|
||||||
|
command: [
|
||||||
|
"bash", "-c",
|
||||||
|
"cliphist list | ( [ -z \"$1\" ] && cat || rg -i \"$1\" ) | head -n 50",
|
||||||
|
"_", searchInput.text
|
||||||
|
]
|
||||||
|
running: false
|
||||||
|
function restart() { running = false; running = true; }
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
let lines = this.text.split('\n').filter(l => l.trim() !== "");
|
||||||
|
clipModel.clear();
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let firstTab = lines[i].indexOf('\t');
|
||||||
|
if (firstTab !== -1) {
|
||||||
|
let id = lines[i].substring(0, firstTab);
|
||||||
|
// Clean up newlines for multiline strings natively copied
|
||||||
|
let content = lines[i].substring(firstTab + 1).replace(/\n/g, ' ').replace(/\\n/g, ' ');
|
||||||
|
clipModel.append({ "id": id, "content": content, "rawLine": lines[i] });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clipList.currentIndex = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: actionProcess
|
||||||
|
running: false
|
||||||
|
function execute(cmdArray) {
|
||||||
|
command = cmdArray;
|
||||||
|
running = false;
|
||||||
|
running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyToClipboard(id) {
|
||||||
|
actionProcess.execute(["bash", "-c", "cliphist decode '" + id + "' | wl-copy"]);
|
||||||
|
rootState.clipboardManagerOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteFromClipboard(id, rawLine, index) {
|
||||||
|
actionProcess.execute(["bash", "-c", "printf '%s\\n' \"$1\" | cliphist delete", "_", rawLine]);
|
||||||
|
clipModel.remove(index);
|
||||||
|
if (clipList.currentIndex >= clipModel.count) {
|
||||||
|
clipList.currentIndex = Math.max(0, clipModel.count - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
container.scale = 1.0;
|
||||||
|
searchInput.text = "";
|
||||||
|
clipModel.clear();
|
||||||
|
loadProcess.restart();
|
||||||
|
} else {
|
||||||
|
container.scale = 0.95;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
FloatingWindow {
|
|
||||||
id: win
|
|
||||||
title: "Clipboard Picker"
|
|
||||||
visible: false
|
|
||||||
implicitWidth: 760
|
|
||||||
implicitHeight: 520
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
property var items: []
|
|
||||||
property string query: ""
|
|
||||||
property int selectedIndex: 0
|
|
||||||
property bool mouseWasInside: false
|
|
||||||
property var filteredItems: items.filter(function(x) { return query.length === 0 || x.toLowerCase().indexOf(query.toLowerCase()) >= 0 })
|
|
||||||
|
|
||||||
function shellQuote(s) { return "'" + String(s).replace(/'/g, "'\\''") + "'" }
|
|
||||||
function focusSearch() { Qt.callLater(function() { search.focus = true; search.forceActiveFocus(); search.cursorPosition = search.text.length }) }
|
|
||||||
function clampIndex(index) { if (filteredItems.length === 0) return 0; return Math.max(0, Math.min(filteredItems.length - 1, index)) }
|
|
||||||
function selectIndex(index) { selectedIndex = clampIndex(index) }
|
|
||||||
function open() { mouseWasInside = false; query = ""; visible = true; refresh(); focusSearch() }
|
|
||||||
function toggle() { visible = !visible; if (visible) { mouseWasInside = false; query = ""; refresh(); focusSearch() } }
|
|
||||||
function refresh() { listProcess.running = true }
|
|
||||||
function choose() {
|
|
||||||
if (filteredItems.length === 0) return
|
|
||||||
copyProcess.command = ["bash", "-lc", "printf %s " + shellQuote(filteredItems[selectedIndex]) + " | cliphist decode | wl-copy"]
|
|
||||||
copyProcess.running = true
|
|
||||||
visible = false
|
|
||||||
}
|
|
||||||
function removeSelected() {
|
|
||||||
if (filteredItems.length === 0) return
|
|
||||||
deleteProcess.command = ["bash", "-lc", "printf %s " + shellQuote(filteredItems[selectedIndex]) + " | cliphist delete"]
|
|
||||||
deleteProcess.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
onQueryChanged: { selectedIndex = 0; focusSearch() }
|
|
||||||
onFilteredItemsChanged: selectedIndex = clampIndex(selectedIndex)
|
|
||||||
onSelectedIndexChanged: if (visible) Qt.callLater(function() { list.positionViewAtIndex(selectedIndex, ListView.Contain) })
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "clipboardPicker"
|
|
||||||
function open() { win.open() }
|
|
||||||
function toggle() { win.toggle() }
|
|
||||||
function refresh() { win.refresh() }
|
|
||||||
}
|
|
||||||
|
|
||||||
FocusScope {
|
|
||||||
id: root
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: win.visible
|
|
||||||
|
|
||||||
function handleKey(event) {
|
|
||||||
if (event.text && event.text.length > 0 && event.text >= " " && !(event.modifiers & (Qt.ControlModifier | Qt.AltModifier | Qt.MetaModifier))) {
|
|
||||||
if (!search.activeFocus) {
|
|
||||||
win.query += event.text
|
|
||||||
win.focusSearch()
|
|
||||||
event.accepted = true
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (event.key === Qt.Key_Down || event.key === Qt.Key_J) { win.selectIndex(win.selectedIndex + 1); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Up || event.key === Qt.Key_K) { win.selectIndex(win.selectedIndex - 1); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { win.choose(); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Delete || event.key === Qt.Key_Backspace) {
|
|
||||||
if (event.key === Qt.Key_Backspace && search.activeFocus && search.text.length > 0) return
|
|
||||||
win.removeSelected(); event.accepted = true
|
|
||||||
}
|
|
||||||
else if (event.key === Qt.Key_Escape) { win.visible = false; event.accepted = true }
|
|
||||||
}
|
|
||||||
|
|
||||||
Keys.onPressed: function(event) { root.handleKey(event) }
|
|
||||||
|
|
||||||
MouseArea { anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton; onEntered: win.mouseWasInside = true; onExited: if (win.mouseWasInside) win.visible = false }
|
|
||||||
Rectangle { anchors.fill: parent; radius: 34; color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13); border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38); border.width: 1 }
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top
|
|
||||||
anchors.margins: 28; height: 48; radius: 20
|
|
||||||
color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.50)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
Text { anchors.left: parent.left; anchors.verticalCenter: parent.verticalCenter; anchors.leftMargin: 16; text: ""; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 3; color: Theme.mauve }
|
|
||||||
TextInput {
|
|
||||||
id: search
|
|
||||||
focus: true
|
|
||||||
activeFocusOnTab: true
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.leftMargin: 48; anchors.rightMargin: 16
|
|
||||||
text: win.query
|
|
||||||
onTextChanged: win.query = text
|
|
||||||
clip: true
|
|
||||||
font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 1
|
|
||||||
color: Theme.text
|
|
||||||
selectionColor: Theme.mauve
|
|
||||||
selectedTextColor: Theme.base
|
|
||||||
Text { visible: search.text.length === 0; text: "Search clipboard…"; font: search.font; color: Theme.overlay1 }
|
|
||||||
Keys.onPressed: function(event) { root.handleKey(event) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 60
|
|
||||||
repeat: true
|
|
||||||
running: win.visible && !search.activeFocus
|
|
||||||
onTriggered: win.focusSearch()
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: list
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top; anchors.bottom: footer.top
|
|
||||||
anchors.leftMargin: 28; anchors.rightMargin: 28; anchors.topMargin: 90; anchors.bottomMargin: 14
|
|
||||||
model: win.filteredItems
|
|
||||||
spacing: 10
|
|
||||||
clip: true
|
|
||||||
currentIndex: win.selectedIndex
|
|
||||||
delegate: Rectangle {
|
|
||||||
id: card
|
|
||||||
width: list.width
|
|
||||||
height: 62
|
|
||||||
radius: 18
|
|
||||||
color: index === win.selectedIndex ? Qt.rgba(Theme.mauve.r, Theme.mauve.g, Theme.mauve.b, 0.22) : Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.45)
|
|
||||||
border.color: index === win.selectedIndex ? Theme.mauve : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
border.width: index === win.selectedIndex ? 2 : 1
|
|
||||||
antialiasing: true
|
|
||||||
Text {
|
|
||||||
anchors.fill: parent; anchors.margins: 14
|
|
||||||
text: String(modelData).replace(/^\S+\s+/, "")
|
|
||||||
elide: Text.ElideRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize
|
|
||||||
color: Theme.text
|
|
||||||
}
|
|
||||||
MouseArea { anchors.fill: parent; onClicked: { if (index === win.selectedIndex) win.choose(); else win.selectIndex(index); search.forceActiveFocus() } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: footer
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom
|
|
||||||
anchors.leftMargin: 42; anchors.rightMargin: 42; anchors.bottomMargin: 22
|
|
||||||
height: 44; radius: 18
|
|
||||||
color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
Text { anchors.centerIn: parent; text: win.filteredItems.length + " items · type search · ↑/↓ select · Enter copy · Backspace remove · Esc"; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 2; color: Theme.overlay2 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: listProcess
|
|
||||||
command: ["bash", "-lc", "cliphist list 2>/dev/null || true"]
|
|
||||||
running: false
|
|
||||||
stdout: StdioCollector { onStreamFinished: { win.items = text.trim().length ? text.trim().split('\n') : []; win.selectedIndex = 0 } }
|
|
||||||
}
|
|
||||||
Process { id: copyProcess; running: false }
|
|
||||||
Process { id: deleteProcess; running: false; onExited: win.refresh() }
|
|
||||||
}
|
|
||||||
@@ -1,142 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import Quickshell.Services.Mpris
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
ModuleContainer {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
// Initial state
|
|
||||||
text: "00:00"
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 1000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: {
|
|
||||||
var d = new Date();
|
|
||||||
var h = d.getHours().toString().padStart(2, '0');
|
|
||||||
var m = d.getMinutes().toString().padStart(2, '0');
|
|
||||||
root.text = h + ":" + m;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
property MprisPlayer mprisPlayer: Mpris.players.values[0] || null
|
|
||||||
|
|
||||||
// Embed the MPRIS Popup natively into the pill's slot
|
|
||||||
popupItem: PopupWindow {
|
|
||||||
id: mprisPopup
|
|
||||||
implicitWidth: 320
|
|
||||||
implicitHeight: 90
|
|
||||||
|
|
||||||
anchor.item: root
|
|
||||||
anchor.edges: Edges.Bottom
|
|
||||||
anchor.gravity: Edges.Bottom
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
color: Theme.bg
|
|
||||||
radius: Theme.radius
|
|
||||||
border.color: Theme.bgAlt
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Theme.padding
|
|
||||||
spacing: Theme.padding
|
|
||||||
|
|
||||||
TapHandler {
|
|
||||||
acceptedButtons: Qt.RightButton
|
|
||||||
onTapped: if (root.mprisPlayer) root.mprisPlayer.next()
|
|
||||||
}
|
|
||||||
|
|
||||||
TapHandler {
|
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
onTapped: if (root.mprisPlayer) root.mprisPlayer.previous()
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
Layout.preferredWidth: 64
|
|
||||||
Layout.preferredHeight: 64
|
|
||||||
radius: Theme.radius
|
|
||||||
color: Theme.bgAlt
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Image {
|
|
||||||
anchors.fill: parent
|
|
||||||
source: root.mprisPlayer && root.mprisPlayer.trackArtUrl ? root.mprisPlayer.trackArtUrl : ""
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
visible: root.mprisPlayer && root.mprisPlayer.trackArtUrl !== ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback icon when no art
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: "♪"
|
|
||||||
font.pixelSize: 24
|
|
||||||
visible: !root.mprisPlayer || !root.mprisPlayer.trackArtUrl || root.mprisPlayer.trackArtUrl === ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: root.mprisPlayer && root.mprisPlayer.playbackState === MprisPlaybackState.Playing
|
|
||||||
? "Now Playing"
|
|
||||||
: (root.mprisPlayer ? "Paused" : "Nothing playing")
|
|
||||||
color: Theme.fgAlt
|
|
||||||
font: Theme.font
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
id: mprisText
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: root.mprisPlayer && root.mprisPlayer.trackTitle !== ""
|
|
||||||
? root.mprisPlayer.trackTitle
|
|
||||||
: "No Track"
|
|
||||||
color: Theme.fg
|
|
||||||
font: Theme.fontBold
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: root.mprisPlayer && root.mprisPlayer.trackArtist !== ""
|
|
||||||
? root.mprisPlayer.trackArtist
|
|
||||||
: "Unknown Artist"
|
|
||||||
color: Theme.fgAlt
|
|
||||||
font: Theme.font
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
|
|
||||||
Item { Layout.fillHeight: true } // spacer
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 4
|
|
||||||
radius: 2
|
|
||||||
color: Theme.bgAlt
|
|
||||||
visible: root.mprisPlayer && root.mprisPlayer.length > 0
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
height: parent.height
|
|
||||||
radius: 2
|
|
||||||
color: Theme.primary
|
|
||||||
width: root.mprisPlayer && root.mprisPlayer.length > 0
|
|
||||||
? parent.width * (root.mprisPlayer.position / root.mprisPlayer.length)
|
|
||||||
: 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,351 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Services.Pipewire
|
||||||
|
import Quickshell.Io
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: paletteWindow
|
||||||
|
property QtObject rootState
|
||||||
|
property bool enterQueued: false
|
||||||
|
property var usageCounts: ({})
|
||||||
|
property string lastUsedApp: ""
|
||||||
|
property var allApps: []
|
||||||
|
property bool appsLoaded: false
|
||||||
|
|
||||||
|
function scoreOf(desktopName) {
|
||||||
|
let count = paletteWindow.usageCounts[desktopName] || 0;
|
||||||
|
let isLast = (desktopName === paletteWindow.lastUsedApp);
|
||||||
|
return count * 10 + (isLast ? 10000 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyFilter() {
|
||||||
|
let query = searchInput.text.trim().toLowerCase();
|
||||||
|
let results = query.length === 0
|
||||||
|
? paletteWindow.allApps.slice()
|
||||||
|
: paletteWindow.allApps.filter(a => a.appName.toLowerCase().includes(query));
|
||||||
|
|
||||||
|
results.sort((a, b) => {
|
||||||
|
if (b.score !== a.score) return b.score - a.score;
|
||||||
|
return a.appName.localeCompare(b.appName);
|
||||||
|
});
|
||||||
|
|
||||||
|
results = results.slice(0, 50);
|
||||||
|
|
||||||
|
appModel.clear();
|
||||||
|
for (let i = 0; i < results.length; i++) {
|
||||||
|
appModel.append(results[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
appList.currentIndex = appModel.count > 0 ? 0 : -1;
|
||||||
|
|
||||||
|
if (paletteWindow.enterQueued && appModel.count > 0) {
|
||||||
|
paletteWindow.enterQueued = false;
|
||||||
|
paletteWindow.launchApp(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property int headerHeight: 50
|
||||||
|
readonly property int footerHeight: 24
|
||||||
|
readonly property int emptyStateHeight: 40
|
||||||
|
|
||||||
|
function launchApp(index) {
|
||||||
|
if (index < 0 || index >= appModel.count) return;
|
||||||
|
let item = appModel.get(index);
|
||||||
|
let desktopName = item.desktopName;
|
||||||
|
let appPath = item.appPath;
|
||||||
|
|
||||||
|
logHistoryProcess.command = ["bash", "-c", "echo '" + desktopName + "' >> ~/.cache/quickshell-app-history.txt"];
|
||||||
|
logHistoryProcess.restart();
|
||||||
|
|
||||||
|
launchProcess.command = [
|
||||||
|
"bash", "-c",
|
||||||
|
"EXEC=$(awk -F= '/^Exec=/ {print $2; exit}' \"$1\" | sed 's/ %[a-zA-Z]//g'); if command -v uwsm &>/dev/null; then eval \"uwsm app -- $EXEC\"; elif command -v niri &>/dev/null; then eval \"niri msg action spawn -- $EXEC\"; else nohup eval \"$EXEC\" </dev/null >/dev/null 2>&1 & fi",
|
||||||
|
"_", appPath
|
||||||
|
];
|
||||||
|
launchProcess.restart();
|
||||||
|
rootState.commandPaletteOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
visible: rootState.commandPaletteOpen
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
bottom: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "quickshell-palette"
|
||||||
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: rootState.commandPaletteOpen = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Surface {
|
||||||
|
id: container
|
||||||
|
// Sized appropriately for a 2560x1440 screen
|
||||||
|
width: 800
|
||||||
|
height: Math.min(600,
|
||||||
|
headerHeight + Theme.geometry.spacing
|
||||||
|
+ (appModel.count > 0 ? appList.contentHeight : emptyStateHeight) + Theme.geometry.spacing
|
||||||
|
+ footerHeight
|
||||||
|
+ Theme.geometry.padding * 2)
|
||||||
|
anchors.centerIn: parent
|
||||||
|
tint: Theme.colors.primary
|
||||||
|
glow: true
|
||||||
|
|
||||||
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } }
|
||||||
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } }
|
||||||
|
|
||||||
|
opacity: rootState.commandPaletteOpen ? 1 : 0
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- App Launcher ---
|
||||||
|
Column {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.geometry.padding
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: searchInput
|
||||||
|
width: parent.width
|
||||||
|
height: paletteWindow.headerHeight
|
||||||
|
placeholder: "Search apps..."
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) focusInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
onTextChanged: {
|
||||||
|
if (paletteWindow.appsLoaded) {
|
||||||
|
paletteWindow.applyFilter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onEscapePressed: {
|
||||||
|
rootState.commandPaletteOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
onUpPressed: {
|
||||||
|
if (appList.currentIndex > 0) {
|
||||||
|
appList.currentIndex--;
|
||||||
|
appList.positionViewAtIndex(appList.currentIndex, ListView.Contain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onDownPressed: {
|
||||||
|
if (appList.currentIndex < appList.count - 1) {
|
||||||
|
appList.currentIndex++;
|
||||||
|
appList.positionViewAtIndex(appList.currentIndex, ListView.Contain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onReturnPressed: {
|
||||||
|
if (appList.count > 0 && appList.currentIndex >= 0 && appList.currentIndex < appModel.count) {
|
||||||
|
paletteWindow.launchApp(appList.currentIndex);
|
||||||
|
} else {
|
||||||
|
paletteWindow.enterQueued = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: historyProcess
|
||||||
|
command: ["bash", "-c", "cat ~/.cache/quickshell-app-history.txt 2>/dev/null || true"]
|
||||||
|
running: false
|
||||||
|
function restart() {
|
||||||
|
running = false;
|
||||||
|
running = true;
|
||||||
|
}
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
let lines = this.text.split('\n').filter(l => l.trim() !== "");
|
||||||
|
let counts = {};
|
||||||
|
let lastUsed = "";
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let app = lines[i];
|
||||||
|
counts[app] = (counts[app] || 0) + 1;
|
||||||
|
lastUsed = app;
|
||||||
|
}
|
||||||
|
paletteWindow.usageCounts = counts;
|
||||||
|
paletteWindow.lastUsedApp = lastUsed;
|
||||||
|
|
||||||
|
// Now that history is loaded, list every desktop entry once.
|
||||||
|
// Filtering as the user types happens entirely in JS below
|
||||||
|
// (applyFilter), so the expensive disk/symlink walk here
|
||||||
|
// only ever runs a single time per palette open.
|
||||||
|
listProcess.restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: listProcess
|
||||||
|
command: [
|
||||||
|
"bash",
|
||||||
|
"-c",
|
||||||
|
"fd -L -t f -e desktop -0 . /usr/share/applications ~/.local/share/applications /var/lib/flatpak/exports/share/applications /run/current-system/sw/share/applications ~/.nix-profile/share/applications 2>/dev/null | xargs -0 -r awk -F= 'BEGIN { OFS=\"|\" } FNR==1 { if(file!=\"\" && name!=\"\") print icon, name, file; name=\"\"; icon=\"\"; file=FILENAME } /^Name=/ && name==\"\" { name=substr($0, 6) } /^Icon=/ && icon==\"\" { icon=substr($0, 6) } END { if(file!=\"\" && name!=\"\") print icon, name, file }'"
|
||||||
|
]
|
||||||
|
running: false
|
||||||
|
function restart() {
|
||||||
|
running = false;
|
||||||
|
running = true;
|
||||||
|
}
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
let lines = this.text.split('\n').filter(l => l.trim() !== "");
|
||||||
|
let apps = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
let parts = lines[i].split('|');
|
||||||
|
if (parts.length >= 3) {
|
||||||
|
let desktopName = parts[2].split('/').pop();
|
||||||
|
let isLast = (desktopName === paletteWindow.lastUsedApp);
|
||||||
|
|
||||||
|
apps.push({
|
||||||
|
"iconName": parts[0],
|
||||||
|
"appName": parts[1],
|
||||||
|
"appPath": parts[2],
|
||||||
|
"desktopName": desktopName,
|
||||||
|
"isLastUsed": isLast,
|
||||||
|
"score": paletteWindow.scoreOf(desktopName)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
paletteWindow.allApps = apps;
|
||||||
|
paletteWindow.appsLoaded = true;
|
||||||
|
paletteWindow.applyFilter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
width: parent.width
|
||||||
|
height: paletteWindow.emptyStateHeight
|
||||||
|
visible: appModel.count === 0
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: searchInput.text.length > 0 ? "No apps found for “" + searchInput.text + "”" : "No apps found"
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: appList
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height - paletteWindow.headerHeight - paletteWindow.footerHeight - Theme.geometry.spacing * 2
|
||||||
|
visible: appModel.count > 0
|
||||||
|
clip: true
|
||||||
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
|
||||||
|
model: ListModel { id: appModel }
|
||||||
|
|
||||||
|
delegate: ListRow {
|
||||||
|
width: appList.width
|
||||||
|
selected: ListView.isCurrentItem
|
||||||
|
accent: model.isLastUsed ? Theme.colors.secondary : Theme.colors.primary
|
||||||
|
|
||||||
|
onEntered: appList.currentIndex = index
|
||||||
|
onClicked: {
|
||||||
|
appList.currentIndex = index;
|
||||||
|
paletteWindow.launchApp(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: appIcon
|
||||||
|
width: 24
|
||||||
|
height: 24
|
||||||
|
source: model.iconName ? Quickshell.iconPath(model.iconName) : ""
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.colors.primary
|
||||||
|
radius: 12
|
||||||
|
visible: parent.status === Image.Error || parent.status === Image.Null || model.iconName === ""
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: model.appName.charAt(0).toUpperCase()
|
||||||
|
color: Theme.colors.textOnAccent
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: model.appName
|
||||||
|
color: Theme.colors.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.label
|
||||||
|
anchors.left: appIcon.right
|
||||||
|
anchors.leftMargin: Theme.geometry.spacing
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HintBar {
|
||||||
|
width: parent.width
|
||||||
|
height: paletteWindow.footerHeight
|
||||||
|
hints: [
|
||||||
|
{ key: "↑↓", label: "Navigate" },
|
||||||
|
{ key: "↵", label: "Launch" },
|
||||||
|
{ key: "Esc", label: "Close" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: launchProcess
|
||||||
|
running: false
|
||||||
|
function restart() {
|
||||||
|
running = false;
|
||||||
|
running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: logHistoryProcess
|
||||||
|
running: false
|
||||||
|
function restart() {
|
||||||
|
running = false;
|
||||||
|
running = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
container.scale = 1.0;
|
||||||
|
searchInput.text = "";
|
||||||
|
paletteWindow.enterQueued = false;
|
||||||
|
paletteWindow.appsLoaded = false;
|
||||||
|
appModel.clear(); // Clear so it re-populates clean
|
||||||
|
|
||||||
|
// Read history first, then list every desktop entry once
|
||||||
|
historyProcess.restart();
|
||||||
|
} else {
|
||||||
|
container.scale = 0.95;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Services.Pam
|
||||||
|
import Quickshell.Services.UPower
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
// The one surface in this shell that owns a real wlr-session-lock-v1 object
|
||||||
|
// instead of being a PanelWindow toggled by IpcHandler: `locked` is the
|
||||||
|
// actual lock state (the compositor keeps the session locked even if this
|
||||||
|
// process dies), and unlocking only ever happens via a successful PamContext
|
||||||
|
// result - there is no external "unlock" IPC call by design.
|
||||||
|
//
|
||||||
|
// PamContext lives INSIDE the `surface` content tree (see below), not as a
|
||||||
|
// direct child of this WlSessionLock. A PamContext declared directly under
|
||||||
|
// WlSessionLock never worked reliably in testing: not just sibling-id
|
||||||
|
// references from outside it, but even PamContext's OWN Component.onCompleted
|
||||||
|
// never fired. WlSessionLock is a `Reloadable` or Quickshell C++ type with
|
||||||
|
// unusual object-graph handling for reload support; a plain QObject child
|
||||||
|
// declared directly under it doesn't get normal QML construction/binding
|
||||||
|
// behavior. The surface's content tree, in contrast, is a perfectly ordinary
|
||||||
|
// Item tree (proven extensively: every `sessionLock.xxx` reference from
|
||||||
|
// deep inside it - the password field, hint bar, shake animation - has
|
||||||
|
// always worked reliably), so PamContext lives there instead, created fresh
|
||||||
|
// each time the surface itself is created (i.e. each time the screen locks).
|
||||||
|
WlSessionLock {
|
||||||
|
id: sessionLock
|
||||||
|
|
||||||
|
property string password: ""
|
||||||
|
property string errorText: ""
|
||||||
|
property bool awaitingResponse: false
|
||||||
|
property bool responseVisible: false
|
||||||
|
|
||||||
|
function lock() {
|
||||||
|
reset();
|
||||||
|
locked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
sessionLock.password = "";
|
||||||
|
sessionLock.errorText = "";
|
||||||
|
sessionLock.awaitingResponse = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
surface: Component {
|
||||||
|
WlSessionLockSurface {
|
||||||
|
id: lockSurface
|
||||||
|
color: Theme.colors.background
|
||||||
|
|
||||||
|
property QtObject battery: UPower.displayDevice
|
||||||
|
|
||||||
|
PamContext {
|
||||||
|
id: authCtx
|
||||||
|
config: "hyprlock" // reuse the PAM service that already exists for hyprlock
|
||||||
|
|
||||||
|
Component.onCompleted: authCtx.start()
|
||||||
|
|
||||||
|
// NOTE: PamContext's "onMessage" that shows up in tooling is
|
||||||
|
// a private C++ slot wired internally to the pam
|
||||||
|
// conversation object - declaring `function onMessage(...)`
|
||||||
|
// here does NOT override it and is silently never called.
|
||||||
|
// The real public signal is `pamMessage()` (no args); read
|
||||||
|
// the message/response properties off this object after it
|
||||||
|
// fires.
|
||||||
|
onPamMessage: {
|
||||||
|
sessionLock.errorText = authCtx.messageIsError ? authCtx.message : "";
|
||||||
|
sessionLock.awaitingResponse = authCtx.responseRequired;
|
||||||
|
sessionLock.responseVisible = authCtx.responseVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
onCompleted: (result) => {
|
||||||
|
if (result === PamResult.Success) {
|
||||||
|
sessionLock.locked = false;
|
||||||
|
} else {
|
||||||
|
sessionLock.errorText = "Incorrect password";
|
||||||
|
sessionLock.password = "";
|
||||||
|
sessionLock.awaitingResponse = false;
|
||||||
|
authCtx.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onError: (error) => {
|
||||||
|
sessionLock.errorText = "Authentication error";
|
||||||
|
sessionLock.password = "";
|
||||||
|
sessionLock.awaitingResponse = false;
|
||||||
|
authCtx.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemClock {
|
||||||
|
id: clock
|
||||||
|
precision: SystemClock.Seconds
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.geometry.spacing * 3
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: Qt.formatDateTime(clock.date, "hh:mm")
|
||||||
|
color: Theme.colors.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: 96
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: Qt.formatDateTime(clock.date, "dddd, d MMMM")
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
visible: lockSurface.battery.isPresent
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: {
|
||||||
|
let p = lockSurface.battery.percentage;
|
||||||
|
if (p >= 0.9) return ""; // nf-fa-battery_full
|
||||||
|
if (p >= 0.65) return ""; // nf-fa-battery_three_quarters
|
||||||
|
if (p >= 0.4) return ""; // nf-fa-battery_half
|
||||||
|
if (p >= 0.15) return ""; // nf-fa-battery_quarter
|
||||||
|
return ""; // nf-fa-battery_empty
|
||||||
|
}
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
color: {
|
||||||
|
let p = lockSurface.battery.percentage;
|
||||||
|
if (p >= 0.5) return Theme.colors.success;
|
||||||
|
if (p >= 0.2) return Theme.colors.warning;
|
||||||
|
return Theme.colors.alert;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: Math.round(lockSurface.battery.percentage * 100) + "%"
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: passwordShake
|
||||||
|
width: 320
|
||||||
|
height: passwordField.height
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: shakeAnim
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: -8; duration: 40 }
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: 8; duration: 40 }
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: -6; duration: 40 }
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: 0; duration: 40 }
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: sessionLock
|
||||||
|
function onErrorTextChanged() {
|
||||||
|
if (sessionLock.errorText.length > 0) shakeAnim.start();
|
||||||
|
}
|
||||||
|
function onPasswordChanged() {
|
||||||
|
if (sessionLock.password.length === 0) passwordField.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: passwordField
|
||||||
|
width: parent.width
|
||||||
|
placeholder: "Password"
|
||||||
|
echoMode: sessionLock.responseVisible ? TextInput.Normal : TextInput.Password
|
||||||
|
|
||||||
|
onVisibleChanged: { if (visible) focusInput(); }
|
||||||
|
onTextChanged: sessionLock.password = text
|
||||||
|
onReturnPressed: {
|
||||||
|
if (!sessionLock.awaitingResponse) return;
|
||||||
|
authCtx.respond(sessionLock.password);
|
||||||
|
sessionLock.awaitingResponse = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: sessionLock.errorText
|
||||||
|
visible: sessionLock.errorText.length > 0
|
||||||
|
color: Theme.colors.alert
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
}
|
||||||
|
|
||||||
|
HintBar {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
hints: [ { key: "↵", label: "Unlock" } ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) passwordField.focusInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Io
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: logoutWindow
|
||||||
|
property QtObject rootState
|
||||||
|
property int currentIndex: 2 // Default to Logout in the middle
|
||||||
|
property var actions: [
|
||||||
|
{ cmd: "loginctl lock-session" },
|
||||||
|
{ cmd: "systemctl suspend" },
|
||||||
|
{ cmd: "loginctl terminate-user $USER" },
|
||||||
|
{ cmd: "systemctl reboot" },
|
||||||
|
{ cmd: "systemctl poweroff" }
|
||||||
|
]
|
||||||
|
|
||||||
|
visible: rootState.logoutMenuOpen
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
bottom: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "quickshell-logout"
|
||||||
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: rootState.logoutMenuOpen = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.colors.overlay // Full screen dim/blur
|
||||||
|
|
||||||
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationNormal } }
|
||||||
|
opacity: rootState.logoutMenuOpen ? 1 : 0
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: rootState.logoutMenuOpen = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: container
|
||||||
|
width: buttonRow.width
|
||||||
|
height: buttonRow.height
|
||||||
|
anchors.centerIn: parent
|
||||||
|
|
||||||
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } }
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: buttonRow
|
||||||
|
spacing: Theme.geometry.spacing * 3
|
||||||
|
|
||||||
|
// Lock
|
||||||
|
LogoutButton {
|
||||||
|
icon: ""
|
||||||
|
label: "Lock"
|
||||||
|
isSelected: logoutWindow.currentIndex === 0
|
||||||
|
onClicked: executeAction(logoutWindow.actions[0].cmd)
|
||||||
|
onHovered: logoutWindow.currentIndex = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Suspend
|
||||||
|
LogoutButton {
|
||||||
|
icon: ""
|
||||||
|
label: "Suspend"
|
||||||
|
isSelected: logoutWindow.currentIndex === 1
|
||||||
|
onClicked: executeAction(logoutWindow.actions[1].cmd)
|
||||||
|
onHovered: logoutWindow.currentIndex = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// Logout
|
||||||
|
LogoutButton {
|
||||||
|
icon: ""
|
||||||
|
label: "Logout"
|
||||||
|
isSelected: logoutWindow.currentIndex === 2
|
||||||
|
onClicked: executeAction(logoutWindow.actions[2].cmd)
|
||||||
|
onHovered: logoutWindow.currentIndex = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reboot
|
||||||
|
LogoutButton {
|
||||||
|
icon: ""
|
||||||
|
label: "Reboot"
|
||||||
|
isSelected: logoutWindow.currentIndex === 3
|
||||||
|
onClicked: executeAction(logoutWindow.actions[3].cmd)
|
||||||
|
onHovered: logoutWindow.currentIndex = 3
|
||||||
|
}
|
||||||
|
|
||||||
|
// Poweroff
|
||||||
|
LogoutButton {
|
||||||
|
icon: ""
|
||||||
|
label: "Shutdown"
|
||||||
|
isDestructive: true
|
||||||
|
isSelected: logoutWindow.currentIndex === 4
|
||||||
|
onClicked: executeAction(logoutWindow.actions[4].cmd)
|
||||||
|
onHovered: logoutWindow.currentIndex = 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Key handling
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
Keys.onEscapePressed: (event) => {
|
||||||
|
rootState.logoutMenuOpen = false;
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onLeftPressed: (event) => {
|
||||||
|
if (logoutWindow.currentIndex > 0) {
|
||||||
|
logoutWindow.currentIndex--;
|
||||||
|
}
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onRightPressed: (event) => {
|
||||||
|
if (logoutWindow.currentIndex < 4) {
|
||||||
|
logoutWindow.currentIndex++;
|
||||||
|
}
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onReturnPressed: (event) => {
|
||||||
|
executeAction(logoutWindow.actions[logoutWindow.currentIndex].cmd);
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: actionProcess
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
|
function executeAction(cmd) {
|
||||||
|
actionProcess.command = ["bash", "-c", cmd];
|
||||||
|
actionProcess.running = true;
|
||||||
|
rootState.logoutMenuOpen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
container.scale = 1.0;
|
||||||
|
logoutWindow.currentIndex = 2; // Reset to center
|
||||||
|
} else {
|
||||||
|
container.scale = 0.95;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Inline component for the big buttons
|
||||||
|
component LogoutButton: Surface {
|
||||||
|
property string icon: ""
|
||||||
|
property string label: ""
|
||||||
|
property bool isDestructive: false
|
||||||
|
property bool isSelected: false
|
||||||
|
signal clicked()
|
||||||
|
signal hovered()
|
||||||
|
|
||||||
|
width: 120
|
||||||
|
height: 120
|
||||||
|
color: Theme.colors.surface
|
||||||
|
tint: isSelected ? (isDestructive ? Theme.colors.alert : Theme.colors.primary) : Theme.colors.border
|
||||||
|
border.width: isSelected ? 2 : 1
|
||||||
|
glow: isSelected
|
||||||
|
|
||||||
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSnappy.spring; damping: Theme.motion.springSnappy.damping } }
|
||||||
|
scale: isSelected ? 1.05 : 1.0
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: parent.parent.icon
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 36
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
color: parent.parent.isSelected ? parent.parent.tint : Theme.colors.text
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: parent.parent.label
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 16
|
||||||
|
font.bold: true
|
||||||
|
color: Theme.colors.text
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: hoverArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onEntered: parent.hovered()
|
||||||
|
onClicked: parent.clicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import QtQuick.Effects
|
|
||||||
import Quickshell
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
property bool active: true
|
|
||||||
property bool clickable: false
|
|
||||||
|
|
||||||
// Inner content configuration
|
|
||||||
property string icon: ""
|
|
||||||
property string text: ""
|
|
||||||
property Component customContent: null
|
|
||||||
|
|
||||||
// Popup configuration
|
|
||||||
property var popupItem: null
|
|
||||||
|
|
||||||
// Styling
|
|
||||||
property color pillColor: Theme.bgAlt
|
|
||||||
|
|
||||||
// Standard pill dimensions
|
|
||||||
implicitHeight: 28
|
|
||||||
|
|
||||||
// Monitor tracking for exclusive visibility
|
|
||||||
property var monitor: null
|
|
||||||
property bool exclusiveToScreen: false
|
|
||||||
property bool isFocusedMonitor: monitor ? monitor.focused : true
|
|
||||||
property bool effectivelyActive: active && (!exclusiveToScreen || isFocusedMonitor)
|
|
||||||
|
|
||||||
// Fluid auto-hide transitions
|
|
||||||
visible: opacity > 0
|
|
||||||
opacity: effectivelyActive ? 1 : 0
|
|
||||||
implicitWidth: effectivelyActive ? contentRow.implicitWidth + (Theme.padding * 2) : 0
|
|
||||||
clip: false // Turn off clip so shadow isn't cut off
|
|
||||||
|
|
||||||
Behavior on opacity {
|
|
||||||
NumberAnimation { duration: 250; easing.type: Easing.InOutQuad }
|
|
||||||
}
|
|
||||||
Behavior on implicitWidth {
|
|
||||||
NumberAnimation { duration: 250; easing.type: Easing.OutBack }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shadow Effect
|
|
||||||
MultiEffect {
|
|
||||||
anchors.fill: bgRect
|
|
||||||
source: bgRect
|
|
||||||
shadowEnabled: true
|
|
||||||
shadowColor: "#000000"
|
|
||||||
shadowOpacity: 0.4
|
|
||||||
shadowBlur: 0.8
|
|
||||||
shadowVerticalOffset: 2
|
|
||||||
shadowHorizontalOffset: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: bgRect
|
|
||||||
anchors.fill: parent
|
|
||||||
radius: Theme.radius / 2
|
|
||||||
color: (clickable || popupItem !== null) && mouseArea.containsMouse ? Qt.darker(root.pillColor, 1.2) : root.pillColor
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: contentRow
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: 6
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
active: root.customContent !== null
|
|
||||||
sourceComponent: root.customContent
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
visible: root.icon !== "" && root.customContent === null
|
|
||||||
text: root.icon
|
|
||||||
color: Theme.fg
|
|
||||||
font: Theme.font
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
visible: root.text !== "" && root.customContent === null
|
|
||||||
text: root.text
|
|
||||||
color: Theme.fg
|
|
||||||
font: Theme.fontBold
|
|
||||||
Layout.alignment: Qt.AlignVCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: root.clickable || root.popupItem !== null
|
|
||||||
cursorShape: (root.clickable || root.popupItem !== null) ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
||||||
onClicked: {
|
|
||||||
if (root.popupItem !== null) {
|
|
||||||
root.popupItem.visible = !root.popupItem.visible;
|
|
||||||
}
|
|
||||||
root.clicked();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
signal clicked()
|
|
||||||
}
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
import Quickshell
|
|
||||||
import Quickshell.Services.Notifications
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
PanelWindow {
|
|
||||||
id: notifWindow
|
|
||||||
|
|
||||||
// Anchor to top right, just below the bar
|
|
||||||
anchors {
|
|
||||||
top: true
|
|
||||||
right: true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Offset slightly from the screen edges
|
|
||||||
margins {
|
|
||||||
top: 40 // height of top bar (32) + 8 padding
|
|
||||||
right: 8
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dynamic height based on notifications
|
|
||||||
implicitWidth: 320
|
|
||||||
implicitHeight: notifList.contentHeight
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
// Make invisible if no notifications
|
|
||||||
visible: notificationServer.trackedNotifications.values.length > 0
|
|
||||||
|
|
||||||
NotificationServer {
|
|
||||||
id: notificationServer
|
|
||||||
bodySupported: true
|
|
||||||
actionsSupported: false
|
|
||||||
inlineReplySupported: false
|
|
||||||
imageSupported: true
|
|
||||||
actionIconsSupported: false
|
|
||||||
persistenceSupported: false
|
|
||||||
|
|
||||||
onNotification: function(notification) {
|
|
||||||
notification.tracked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: notifList
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: 8
|
|
||||||
model: notificationServer.trackedNotifications.values
|
|
||||||
clip: false // Allow shadows or animations outside
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
|
||||||
id: delegateRect
|
|
||||||
width: notifWindow.width
|
|
||||||
height: layout.height + Theme.padding * 2
|
|
||||||
color: Theme.bg
|
|
||||||
radius: Theme.radius
|
|
||||||
border.color: Theme.bgAlt
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
property var notif: modelData
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
id: layout
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.margins: Theme.padding
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: notif.appName || "Notification"
|
|
||||||
color: Theme.primary
|
|
||||||
font: Theme.fontBold
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "✕"
|
|
||||||
color: Theme.fgAlt
|
|
||||||
font: Theme.fontBold
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: notif.dismiss()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: notif.summary || ""
|
|
||||||
color: Theme.fg
|
|
||||||
font: Theme.fontBold
|
|
||||||
Layout.fillWidth: true
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: notif.body || ""
|
|
||||||
color: Theme.fgAlt
|
|
||||||
font: Theme.font
|
|
||||||
Layout.fillWidth: true
|
|
||||||
wrapMode: Text.Wrap
|
|
||||||
maximumLineCount: 4
|
|
||||||
elide: Text.ElideRight
|
|
||||||
visible: text.length > 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: expireTimer
|
|
||||||
interval: notif.expireTimeout > 0 ? (notif.expireTimeout) : 5000
|
|
||||||
running: true
|
|
||||||
onTriggered: notif.expire()
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
// Don't swallow clicks for the close button
|
|
||||||
z: -1
|
|
||||||
onClicked: notif.dismiss()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Services.Notifications
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: notifWindow
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
margins {
|
||||||
|
top: Theme.geometry.padding
|
||||||
|
right: Theme.geometry.padding
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
color: "transparent"
|
||||||
|
implicitWidth: 320
|
||||||
|
implicitHeight: list.height
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "quickshell-notifications"
|
||||||
|
|
||||||
|
NotificationServer {
|
||||||
|
id: server
|
||||||
|
keepOnReload: true
|
||||||
|
bodySupported: true
|
||||||
|
bodyMarkupSupported: true
|
||||||
|
actionsSupported: true
|
||||||
|
imageSupported: true
|
||||||
|
|
||||||
|
onNotification: notification => {
|
||||||
|
notification.tracked = true;
|
||||||
|
toastModel.insert(0, {
|
||||||
|
notifObj: notification,
|
||||||
|
appName: notification.appName,
|
||||||
|
summary: notification.summary,
|
||||||
|
body: notification.body,
|
||||||
|
urgency: notification.urgency
|
||||||
|
});
|
||||||
|
|
||||||
|
function removeFromModel() {
|
||||||
|
for (let i = 0; i < toastModel.count; i++) {
|
||||||
|
if (toastModel.get(i).notifObj === notification) {
|
||||||
|
toastModel.remove(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notification.closed.connect(removeFromModel);
|
||||||
|
|
||||||
|
let timeout = notification.expireTimeout > 0 ? notification.expireTimeout : 5000;
|
||||||
|
dismissTimer.createObject(notifWindow, { targetNotification: notification, interval: timeout });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: dismissTimer
|
||||||
|
Timer {
|
||||||
|
property var targetNotification
|
||||||
|
running: true
|
||||||
|
repeat: false
|
||||||
|
onTriggered: {
|
||||||
|
for (let i = 0; i < toastModel.count; i++) {
|
||||||
|
if (toastModel.get(i).notifObj === targetNotification) {
|
||||||
|
toastModel.remove(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: toastModel
|
||||||
|
}
|
||||||
|
|
||||||
|
function colorFor(urgency) {
|
||||||
|
if (urgency === NotificationUrgency.Critical) return Theme.colors.alert;
|
||||||
|
if (urgency === NotificationUrgency.Low) return Theme.colors.success;
|
||||||
|
return Theme.colors.info;
|
||||||
|
}
|
||||||
|
|
||||||
|
function labelFor(urgency) {
|
||||||
|
if (urgency === NotificationUrgency.Critical) return "Warning";
|
||||||
|
if (urgency === NotificationUrgency.Low) return "Notice";
|
||||||
|
return "Info";
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: list
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: toastModel
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
id: toast
|
||||||
|
width: list.width
|
||||||
|
height: content.implicitHeight + Theme.geometry.padding * 2
|
||||||
|
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
|
||||||
|
|
||||||
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationNormal } }
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: content
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.margins: Theme.geometry.padding
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 16
|
||||||
|
height: 16
|
||||||
|
radius: 8
|
||||||
|
color: notifWindow.colorFor(model.urgency)
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: content.width - 16 - Theme.geometry.spacing - closeIcon.width - Theme.geometry.spacing
|
||||||
|
spacing: 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: model.summary && model.summary.length > 0 ? model.summary : model.appName
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 12
|
||||||
|
font.bold: true
|
||||||
|
color: notifWindow.colorFor(model.urgency)
|
||||||
|
width: parent.width
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
visible: model.body && model.body.length > 0
|
||||||
|
text: model.body
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 12
|
||||||
|
color: Theme.colors.text
|
||||||
|
width: parent.width
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
maximumLineCount: 3
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: closeIcon
|
||||||
|
text: ""
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 12
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: -6
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
model.notifObj.dismiss();
|
||||||
|
toastModel.remove(index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import Quickshell.Services.Pipewire
|
||||||
|
import Quickshell.Io
|
||||||
|
import "../Shared"
|
||||||
|
|
||||||
|
PanelWindow {
|
||||||
|
id: osdWindow
|
||||||
|
|
||||||
|
// API
|
||||||
|
function show(newMode) {
|
||||||
|
mode = newMode;
|
||||||
|
if (mode === "brightness") {
|
||||||
|
brightnessProcess.restart();
|
||||||
|
}
|
||||||
|
visibleTimer.restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
property string mode: "volume" // "volume" or "brightness"
|
||||||
|
property real brightnessLevel: 0.5
|
||||||
|
|
||||||
|
// Pipewire Audio Binding
|
||||||
|
property QtObject sink: Pipewire.defaultAudioSink
|
||||||
|
// Ensure sink and audio are valid before trying to read volume
|
||||||
|
property bool sinkReady: sink !== null && sink.ready && sink.audio !== null
|
||||||
|
property real volumeLevel: sinkReady ? sink.audio.volume : 0.0
|
||||||
|
property bool isMuted: sinkReady ? sink.audio.muted : false
|
||||||
|
|
||||||
|
PwObjectTracker {
|
||||||
|
objects: sink !== null ? [sink] : []
|
||||||
|
}
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
bottom: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
margins {
|
||||||
|
bottom: visibleTimer.running ? Theme.geometry.padding * 4 : -implicitHeight - 50
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on margins.bottom {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Theme.animation.durationNormal
|
||||||
|
easing.type: Easing.OutBack
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
color: "transparent"
|
||||||
|
implicitHeight: 60
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "quickshell-osd"
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: visibleTimer
|
||||||
|
interval: 2000
|
||||||
|
}
|
||||||
|
|
||||||
|
Process {
|
||||||
|
id: brightnessProcess
|
||||||
|
// brightnessctl -m outputs: intel_backlight,backlight,12000,100%,12000
|
||||||
|
command: ["bash", "-c", "brightnessctl -m 2>/dev/null | awk -F, '{print $4}' | tr -d '%'"]
|
||||||
|
running: false
|
||||||
|
function restart() { running = false; running = true; }
|
||||||
|
stdout: StdioCollector {
|
||||||
|
onStreamFinished: {
|
||||||
|
let val = parseInt(this.text);
|
||||||
|
if (!isNaN(val)) {
|
||||||
|
brightnessLevel = val / 100.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Surface {
|
||||||
|
width: 300
|
||||||
|
height: 60
|
||||||
|
anchors.centerIn: parent
|
||||||
|
radius: Theme.geometry.pillRadius
|
||||||
|
tint: osdWindow.levelColor
|
||||||
|
glow: true
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.geometry.padding
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: iconText
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: {
|
||||||
|
if (mode === "volume") {
|
||||||
|
if (isMuted) return ""; // nf-fa-volume_off
|
||||||
|
if (volumeLevel < 0.5) return ""; // nf-fa-volume_down
|
||||||
|
return ""; // nf-fa-volume_up
|
||||||
|
} else {
|
||||||
|
return ""; // nf-fa-sun_o
|
||||||
|
}
|
||||||
|
}
|
||||||
|
color: osdWindow.levelColor
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 18
|
||||||
|
}
|
||||||
|
|
||||||
|
ProgressBar {
|
||||||
|
anchors.left: iconText.right
|
||||||
|
anchors.leftMargin: Theme.geometry.spacing
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
value: mode === "volume" ? volumeLevel : brightnessLevel
|
||||||
|
fillColor: osdWindow.levelColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Volume gets the primary accent, brightness gets a warm warning-ish
|
||||||
|
// tint (sun-colored), muted volume falls back to a neutral color.
|
||||||
|
readonly property color levelColor: (mode === "volume" && isMuted)
|
||||||
|
? Theme.colors.textMuted
|
||||||
|
: (mode === "volume" ? Theme.colors.primary : Theme.colors.warning)
|
||||||
|
}
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
FloatingWindow {
|
|
||||||
id: win
|
|
||||||
title: "Power Menu"
|
|
||||||
visible: false
|
|
||||||
implicitWidth: 820
|
|
||||||
implicitHeight: 340
|
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
property int selectedIndex: 0
|
|
||||||
property int armedIndex: -1
|
|
||||||
property bool mouseWasInside: false
|
|
||||||
readonly property var actions: [
|
|
||||||
{ name: "Lock", icon: "", hint: "hyprlock", cmd: "hyprlock", danger: false },
|
|
||||||
{ name: "Logout", icon: "", hint: "hyprctl dispatch exit", cmd: "hyprctl dispatch exit", danger: true },
|
|
||||||
{ name: "Suspend", icon: "", hint: "systemctl suspend", cmd: "systemctl suspend", danger: false },
|
|
||||||
{ name: "Reboot", icon: "", hint: "systemctl reboot", cmd: "systemctl reboot", danger: true },
|
|
||||||
{ name: "Shutdown", icon: "", hint: "systemctl poweroff", cmd: "systemctl poweroff", danger: true }
|
|
||||||
]
|
|
||||||
|
|
||||||
function clampIndex(index) { return ((index % actions.length) + actions.length) % actions.length }
|
|
||||||
function selectIndex(index) { selectedIndex = clampIndex(index); armedIndex = -1 }
|
|
||||||
function open() { mouseWasInside = false; armedIndex = -1; visible = true; keyScope.forceActiveFocus() }
|
|
||||||
function toggle() { visible = !visible; if (visible) { mouseWasInside = false; armedIndex = -1; keyScope.forceActiveFocus() } }
|
|
||||||
function runAction(index) {
|
|
||||||
const action = actions[index]
|
|
||||||
if (action.danger && armedIndex !== index) { armedIndex = index; return }
|
|
||||||
actionProcess.command = ["bash", "-lc", action.cmd]
|
|
||||||
actionProcess.running = true
|
|
||||||
visible = false
|
|
||||||
armedIndex = -1
|
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
|
||||||
target: "powerMenu"
|
|
||||||
function open() { win.open() }
|
|
||||||
function toggle() { win.toggle() }
|
|
||||||
function lock() { win.runAction(0) }
|
|
||||||
function logout() { win.runAction(1) }
|
|
||||||
function suspend() { win.runAction(2) }
|
|
||||||
function reboot() { win.runAction(3) }
|
|
||||||
function shutdown() { win.runAction(4) }
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: keyScope
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: win.visible
|
|
||||||
|
|
||||||
Keys.onPressed: function(event) {
|
|
||||||
if (event.key === Qt.Key_Left || event.key === Qt.Key_H) { win.selectIndex(win.selectedIndex - 1); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Right || event.key === Qt.Key_L) { win.selectIndex(win.selectedIndex + 1); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter || event.key === Qt.Key_Space) { win.runAction(win.selectedIndex); event.accepted = true }
|
|
||||||
else if (event.key === Qt.Key_Escape) { win.visible = false; event.accepted = true }
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea { anchors.fill: parent; hoverEnabled: true; acceptedButtons: Qt.NoButton; onEntered: win.mouseWasInside = true; onExited: if (win.mouseWasInside) win.visible = false }
|
|
||||||
|
|
||||||
Rectangle { anchors.fill: parent; radius: 34; color: Qt.rgba(Theme.base.r, Theme.base.g, Theme.base.b, 0.13); border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.38); border.width: 1 }
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: row
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: 16
|
|
||||||
Repeater {
|
|
||||||
model: win.actions.length
|
|
||||||
Rectangle {
|
|
||||||
id: card
|
|
||||||
property var action: win.actions[index]
|
|
||||||
property bool selected: index === win.selectedIndex
|
|
||||||
property bool armed: index === win.armedIndex
|
|
||||||
width: selected ? 150 : 126
|
|
||||||
height: selected ? 190 : 162
|
|
||||||
radius: selected ? 28 : 24
|
|
||||||
y: selected ? -10 : 4
|
|
||||||
color: armed ? Qt.rgba(Theme.red.r, Theme.red.g, Theme.red.b, 0.28) : Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.70)
|
|
||||||
border.color: armed ? Theme.red : selected ? Theme.mauve : Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.60)
|
|
||||||
border.width: selected ? 3 : 1
|
|
||||||
antialiasing: true
|
|
||||||
|
|
||||||
Behavior on width { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on height { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on y { NumberAnimation { duration: 130; easing.type: Easing.OutCubic } }
|
|
||||||
Behavior on border.color { ColorAnimation { duration: 100 } }
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: 14
|
|
||||||
spacing: 8
|
|
||||||
Text { Layout.alignment: Qt.AlignHCenter; text: card.action.icon; font.family: Theme.fontFamily; font.pixelSize: card.selected ? 46 : 36; color: card.armed ? Theme.red : Theme.text }
|
|
||||||
Text { Layout.alignment: Qt.AlignHCenter; text: card.action.name; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize + 2; font.bold: true; color: Theme.text }
|
|
||||||
Text { Layout.fillWidth: true; text: card.armed ? "Press Enter again" : card.action.hint; horizontalAlignment: Text.AlignHCenter; wrapMode: Text.WordWrap; font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 3; color: card.armed ? Theme.red : Theme.overlay2 }
|
|
||||||
}
|
|
||||||
MouseArea { anchors.fill: parent; onClicked: { if (card.selected) win.runAction(index); else win.selectIndex(index); keyScope.forceActiveFocus() } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom
|
|
||||||
anchors.leftMargin: 42; anchors.rightMargin: 42; anchors.bottomMargin: 22
|
|
||||||
height: 44; radius: 18
|
|
||||||
color: Qt.rgba(Theme.crust.r, Theme.crust.g, Theme.crust.b, 0.42)
|
|
||||||
border.color: Qt.rgba(Theme.surface1.r, Theme.surface1.g, Theme.surface1.b, 0.45)
|
|
||||||
Text { anchors.centerIn: parent; text: "←/→ select · Enter apply" + (win.armedIndex >= 0 ? " again · Esc cancel" : " · Esc close"); font.family: Theme.fontFamily; font.pixelSize: Theme.fontPixelSize - 1; color: Theme.text }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Process { id: actionProcess; running: false }
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
import "."
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: button
|
||||||
|
|
||||||
|
// "primary" | "secondary" | "accent" | "destructive" | "success" | "warning" | "info"
|
||||||
|
property string variant: "primary"
|
||||||
|
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
|
||||||
|
: variant === "success" ? Theme.colors.success
|
||||||
|
: variant === "warning" ? Theme.colors.warning
|
||||||
|
: variant === "info" ? Theme.colors.info
|
||||||
|
: Theme.colors.primary
|
||||||
|
|
||||||
|
implicitWidth: label.implicitWidth + Theme.geometry.padding * 2
|
||||||
|
implicitHeight: label.implicitHeight + Theme.geometry.padding
|
||||||
|
|
||||||
|
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: Theme.elevation.medium.opacity
|
||||||
|
shadowBlur: Theme.elevation.medium.blur
|
||||||
|
shadowVerticalOffset: 2
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSnappy.spring; damping: Theme.motion.springSnappy.damping } }
|
||||||
|
scale: mouseArea.pressed ? 0.97 : 1.0
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: label
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: button.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 13
|
||||||
|
font.bold: true
|
||||||
|
color: button.filled ? Theme.colors.background : button.tint
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: mouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: button.clicked()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Reusable right-click menu. `model` is a plain JS array of
|
||||||
|
// { label, icon, destructive, separator, action } entries.
|
||||||
|
Rectangle {
|
||||||
|
id: menu
|
||||||
|
|
||||||
|
property var model: []
|
||||||
|
|
||||||
|
visible: false
|
||||||
|
z: 1000
|
||||||
|
width: 180
|
||||||
|
radius: Theme.geometry.radiusMedium
|
||||||
|
color: Theme.colors.background
|
||||||
|
border.color: Theme.colors.border
|
||||||
|
border.width: 1
|
||||||
|
height: column.implicitHeight + Theme.geometry.spacing
|
||||||
|
|
||||||
|
function openAt(px, py) {
|
||||||
|
x = px;
|
||||||
|
y = py;
|
||||||
|
visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Absorb clicks inside the menu so they don't fall through to the backdrop.
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: column
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.geometry.spacing / 2
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: menu.model
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: column.width
|
||||||
|
height: modelData.separator ? 1 : 28
|
||||||
|
radius: modelData.separator ? 0 : Theme.geometry.radiusTiny
|
||||||
|
color: modelData.separator
|
||||||
|
? Theme.colors.border
|
||||||
|
: (itemMouse.containsMouse ? Theme.colors.surfaceHover : "transparent")
|
||||||
|
|
||||||
|
Row {
|
||||||
|
visible: !modelData.separator
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.geometry.spacing
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.icon || ""
|
||||||
|
width: Theme.iconSize.small
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.label || ""
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: itemMouse
|
||||||
|
anchors.fill: parent
|
||||||
|
enabled: !modelData.separator
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
menu.close();
|
||||||
|
if (modelData.action) modelData.action();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Row of "key label" keyboard hints shown under launcher-style overlays,
|
||||||
|
// e.g. [ [↑↓, "Navigate"], ["↵", "Launch"], ["Esc", "Close"] ].
|
||||||
|
Row {
|
||||||
|
id: hintBar
|
||||||
|
|
||||||
|
property var hints: []
|
||||||
|
|
||||||
|
spacing: Theme.geometry.spacing * 2
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: hintBar.hints
|
||||||
|
|
||||||
|
delegate: Row {
|
||||||
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.key
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.label
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Selectable list row: a colored left accent bar plus a tinted background
|
||||||
|
// when current, shared by CommandPalette and ClipboardManager so both
|
||||||
|
// launchers read as the same design language.
|
||||||
|
Rectangle {
|
||||||
|
id: row
|
||||||
|
|
||||||
|
property bool selected: false
|
||||||
|
property color accent: Theme.colors.primary
|
||||||
|
readonly property alias hovered: rowMouse.containsMouse
|
||||||
|
default property alias content: contentItem.data
|
||||||
|
|
||||||
|
signal clicked(var mouse)
|
||||||
|
signal entered()
|
||||||
|
|
||||||
|
height: 40
|
||||||
|
radius: Theme.geometry.radiusTiny
|
||||||
|
color: selected ? Qt.alpha(accent, 0.16) : "transparent"
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 3
|
||||||
|
height: parent.height - 10
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
|
radius: 2
|
||||||
|
color: row.accent
|
||||||
|
opacity: row.selected ? 1 : 0
|
||||||
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Declared before contentItem so any interactive child placed in
|
||||||
|
// `content` (e.g. a hover delete button) stacks on top and can
|
||||||
|
// intercept clicks before they fall through to this row-wide handler.
|
||||||
|
MouseArea {
|
||||||
|
id: rowMouse
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
onEntered: row.entered()
|
||||||
|
onClicked: (mouse) => row.clicked(mouse)
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: contentItem
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Theme.geometry.padding + 4
|
||||||
|
anchors.rightMargin: Theme.geometry.padding
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Bar-style pill chrome: rounded surface, border, optional colored glow.
|
||||||
|
// Children are centered in an internal Row - place them directly as this
|
||||||
|
// component's children, same as putting them in a Row.
|
||||||
|
Rectangle {
|
||||||
|
id: pill
|
||||||
|
|
||||||
|
property color tint: Theme.colors.border
|
||||||
|
property bool glow: false
|
||||||
|
// How strongly `tint` is mixed into the base surface color, so each
|
||||||
|
// pill reads as its own tinted background instead of one flat surface
|
||||||
|
// color with only the border/glow varying.
|
||||||
|
property real tintStrength: 0.35
|
||||||
|
default property alias content: contentRow.data
|
||||||
|
|
||||||
|
function blend(base, mix, amount) {
|
||||||
|
return Qt.rgba(
|
||||||
|
base.r + (mix.r - base.r) * amount,
|
||||||
|
base.g + (mix.g - base.g) * amount,
|
||||||
|
base.b + (mix.b - base.b) * amount,
|
||||||
|
base.a
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: contentRow.implicitWidth + Theme.geometry.padding * 2
|
||||||
|
implicitHeight: contentRow.implicitHeight + Theme.geometry.padding
|
||||||
|
height: implicitHeight
|
||||||
|
radius: Theme.geometry.pillRadius
|
||||||
|
color: blend(Theme.colors.surface, tint, tintStrength)
|
||||||
|
border.color: tint
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationNormal } }
|
||||||
|
|
||||||
|
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
|
layer.enabled: glow
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: pill.tint
|
||||||
|
shadowOpacity: Theme.elevation.low.opacity
|
||||||
|
shadowBlur: Theme.elevation.low.blur
|
||||||
|
shadowVerticalOffset: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: contentRow
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Colored fill bar for OSD volume/brightness and similar level readouts.
|
||||||
|
Item {
|
||||||
|
id: bar
|
||||||
|
|
||||||
|
property real value: 0 // 0..1
|
||||||
|
property color fillColor: Theme.colors.primary
|
||||||
|
|
||||||
|
height: 8
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.colors.surfaceHover
|
||||||
|
radius: height / 2
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width * Math.max(0, Math.min(1, bar.value))
|
||||||
|
height: parent.height
|
||||||
|
radius: parent.radius
|
||||||
|
color: bar.fillColor
|
||||||
|
|
||||||
|
Behavior on width { NumberAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Live reference for the shared design-language kit: every Shared/
|
||||||
|
// component in one place, so future surfaces (notification center, lock
|
||||||
|
// screen, dashboard) have something concrete to copy from instead of
|
||||||
|
// reverse-engineering an existing feature component.
|
||||||
|
PanelWindow {
|
||||||
|
id: showcaseWindow
|
||||||
|
|
||||||
|
property bool open: false
|
||||||
|
visible: open
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
bottom: true
|
||||||
|
left: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
|
||||||
|
exclusiveZone: 0
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
WlrLayershell.namespace: "quickshell-showcase"
|
||||||
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: showcaseWindow.open = false
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.colors.overlay
|
||||||
|
}
|
||||||
|
|
||||||
|
Surface {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: 640
|
||||||
|
height: content.implicitHeight + Theme.geometry.padding * 2
|
||||||
|
glow: true
|
||||||
|
|
||||||
|
MouseArea { anchors.fill: parent }
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: content
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.geometry.padding
|
||||||
|
spacing: Theme.geometry.spacing * 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Design language showcase"
|
||||||
|
color: Theme.colors.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.title
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
Pill { tint: Theme.colors.primary; glow: true; Text { text: "primary"; color: Theme.colors.text; font.family: Theme.font.family } }
|
||||||
|
Pill { tint: Theme.colors.secondary; glow: true; Text { text: "secondary"; color: Theme.colors.text; font.family: Theme.font.family } }
|
||||||
|
Pill { tint: Theme.colors.tertiary; glow: true; Text { text: "tertiary"; color: Theme.colors.text; font.family: Theme.font.family } }
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
Button { variant: "primary"; text: "Primary" }
|
||||||
|
Button { variant: "secondary"; text: "Secondary" }
|
||||||
|
Button { variant: "success"; text: "Success" }
|
||||||
|
Button { variant: "warning"; text: "Warning" }
|
||||||
|
Button { variant: "info"; text: "Info" }
|
||||||
|
Button { variant: "destructive"; text: "Destructive" }
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
width: parent.width
|
||||||
|
placeholder: "TextField..."
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
ProgressBar { width: parent.width; value: 0.7; fillColor: Theme.colors.primary }
|
||||||
|
ProgressBar { width: parent.width; value: 0.4; fillColor: Theme.colors.warning }
|
||||||
|
ProgressBar { width: parent.width; value: 0.9; fillColor: Theme.colors.success }
|
||||||
|
}
|
||||||
|
|
||||||
|
Tooltip { text: "Tooltip bubble" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Base panel/card chrome shared by menus, pickers, and dialogs: rounded
|
||||||
|
// background, border, optional colored glow.
|
||||||
|
Rectangle {
|
||||||
|
id: surface
|
||||||
|
|
||||||
|
property color tint: Theme.colors.border
|
||||||
|
property bool glow: false
|
||||||
|
|
||||||
|
radius: Theme.geometry.radiusMedium
|
||||||
|
color: Theme.colors.background
|
||||||
|
border.color: tint
|
||||||
|
border.width: 1
|
||||||
|
|
||||||
|
layer.enabled: glow
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: surface.tint
|
||||||
|
shadowOpacity: Theme.elevation.medium.opacity
|
||||||
|
shadowBlur: Theme.elevation.medium.blur
|
||||||
|
shadowVerticalOffset: 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Search/filter input with an animated focus border + glow, shared by
|
||||||
|
// CommandPalette and ClipboardManager. Navigation is exposed as signals
|
||||||
|
// (rather than exposing the inner TextInput's Keys handlers directly) so
|
||||||
|
// each caller can wire up its own list navigation.
|
||||||
|
Rectangle {
|
||||||
|
id: field
|
||||||
|
|
||||||
|
property alias text: input.text
|
||||||
|
property alias echoMode: input.echoMode
|
||||||
|
property string placeholder: ""
|
||||||
|
|
||||||
|
signal escapePressed()
|
||||||
|
signal upPressed()
|
||||||
|
signal downPressed()
|
||||||
|
signal returnPressed()
|
||||||
|
signal deleteRequested()
|
||||||
|
|
||||||
|
function focusInput() { input.forceActiveFocus(); }
|
||||||
|
|
||||||
|
height: 50
|
||||||
|
color: Theme.colors.surface
|
||||||
|
radius: Theme.geometry.radiusSmall
|
||||||
|
border.width: 1
|
||||||
|
border.color: input.activeFocus ? Theme.colors.primary : Theme.colors.border
|
||||||
|
|
||||||
|
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
|
layer.enabled: input.activeFocus
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: Theme.colors.primary
|
||||||
|
shadowOpacity: Theme.elevation.low.opacity
|
||||||
|
shadowBlur: Theme.elevation.low.blur
|
||||||
|
shadowHorizontalOffset: 0
|
||||||
|
shadowVerticalOffset: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
TextInput {
|
||||||
|
id: input
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.geometry.padding
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 18
|
||||||
|
color: Theme.colors.text
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: field.placeholder
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 18
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: input.text.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onEscapePressed: (event) => { field.escapePressed(); event.accepted = true; }
|
||||||
|
Keys.onUpPressed: (event) => { field.upPressed(); event.accepted = true; }
|
||||||
|
Keys.onDownPressed: (event) => { field.downPressed(); event.accepted = true; }
|
||||||
|
Keys.onReturnPressed: (event) => { field.returnPressed(); event.accepted = true; }
|
||||||
|
Keys.onPressed: (event) => {
|
||||||
|
if (event.key === Qt.Key_Delete || (event.key === Qt.Key_Backspace && input.text.length === 0)) {
|
||||||
|
field.deleteRequested();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
pragma Singleton
|
||||||
|
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"
|
||||||
|
property color surface: "#cc181825"
|
||||||
|
property color surfaceHover: "#f2313244"
|
||||||
|
property color overlay: "#6011111b"
|
||||||
|
|
||||||
|
property color primary: "#74c7ec"
|
||||||
|
property color secondary: "#cba6f7"
|
||||||
|
property color tertiary: "#a6e3a1"
|
||||||
|
property color accent: "#74c7ec"
|
||||||
|
|
||||||
|
property color primaryContainer: "#2474c7ec"
|
||||||
|
property color secondaryContainer: "#24cba6f7"
|
||||||
|
property color tertiaryContainer: "#24a6e3a1"
|
||||||
|
|
||||||
|
property color alert: "#f38ba8"
|
||||||
|
property color alertContainer: "#24f38ba8"
|
||||||
|
property color success: "#a6e3a1"
|
||||||
|
property color successContainer: "#24a6e3a1"
|
||||||
|
property color warning: "#f9e2af"
|
||||||
|
property color warningContainer: "#24f9e2af"
|
||||||
|
property color info: "#74c7ec"
|
||||||
|
property color infoContainer: "#2474c7ec"
|
||||||
|
|
||||||
|
property color text: "#cdd6f4"
|
||||||
|
property color textMuted: "#a6adc8"
|
||||||
|
property color textOnAccent: "#e611111b"
|
||||||
|
|
||||||
|
property color border: "#1a74c7ec"
|
||||||
|
}
|
||||||
|
// GENERATED:COLORS:END
|
||||||
|
|
||||||
|
property QtObject geometry: QtObject {
|
||||||
|
property int radiusTiny: 6
|
||||||
|
property int radiusSmall: 8
|
||||||
|
property int radiusMedium: 10
|
||||||
|
property int pillRadius: 100
|
||||||
|
property int padding: 12
|
||||||
|
property int spacing: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject animation: QtObject {
|
||||||
|
property int durationFast: 150
|
||||||
|
property int durationNormal: 250
|
||||||
|
property int durationSlow: 400
|
||||||
|
}
|
||||||
|
|
||||||
|
// Named spring presets, so call sites stop hand-rolling
|
||||||
|
// `SpringAnimation { spring: 4; damping: 0.3 }` with slightly different
|
||||||
|
// numbers each time.
|
||||||
|
property QtObject motion: QtObject {
|
||||||
|
property QtObject springSnappy: QtObject { property real spring: 4; property real damping: 0.3 }
|
||||||
|
property QtObject springSoft: QtObject { property real spring: 3; property real damping: 0.2 }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type scale. Family stays fixed - this is only about size/weight steps.
|
||||||
|
property QtObject type: QtObject {
|
||||||
|
property int caption: 11
|
||||||
|
property int body: 13
|
||||||
|
property int label: 14
|
||||||
|
property int title: 18
|
||||||
|
property int display: 24
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject iconSize: QtObject {
|
||||||
|
property int small: 14
|
||||||
|
property int medium: 18
|
||||||
|
property int large: 24
|
||||||
|
}
|
||||||
|
|
||||||
|
// Named shadow presets for MultiEffect glows, keyed by how prominent the
|
||||||
|
// glow should read (e.g. hover vs. focus vs. an always-on active state).
|
||||||
|
property QtObject elevation: QtObject {
|
||||||
|
property QtObject low: QtObject { property real blur: 0.4; property real opacity: 0.35 }
|
||||||
|
property QtObject medium: QtObject { property real blur: 0.6; property real opacity: 0.5 }
|
||||||
|
property QtObject high: QtObject { property real blur: 0.8; property real opacity: 0.65 }
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject font: QtObject {
|
||||||
|
property string family: "JetBrainsMono Nerd Font"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import QtQuick
|
||||||
|
import "."
|
||||||
|
|
||||||
|
// Shared tooltip bubble visual. Host inside a click-through overlay
|
||||||
|
// PanelWindow (see Bar/TrayTooltip.qml) - this only draws the label chrome.
|
||||||
|
Rectangle {
|
||||||
|
id: bubble
|
||||||
|
|
||||||
|
property string text: ""
|
||||||
|
|
||||||
|
radius: Theme.geometry.radiusMedium
|
||||||
|
color: Theme.colors.background
|
||||||
|
border.color: Theme.colors.border
|
||||||
|
border.width: 1
|
||||||
|
width: label.implicitWidth + Theme.geometry.padding * 2
|
||||||
|
height: label.implicitHeight + Theme.geometry.padding
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: label
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: bubble.text
|
||||||
|
color: Theme.colors.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
singleton Theme 1.0 Theme.qml
|
||||||
|
Button 1.0 Button.qml
|
||||||
|
ContextMenu 1.0 ContextMenu.qml
|
||||||
|
Surface 1.0 Surface.qml
|
||||||
|
Pill 1.0 Pill.qml
|
||||||
|
TextField 1.0 TextField.qml
|
||||||
|
ProgressBar 1.0 ProgressBar.qml
|
||||||
|
Tooltip 1.0 Tooltip.qml
|
||||||
|
Showcase 1.0 Showcase.qml
|
||||||
|
ListRow 1.0 ListRow.qml
|
||||||
|
HintBar 1.0 HintBar.qml
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Io
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
spacing: 8
|
|
||||||
|
|
||||||
// State properties
|
|
||||||
property string wifiSsid: ""
|
|
||||||
property bool btConnected: false
|
|
||||||
property string batteryPct: ""
|
|
||||||
property bool isCharging: false
|
|
||||||
|
|
||||||
// Visibility
|
|
||||||
property var monitor: null
|
|
||||||
property bool exclusiveToScreen: false
|
|
||||||
|
|
||||||
// Poller
|
|
||||||
Timer {
|
|
||||||
interval: 3000
|
|
||||||
running: true
|
|
||||||
repeat: true
|
|
||||||
triggeredOnStart: true
|
|
||||||
onTriggered: {
|
|
||||||
wifiProcess.running = true
|
|
||||||
btProcess.running = true
|
|
||||||
batProcess.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wifi
|
|
||||||
Process {
|
|
||||||
id: wifiProcess
|
|
||||||
command: ["sh", "-c", "nmcli -t -f active,ssid dev wifi | grep '^yes' | cut -d: -f2"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
wifiSsid = text.trim();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: function(code, status) {
|
|
||||||
if (code !== 0) wifiSsid = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bluetooth
|
|
||||||
Process {
|
|
||||||
id: btProcess
|
|
||||||
command: ["sh", "-c", "bluetoothctl info | grep 'Connected: yes'"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
btConnected = text.trim().length > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onExited: function(code, status) {
|
|
||||||
if (code !== 0) btConnected = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Battery
|
|
||||||
Process {
|
|
||||||
id: batProcess
|
|
||||||
command: ["sh", "-c", "if ls /sys/class/power_supply/BAT* >/dev/null 2>&1; then cat /sys/class/power_supply/BAT*/capacity | head -n1; cat /sys/class/power_supply/BAT*/status | head -n1; fi"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
var lines = text.trim().split("\n");
|
|
||||||
if (lines.length >= 2) {
|
|
||||||
batteryPct = lines[0];
|
|
||||||
isCharging = (lines[1] === "Charging");
|
|
||||||
} else {
|
|
||||||
batteryPct = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// UI Elements
|
|
||||||
ModuleContainer {
|
|
||||||
monitor: parent.monitor
|
|
||||||
exclusiveToScreen: parent.exclusiveToScreen
|
|
||||||
active: wifiSsid !== ""
|
|
||||||
pillColor: Theme.primary
|
|
||||||
icon: ""
|
|
||||||
text: wifiSsid
|
|
||||||
}
|
|
||||||
|
|
||||||
ModuleContainer {
|
|
||||||
monitor: parent.monitor
|
|
||||||
exclusiveToScreen: parent.exclusiveToScreen
|
|
||||||
active: btConnected
|
|
||||||
pillColor: Theme.primary
|
|
||||||
icon: ""
|
|
||||||
text: "Connected"
|
|
||||||
}
|
|
||||||
|
|
||||||
ModuleContainer {
|
|
||||||
monitor: parent.monitor
|
|
||||||
exclusiveToScreen: parent.exclusiveToScreen
|
|
||||||
active: batteryPct !== ""
|
|
||||||
pillColor: Theme.accent
|
|
||||||
icon: isCharging ? "" : ""
|
|
||||||
text: batteryPct + "%"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
||||||
|
|
||||||
|
Surface {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: isCurrent ? 240 : 150
|
||||||
|
height: isCurrent ? 320 : 200
|
||||||
|
color: Theme.colors.surface
|
||||||
|
tint: delegateRoot.isCurrent ? Theme.colors.primary : Theme.colors.border
|
||||||
|
border.width: delegateRoot.isCurrent ? 2 : 1
|
||||||
|
opacity: delegateRoot.isCurrent ? 1.0 : 0.5
|
||||||
|
glow: delegateRoot.isCurrent
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Hyprland
|
|
||||||
import "../core"
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: root
|
|
||||||
spacing: 4
|
|
||||||
|
|
||||||
property var monitor: null
|
|
||||||
|
|
||||||
Repeater {
|
|
||||||
model: Hyprland.workspaces
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
|
||||||
property var ws: modelData
|
|
||||||
|
|
||||||
// Only show workspaces belonging to the specific monitor
|
|
||||||
visible: root.monitor === null || (ws.monitor && ws.monitor.name === root.monitor.name)
|
|
||||||
|
|
||||||
width: visible ? 28 : 0
|
|
||||||
height: visible ? 28 : 0
|
|
||||||
radius: Theme.radius / 2
|
|
||||||
|
|
||||||
// Highlight if active
|
|
||||||
color: ws.isActive ? Theme.primary : Theme.bgAlt
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
text: ws.id
|
|
||||||
color: ws.isActive ? Theme.bg : Theme.fg
|
|
||||||
font: Theme.fontBold
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
onClicked: Hyprland.dispatch("workspace", ws.id)
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
Workspaces Workspaces.qml
|
|
||||||
Clock Clock.qml
|
|
||||||
StatusIndicators StatusIndicators.qml
|
|
||||||
NotificationDaemon NotificationDaemon.qml
|
|
||||||
ModuleContainer ModuleContainer.qml
|
|
||||||
AppLauncherWindow AppLauncherWindow.qml
|
|
||||||
ClipboardPickerWindow ClipboardPickerWindow.qml
|
|
||||||
PowerMenuWindow PowerMenuWindow.qml
|
|
||||||
@@ -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 +0,0 @@
|
|||||||
singleton Theme Theme.qml
|
|
||||||
@@ -1,85 +1,150 @@
|
|||||||
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell.Hyprland
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import "components"
|
|
||||||
import "core"
|
|
||||||
|
|
||||||
Scope {
|
import "components/Bar"
|
||||||
Variants {
|
import "components/CommandPalette"
|
||||||
model: Quickshell.screens
|
import "components/OSD"
|
||||||
delegate: Component {
|
import "components/Shared"
|
||||||
PanelWindow {
|
import "components/LogoutMenu"
|
||||||
id: topBar
|
import "components/ClipboardManager"
|
||||||
|
import "components/Notifications"
|
||||||
|
import "components/WallpaperPicker"
|
||||||
|
import "components/LockScreen"
|
||||||
|
|
||||||
required property var modelData
|
ShellRoot {
|
||||||
property var hyprMonitor: Hyprland.monitorFor(modelData)
|
id: root
|
||||||
|
|
||||||
screen: modelData
|
// --- Global State ---
|
||||||
|
property bool commandPaletteOpen: false
|
||||||
|
property bool logoutMenuOpen: false
|
||||||
|
property bool clipboardManagerOpen: false
|
||||||
|
property bool wallpaperPickerOpen: false
|
||||||
|
|
||||||
anchors {
|
IpcHandler {
|
||||||
top: true
|
target: "commandPalette"
|
||||||
left: true
|
function toggle() {
|
||||||
right: true
|
commandPaletteOpen = !commandPaletteOpen;
|
||||||
}
|
if (commandPaletteOpen) {
|
||||||
implicitHeight: 32 + 8 // Changed to implicitHeight per warnings
|
logoutMenuOpen = false;
|
||||||
color: "transparent"
|
clipboardManagerOpen = false;
|
||||||
exclusiveZone: implicitHeight
|
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: 8
|
|
||||||
anchors.leftMargin: Theme.padding
|
|
||||||
anchors.rightMargin: Theme.padding
|
|
||||||
|
|
||||||
// Left: Workspaces
|
|
||||||
RowLayout {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
// Wrap workspaces in a solid pill
|
|
||||||
ModuleContainer {
|
|
||||||
pillColor: Theme.bgAlt
|
|
||||||
customContent: Component {
|
|
||||||
Workspaces {
|
|
||||||
monitor: hyprMonitor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Center: Clock
|
|
||||||
RowLayout {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
|
|
||||||
Clock {
|
|
||||||
pillColor: Theme.primary
|
|
||||||
monitor: hyprMonitor
|
|
||||||
exclusiveToScreen: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Right: Status Indicators
|
|
||||||
RowLayout {
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
StatusIndicators {
|
|
||||||
monitor: hyprMonitor
|
|
||||||
exclusiveToScreen: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notification Daemon (Global, usually tied to primary monitor or floating)
|
IpcHandler {
|
||||||
NotificationDaemon {}
|
target: "logoutMenu"
|
||||||
|
function toggle() {
|
||||||
|
logoutMenuOpen = !logoutMenuOpen;
|
||||||
|
if (logoutMenuOpen) {
|
||||||
|
commandPaletteOpen = false;
|
||||||
|
clipboardManagerOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Global floating widget windows
|
IpcHandler {
|
||||||
AppLauncherWindow {}
|
target: "clipboardManager"
|
||||||
ClipboardPickerWindow {}
|
function toggle() {
|
||||||
PowerMenuWindow {}
|
clipboardManagerOpen = !clipboardManagerOpen;
|
||||||
|
if (clipboardManagerOpen) {
|
||||||
|
commandPaletteOpen = false;
|
||||||
|
logoutMenuOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "osd"
|
||||||
|
function showVolume() {
|
||||||
|
osd.show("volume");
|
||||||
|
}
|
||||||
|
function showBrightness() {
|
||||||
|
osd.show("brightness");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
Bar {
|
||||||
|
id: bar
|
||||||
|
rootState: root
|
||||||
|
trayTooltip: trayTooltip
|
||||||
|
}
|
||||||
|
|
||||||
|
CommandPalette {
|
||||||
|
id: commandPalette
|
||||||
|
rootState: root
|
||||||
|
}
|
||||||
|
|
||||||
|
LogoutMenu {
|
||||||
|
id: logoutMenu
|
||||||
|
rootState: root
|
||||||
|
}
|
||||||
|
|
||||||
|
ClipboardManager {
|
||||||
|
id: clipboardManager
|
||||||
|
rootState: root
|
||||||
|
}
|
||||||
|
|
||||||
|
OSD {
|
||||||
|
id: osd
|
||||||
|
}
|
||||||
|
|
||||||
|
Notifications {
|
||||||
|
id: notifications
|
||||||
|
}
|
||||||
|
|
||||||
|
WallpaperPicker {
|
||||||
|
id: wallpaperPicker
|
||||||
|
rootState: root
|
||||||
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "showcase"
|
||||||
|
function toggle() {
|
||||||
|
showcase.open = !showcase.open;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Showcase {
|
||||||
|
id: showcase
|
||||||
|
}
|
||||||
|
|
||||||
|
// No unlock/toggle exposed here on purpose: unlocking only ever happens
|
||||||
|
// through a successful PamContext result inside LockScreen.qml.
|
||||||
|
IpcHandler {
|
||||||
|
target: "lockScreen"
|
||||||
|
function lock() {
|
||||||
|
lockScreen.locked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LockScreen {
|
||||||
|
id: lockScreen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
import QtQuick
|
||||||
|
import SddmComponents 2.0
|
||||||
|
import "components"
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: root
|
||||||
|
width: Screen.width
|
||||||
|
height: Screen.height
|
||||||
|
color: Theme.colors.background
|
||||||
|
|
||||||
|
// Background Image
|
||||||
|
Image {
|
||||||
|
id: bgImage
|
||||||
|
anchors.fill: parent
|
||||||
|
// SDDM loads the theme.conf, but since we want the dynamic user wallpaper,
|
||||||
|
// we can try reading it if SDDM has permissions, or fallback to theme.conf.
|
||||||
|
// Usually, SDDM runs as user 'sddm' and might not have access to ~/.config/current-wallpaper.
|
||||||
|
// We will default to theme.conf's background.
|
||||||
|
source: config.background
|
||||||
|
fillMode: Image.PreserveAspectCrop
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Theme.colors.background
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: lockSurface
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
property QtObject battery: QtObject {
|
||||||
|
property bool isPresent: false
|
||||||
|
property real percentage: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
spacing: Theme.geometry.spacing * 3
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
property date currentTime: new Date()
|
||||||
|
Timer {
|
||||||
|
interval: 1000; running: true; repeat: true
|
||||||
|
onTriggered: parent.currentTime = new Date()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: Qt.formatDateTime(parent.currentTime, "hh:mm")
|
||||||
|
color: Theme.colors.text
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: 96
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: Qt.formatDateTime(parent.currentTime, "dddd, d MMMM")
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.title
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Battery section kept just in case you find a way to populate it,
|
||||||
|
// but hidden by default via isPresent: false
|
||||||
|
Row {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
visible: lockSurface.battery.isPresent
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: Math.round(lockSurface.battery.percentage * 100) + "%"
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.body
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: passwordShake
|
||||||
|
width: 320
|
||||||
|
height: passwordField.height
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
|
||||||
|
SequentialAnimation {
|
||||||
|
id: shakeAnim
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: -8; duration: 40 }
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: 8; duration: 40 }
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: -6; duration: 40 }
|
||||||
|
NumberAnimation { target: passwordShake; property: "x"; to: 0; duration: 40 }
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: sddm
|
||||||
|
function onLoginFailed() {
|
||||||
|
passwordField.text = ""
|
||||||
|
errorText.text = "Incorrect password"
|
||||||
|
shakeAnim.start()
|
||||||
|
}
|
||||||
|
function onLoginSucceeded() {
|
||||||
|
errorText.text = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: passwordField
|
||||||
|
width: parent.width
|
||||||
|
placeholder: "Password for " + userModel.lastUser
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
|
||||||
|
onReturnPressed: {
|
||||||
|
if (text.length > 0) {
|
||||||
|
sddm.login(userModel.lastUser, text, sessionModel.lastIndex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: errorText
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
text: ""
|
||||||
|
visible: text.length > 0
|
||||||
|
color: Theme.colors.alert
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
}
|
||||||
|
|
||||||
|
HintBar {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
hints: [ { key: "↵", label: "Unlock" } ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
passwordField.focusInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
|
||||||
|
// Row of "key label" keyboard hints shown under launcher-style overlays,
|
||||||
|
// e.g. [ [↑↓, "Navigate"], ["↵", "Launch"], ["Esc", "Close"] ].
|
||||||
|
Row {
|
||||||
|
id: hintBar
|
||||||
|
|
||||||
|
property var hints: []
|
||||||
|
|
||||||
|
spacing: Theme.geometry.spacing * 2
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: hintBar.hints
|
||||||
|
|
||||||
|
delegate: Row {
|
||||||
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.key
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.bold: true
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: modelData.label
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Effects
|
||||||
|
|
||||||
|
|
||||||
|
// Search/filter input with an animated focus border + glow, shared by
|
||||||
|
// CommandPalette and ClipboardManager. Navigation is exposed as signals
|
||||||
|
// (rather than exposing the inner TextInput's Keys handlers directly) so
|
||||||
|
// each caller can wire up its own list navigation.
|
||||||
|
Rectangle {
|
||||||
|
id: field
|
||||||
|
|
||||||
|
property alias text: input.text
|
||||||
|
property alias echoMode: input.echoMode
|
||||||
|
property string placeholder: ""
|
||||||
|
|
||||||
|
signal escapePressed()
|
||||||
|
signal upPressed()
|
||||||
|
signal downPressed()
|
||||||
|
signal returnPressed()
|
||||||
|
signal deleteRequested()
|
||||||
|
|
||||||
|
function focusInput() { input.forceActiveFocus(); }
|
||||||
|
|
||||||
|
height: 50
|
||||||
|
color: Theme.colors.surface
|
||||||
|
radius: Theme.geometry.radiusSmall
|
||||||
|
border.width: 1
|
||||||
|
border.color: input.activeFocus ? Theme.colors.primary : Theme.colors.border
|
||||||
|
|
||||||
|
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
|
layer.enabled: input.activeFocus
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: Theme.colors.primary
|
||||||
|
shadowOpacity: Theme.elevation.low.opacity
|
||||||
|
shadowBlur: Theme.elevation.low.blur
|
||||||
|
shadowHorizontalOffset: 0
|
||||||
|
shadowVerticalOffset: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
TextInput {
|
||||||
|
id: input
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Theme.geometry.padding
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 18
|
||||||
|
color: Theme.colors.text
|
||||||
|
clip: true
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: field.placeholder
|
||||||
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: 18
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: input.text.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onEscapePressed: (event) => { field.escapePressed(); event.accepted = true; }
|
||||||
|
Keys.onUpPressed: (event) => { field.upPressed(); event.accepted = true; }
|
||||||
|
Keys.onDownPressed: (event) => { field.downPressed(); event.accepted = true; }
|
||||||
|
Keys.onReturnPressed: (event) => { field.returnPressed(); event.accepted = true; }
|
||||||
|
Keys.onPressed: (event) => {
|
||||||
|
if (event.key === Qt.Key_Delete || (event.key === Qt.Key_Backspace && input.text.length === 0)) {
|
||||||
|
field.deleteRequested();
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
pragma Singleton
|
||||||
|
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"
|
||||||
|
property color surface: "#cc181825"
|
||||||
|
property color surfaceHover: "#f2313244"
|
||||||
|
property color overlay: "#6011111b"
|
||||||
|
|
||||||
|
property color primary: "#74c7ec"
|
||||||
|
property color secondary: "#cba6f7"
|
||||||
|
property color tertiary: "#a6e3a1"
|
||||||
|
property color accent: "#74c7ec"
|
||||||
|
|
||||||
|
property color primaryContainer: "#2474c7ec"
|
||||||
|
property color secondaryContainer: "#24cba6f7"
|
||||||
|
property color tertiaryContainer: "#24a6e3a1"
|
||||||
|
|
||||||
|
property color alert: "#f38ba8"
|
||||||
|
property color alertContainer: "#24f38ba8"
|
||||||
|
property color success: "#a6e3a1"
|
||||||
|
property color successContainer: "#24a6e3a1"
|
||||||
|
property color warning: "#f9e2af"
|
||||||
|
property color warningContainer: "#24f9e2af"
|
||||||
|
property color info: "#74c7ec"
|
||||||
|
property color infoContainer: "#2474c7ec"
|
||||||
|
|
||||||
|
property color text: "#cdd6f4"
|
||||||
|
property color textMuted: "#a6adc8"
|
||||||
|
property color textOnAccent: "#e611111b"
|
||||||
|
|
||||||
|
property color border: "#1a74c7ec"
|
||||||
|
}
|
||||||
|
// GENERATED:COLORS:END
|
||||||
|
|
||||||
|
property QtObject geometry: QtObject {
|
||||||
|
property int radiusTiny: 6
|
||||||
|
property int radiusSmall: 8
|
||||||
|
property int radiusMedium: 10
|
||||||
|
property int pillRadius: 100
|
||||||
|
property int padding: 12
|
||||||
|
property int spacing: 8
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject animation: QtObject {
|
||||||
|
property int durationFast: 150
|
||||||
|
property int durationNormal: 250
|
||||||
|
property int durationSlow: 400
|
||||||
|
}
|
||||||
|
|
||||||
|
// Named spring presets, so call sites stop hand-rolling
|
||||||
|
// `SpringAnimation { spring: 4; damping: 0.3 }` with slightly different
|
||||||
|
// numbers each time.
|
||||||
|
property QtObject motion: QtObject {
|
||||||
|
property QtObject springSnappy: QtObject { property real spring: 4; property real damping: 0.3 }
|
||||||
|
property QtObject springSoft: QtObject { property real spring: 3; property real damping: 0.2 }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type scale. Family stays fixed - this is only about size/weight steps.
|
||||||
|
property QtObject type: QtObject {
|
||||||
|
property int caption: 11
|
||||||
|
property int body: 13
|
||||||
|
property int label: 14
|
||||||
|
property int title: 18
|
||||||
|
property int display: 24
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject iconSize: QtObject {
|
||||||
|
property int small: 14
|
||||||
|
property int medium: 18
|
||||||
|
property int large: 24
|
||||||
|
}
|
||||||
|
|
||||||
|
// Named shadow presets for MultiEffect glows, keyed by how prominent the
|
||||||
|
// glow should read (e.g. hover vs. focus vs. an always-on active state).
|
||||||
|
property QtObject elevation: QtObject {
|
||||||
|
property QtObject low: QtObject { property real blur: 0.4; property real opacity: 0.35 }
|
||||||
|
property QtObject medium: QtObject { property real blur: 0.6; property real opacity: 0.5 }
|
||||||
|
property QtObject high: QtObject { property real blur: 0.8; property real opacity: 0.65 }
|
||||||
|
}
|
||||||
|
|
||||||
|
property QtObject font: QtObject {
|
||||||
|
property string family: "JetBrainsMono Nerd Font"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
singleton Theme 1.0 Theme.qml
|
||||||
|
TextField 1.0 TextField.qml
|
||||||
|
HintBar 1.0 HintBar.qml
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[SddmGreeterTheme]
|
||||||
|
Name=Quickshell Login
|
||||||
|
Description=A theme ported from my Quickshell lockscreen
|
||||||
|
Author=Johannes
|
||||||
|
Version=1.0
|
||||||
|
Type=sddm-theme
|
||||||
|
MainScript=Main.qml
|
||||||
|
ConfigFile=theme.conf
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[General]
|
||||||
|
background=
|
||||||
Reference in new issue
Block a user