feat: colorful multi-accent quickshell design system
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A8TNMgnEa7Kia5Wcz2kyDx
This commit is contained in:
1 parent
5a004b8be5
commit
215d8b7d8e
23 files changed
+878
-382
No files matched your search
@@ -1,19 +1,16 @@
|
|||||||
#!/usr/bin/env nu
|
#!/usr/bin/env nu
|
||||||
# Derives a Catppuccin flavor + accent from a wallpaper's average color and
|
# Derives a Catppuccin flavor + a trio of accents from a wallpaper's dominant
|
||||||
# applies it system-wide. No manual override - the wallpaper is the source of truth.
|
# 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 [] {
|
def palette [] {
|
||||||
open ($"($env.HOME)/.dotfiles/config/themes/catppuccin/palette.json")
|
open ($"($env.HOME)/.dotfiles/config/themes/catppuccin/palette.json")
|
||||||
}
|
}
|
||||||
|
|
||||||
def average-color [path: string] {
|
def hex-byte [] {
|
||||||
let out = (magick $path -resize 1x1 txt:- | lines | skip 1 | first)
|
# "into int -r 16" misreads byte pairs like "0b" as a binary literal prefix.
|
||||||
let matches = ($out | parse --regex '\((?P<r>\d+),(?P<g>\d+),(?P<b>\d+)\)')
|
$"0x($in)" | into int
|
||||||
if ($matches | is-empty) {
|
|
||||||
error make { msg: $"could not read average color from ($path)" }
|
|
||||||
}
|
|
||||||
let m = ($matches | first)
|
|
||||||
{ r: ($m.r | into int), g: ($m.g | into int), b: ($m.b | into int) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def rgb-to-hsl [rgb: record<r: int, g: int, b: int>] {
|
def rgb-to-hsl [rgb: record<r: int, g: int, b: int>] {
|
||||||
@@ -45,29 +42,30 @@ def rgb-to-hsl [rgb: record<r: int, g: int, b: int>] {
|
|||||||
{ h: $h, s: $s, l: $l }
|
{ h: $h, s: $s, l: $l }
|
||||||
}
|
}
|
||||||
|
|
||||||
def hex-byte [] {
|
|
||||||
# "into int -r 16" misreads byte pairs like "0b" as a binary literal prefix.
|
|
||||||
$"0x($in)" | into int
|
|
||||||
}
|
|
||||||
|
|
||||||
def hue-dist [a: float, b: float] {
|
def hue-dist [a: float, b: float] {
|
||||||
let diff = (($a - $b) | math abs)
|
let diff = (($a - $b) | math abs)
|
||||||
[$diff, 360 - $diff] | math min
|
[$diff, 360 - $diff] | math min
|
||||||
}
|
}
|
||||||
|
|
||||||
def pick-flavor [rgb: record<r: int, g: int, b: int>] {
|
# Wallpaper's dominant colors, ranked by pixel count (descending). Replaces
|
||||||
let luma = (0.299 * $rgb.r + 0.587 * $rgb.g + 0.114 * $rgb.b) / 255
|
# the old single 1x1-resize average-color sample, which always produced one
|
||||||
if $luma < 0.5 { "mocha" } else { "latte" }
|
# 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 pick-accent [flavor: string, rgb: record<r: int, g: int, b: int>] {
|
def accent-list [flavor: string] {
|
||||||
let wallpaper_hsl = (rgb-to-hsl $rgb)
|
|
||||||
|
|
||||||
# Near-gray wallpapers don't carry a meaningful hue - fall back to mauve.
|
|
||||||
if $wallpaper_hsl.s < 0.12 {
|
|
||||||
return "mauve"
|
|
||||||
}
|
|
||||||
|
|
||||||
let accents = (palette | get $flavor | get accents)
|
let accents = (palette | get $flavor | get accents)
|
||||||
$accents
|
$accents
|
||||||
| columns
|
| columns
|
||||||
@@ -76,18 +74,74 @@ def pick-accent [flavor: string, rgb: record<r: int, g: int, b: int>] {
|
|||||||
let r = ($hex | str substring 1..2 | hex-byte)
|
let r = ($hex | str substring 1..2 | hex-byte)
|
||||||
let g = ($hex | str substring 3..4 | hex-byte)
|
let g = ($hex | str substring 3..4 | hex-byte)
|
||||||
let b = ($hex | str substring 5..6 | hex-byte)
|
let b = ($hex | str substring 5..6 | hex-byte)
|
||||||
let accent_hsl = (rgb-to-hsl { r: $r, g: $g, b: $b })
|
{ name: $name, hsl: (rgb-to-hsl { r: $r, g: $g, b: $b }) }
|
||||||
{ name: $name, dist: (hue-dist $wallpaper_hsl.h $accent_hsl.h) }
|
|
||||||
}
|
}
|
||||||
| sort-by dist
|
|
||||||
| first
|
|
||||||
| get name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def write-theme-colors [flavor: string, accent_name: string] {
|
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 p = (palette | get $flavor)
|
||||||
let accent = ($p.accents | get $accent_name)
|
let primary = ($p.accents | get $accent_names.0)
|
||||||
let border = $"#1a($accent | str substring 1..)" # accent-tinted, ~10% opacity
|
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 = [
|
let colors = [
|
||||||
$" property color background: \"#e6($p.crust | str substring 1..)\""
|
$" property color background: \"#e6($p.crust | str substring 1..)\""
|
||||||
@@ -95,15 +149,27 @@ def write-theme-colors [flavor: string, accent_name: string] {
|
|||||||
$" property color surfaceHover: \"#f2($p.surface0 | str substring 1..)\""
|
$" property color surfaceHover: \"#f2($p.surface0 | str substring 1..)\""
|
||||||
$" property color overlay: \"#60($p.crust | str substring 1..)\""
|
$" property color overlay: \"#60($p.crust | str substring 1..)\""
|
||||||
""
|
""
|
||||||
$" property color primary: \"($accent)\""
|
$" property color primary: \"($primary)\""
|
||||||
$" property color secondary: \"($p.accents.lavender)\""
|
$" property color secondary: \"($secondary)\""
|
||||||
$" property color accent: \"($accent)\""
|
$" 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 alert: \"($p.red)\""
|
||||||
|
$" property color alertContainer: \"(container-tint $p.red)\""
|
||||||
$" property color success: \"($p.green)\""
|
$" property color success: \"($p.green)\""
|
||||||
|
$" property color successContainer: \"(container-tint $p.green)\""
|
||||||
$" property color warning: \"($p.yellow)\""
|
$" 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 text: \"($p.text)\""
|
||||||
$" property color textMuted: \"($p.subtext0)\""
|
$" property color textMuted: \"($p.subtext0)\""
|
||||||
|
$" property color textOnAccent: \"#e6($p.crust | str substring 1..)\""
|
||||||
""
|
""
|
||||||
$" property color border: \"($border)\""
|
$" property color border: \"($border)\""
|
||||||
]
|
]
|
||||||
@@ -177,10 +243,11 @@ def propagate [flavor: string] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def main [wallpaper_path: string] {
|
def main [wallpaper_path: string] {
|
||||||
let rgb = (average-color $wallpaper_path)
|
let swatches = (dominant-colors $wallpaper_path 8)
|
||||||
let flavor = (pick-flavor $rgb)
|
let top = ($swatches | first)
|
||||||
let accent = (pick-accent $flavor $rgb)
|
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
|
write-theme-colors $flavor $accent_names
|
||||||
propagate $flavor
|
propagate $flavor
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -43,22 +43,14 @@ PanelWindow {
|
|||||||
WlrLayershell.layer: WlrLayer.Top
|
WlrLayershell.layer: WlrLayer.Top
|
||||||
WlrLayershell.namespace: "quickshell-bar"
|
WlrLayershell.namespace: "quickshell-bar"
|
||||||
|
|
||||||
// Left Pill (Workspaces + Battery)
|
// Left Pill (Workspaces) - tinted with the primary accent.
|
||||||
Rectangle {
|
Pill {
|
||||||
id: leftPill
|
id: leftPill
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: leftPillRow.width + Theme.geometry.padding * 2
|
tint: Theme.colors.primary
|
||||||
radius: Theme.geometry.pillRadius
|
glow: true
|
||||||
color: Theme.colors.surface
|
|
||||||
border.color: Theme.colors.border
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: leftPillRow
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.geometry.spacing
|
|
||||||
|
|
||||||
// Workspaces
|
// Workspaces
|
||||||
Row {
|
Row {
|
||||||
@@ -72,12 +64,14 @@ PanelWindow {
|
|||||||
radius: Theme.geometry.radiusTiny
|
radius: Theme.geometry.radiusTiny
|
||||||
color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover
|
color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: modelData.id
|
text: modelData.id
|
||||||
color: modelData.active ? Theme.colors.background : Theme.colors.text
|
color: modelData.active ? Theme.colors.textOnAccent : Theme.colors.text
|
||||||
font.family: Theme.font.family
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 12
|
font.pixelSize: Theme.type.caption
|
||||||
font.bold: modelData.active
|
font.bold: modelData.active
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,19 +84,15 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Center Pill (Clock)
|
// Center Pill (Clock) - tinted with the secondary accent.
|
||||||
Rectangle {
|
Pill {
|
||||||
id: centerPill
|
id: centerPill
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: clockText.width + Theme.geometry.padding * 4
|
tint: Theme.colors.secondary
|
||||||
radius: Theme.geometry.pillRadius
|
glow: true
|
||||||
color: Theme.colors.surface
|
|
||||||
border.color: Theme.colors.border
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
SystemClock {
|
SystemClock {
|
||||||
id: clock
|
id: clock
|
||||||
@@ -111,35 +101,27 @@ PanelWindow {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: clockText
|
id: clockText
|
||||||
anchors.centerIn: parent
|
|
||||||
text: Qt.formatDateTime(clock.date, "hh:mm")
|
text: Qt.formatDateTime(clock.date, "hh:mm")
|
||||||
color: Theme.colors.text
|
color: Theme.colors.secondary
|
||||||
font.family: Theme.font.family
|
font.family: Theme.font.family
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right Pill (System tray: WiFi, Bluetooth, Battery)
|
// Right Pill (System tray: CPU/RAM/temp stats, WiFi, Bluetooth, Battery)
|
||||||
// Hidden entirely when none of the tray icons have anything to show.
|
// Tinted with the tertiary accent; each stat/icon also carries its own
|
||||||
Rectangle {
|
// color so the pill reads as a set of distinct signals, not one blob.
|
||||||
|
Pill {
|
||||||
id: rightPill
|
id: rightPill
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: rightPillRow.width + Theme.geometry.padding * 2
|
tint: Theme.colors.tertiary
|
||||||
radius: Theme.geometry.pillRadius
|
|
||||||
color: Theme.colors.surface
|
|
||||||
border.color: Theme.colors.border
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
Row {
|
|
||||||
id: rightPillRow
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.geometry.spacing
|
|
||||||
|
|
||||||
StatIndicator {
|
StatIndicator {
|
||||||
glyph: "" // nf-fa-microchip
|
glyph: "" // nf-fa-microchip
|
||||||
text: sysStats.cpuPercent + "%"
|
text: sysStats.cpuPercent + "%"
|
||||||
|
tint: Theme.colors.tertiary
|
||||||
tooltip: "CPU usage: " + sysStats.cpuPercent + "%"
|
tooltip: "CPU usage: " + sysStats.cpuPercent + "%"
|
||||||
tooltipWindow: barWindow.trayTooltip
|
tooltipWindow: barWindow.trayTooltip
|
||||||
}
|
}
|
||||||
@@ -148,6 +130,12 @@ PanelWindow {
|
|||||||
visible: sysStats.cpuTemp.length > 0
|
visible: sysStats.cpuTemp.length > 0
|
||||||
glyph: "" // nf-fa-thermometer_half
|
glyph: "" // nf-fa-thermometer_half
|
||||||
text: sysStats.cpuTemp + "°"
|
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"
|
tooltip: "CPU temp: " + sysStats.cpuTemp + "°C"
|
||||||
tooltipWindow: barWindow.trayTooltip
|
tooltipWindow: barWindow.trayTooltip
|
||||||
}
|
}
|
||||||
@@ -155,6 +143,7 @@ PanelWindow {
|
|||||||
StatIndicator {
|
StatIndicator {
|
||||||
glyph: "" // nf-fa-server
|
glyph: "" // nf-fa-server
|
||||||
text: sysStats.ramPercent + "%"
|
text: sysStats.ramPercent + "%"
|
||||||
|
tint: Theme.colors.secondary
|
||||||
tooltip: "RAM usage: " + sysStats.ramPercent + "%"
|
tooltip: "RAM usage: " + sysStats.ramPercent + "%"
|
||||||
tooltipWindow: barWindow.trayTooltip
|
tooltipWindow: barWindow.trayTooltip
|
||||||
}
|
}
|
||||||
@@ -162,6 +151,7 @@ PanelWindow {
|
|||||||
TrayIcon {
|
TrayIcon {
|
||||||
glyph: "" // nf-fa-wifi
|
glyph: "" // nf-fa-wifi
|
||||||
active: wifiPoll.connected
|
active: wifiPoll.connected
|
||||||
|
tint: Theme.colors.primary
|
||||||
tooltip: "WiFi: " + wifiPoll.ssid
|
tooltip: "WiFi: " + wifiPoll.ssid
|
||||||
visible: wifiPoll.connected
|
visible: wifiPoll.connected
|
||||||
tooltipWindow: barWindow.trayTooltip
|
tooltipWindow: barWindow.trayTooltip
|
||||||
@@ -170,6 +160,7 @@ PanelWindow {
|
|||||||
TrayIcon {
|
TrayIcon {
|
||||||
glyph: "" // nf-fa-bluetooth_b
|
glyph: "" // nf-fa-bluetooth_b
|
||||||
active: true
|
active: true
|
||||||
|
tint: Theme.colors.secondary
|
||||||
tooltip: "Bluetooth: " + bluetoothPoll.connectedDevices
|
tooltip: "Bluetooth: " + bluetoothPoll.connectedDevices
|
||||||
visible: bluetoothPoll.connectedDevices.length > 0
|
visible: bluetoothPoll.connectedDevices.length > 0
|
||||||
tooltipWindow: barWindow.trayTooltip
|
tooltipWindow: barWindow.trayTooltip
|
||||||
@@ -179,13 +170,19 @@ PanelWindow {
|
|||||||
glyph: {
|
glyph: {
|
||||||
let p = battery.percentage;
|
let p = battery.percentage;
|
||||||
if (!battery.isPresent) return ""; // nf-fa-plug (desktop/no battery)
|
if (!battery.isPresent) return ""; // nf-fa-plug (desktop/no battery)
|
||||||
if (p >= 0.9) return "";
|
if (p >= 0.9) return ""; // nf-fa-battery_full
|
||||||
if (p >= 0.65) return "";
|
if (p >= 0.65) return ""; // nf-fa-battery_three_quarters
|
||||||
if (p >= 0.4) return "";
|
if (p >= 0.4) return ""; // nf-fa-battery_half
|
||||||
if (p >= 0.15) return "";
|
if (p >= 0.15) return ""; // nf-fa-battery_quarter
|
||||||
return "";
|
return ""; // nf-fa-battery_empty
|
||||||
}
|
}
|
||||||
active: battery.state === UPowerDeviceState.Charging
|
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
|
tooltip: battery.isPresent
|
||||||
? "Battery: " + Math.round(battery.percentage * 100) + "%"
|
? "Battery: " + Math.round(battery.percentage * 100) + "%"
|
||||||
+ (battery.state === UPowerDeviceState.Charging ? " (charging)" : "")
|
+ (battery.state === UPowerDeviceState.Charging ? " (charging)" : "")
|
||||||
@@ -194,7 +191,6 @@ PanelWindow {
|
|||||||
tooltipWindow: barWindow.trayTooltip
|
tooltipWindow: barWindow.trayTooltip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
property QtObject battery: UPower.displayDevice
|
property QtObject battery: UPower.displayDevice
|
||||||
|
|
||||||
@@ -342,10 +338,13 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inline component for a compact icon+text stat readout (CPU, temp, RAM).
|
// 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 {
|
component StatIndicator: Item {
|
||||||
id: statIndicator
|
id: statIndicator
|
||||||
property string glyph: ""
|
property string glyph: ""
|
||||||
property alias text: statText.text
|
property alias text: statText.text
|
||||||
|
property color tint: Theme.colors.text
|
||||||
property string tooltip: ""
|
property string tooltip: ""
|
||||||
property QtObject tooltipWindow
|
property QtObject tooltipWindow
|
||||||
|
|
||||||
@@ -361,16 +360,20 @@ PanelWindow {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: statIndicator.glyph
|
text: statIndicator.glyph
|
||||||
font.family: Theme.font.family
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 13
|
font.pixelSize: Theme.type.body
|
||||||
color: Theme.colors.text
|
color: statIndicator.tint
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: statText
|
id: statText
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: Theme.colors.text
|
color: statIndicator.tint
|
||||||
font.family: Theme.font.family
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 12
|
font.pixelSize: Theme.type.caption
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,12 +394,14 @@ PanelWindow {
|
|||||||
|
|
||||||
// Inline component for a hoverable tray icon. The tooltip itself is
|
// Inline component for a hoverable tray icon. The tooltip itself is
|
||||||
// rendered by the shared TrayTooltip overlay window (see tooltipWindow)
|
// rendered by the shared TrayTooltip overlay window (see tooltipWindow)
|
||||||
// so it isn't clipped by this bar's small surface.
|
// 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 {
|
component TrayIcon: Item {
|
||||||
id: trayIcon
|
id: trayIcon
|
||||||
property string glyph: ""
|
property string glyph: ""
|
||||||
property string tooltip: ""
|
property string tooltip: ""
|
||||||
property bool active: false
|
property bool active: false
|
||||||
|
property color tint: Theme.colors.primary
|
||||||
property QtObject tooltipWindow
|
property QtObject tooltipWindow
|
||||||
|
|
||||||
width: 24
|
width: 24
|
||||||
@@ -407,14 +412,18 @@ PanelWindow {
|
|||||||
radius: Theme.geometry.radiusTiny
|
radius: Theme.geometry.radiusTiny
|
||||||
color: hoverArea.containsMouse
|
color: hoverArea.containsMouse
|
||||||
? Theme.colors.surfaceHover
|
? Theme.colors.surfaceHover
|
||||||
: (trayIcon.active ? Qt.alpha(Theme.colors.primary, 0.15) : "transparent")
|
: (trayIcon.active ? Qt.alpha(trayIcon.tint, 0.15) : "transparent")
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: trayIcon.glyph
|
text: trayIcon.glyph
|
||||||
font.family: Theme.font.family
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 13
|
font.pixelSize: Theme.type.body
|
||||||
color: trayIcon.active ? Theme.colors.primary : Theme.colors.text
|
color: trayIcon.active ? trayIcon.tint : Theme.colors.text
|
||||||
|
|
||||||
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ PanelWindow {
|
|||||||
// Never accept input; this window only ever draws a small label.
|
// Never accept input; this window only ever draws a small label.
|
||||||
mask: Region {}
|
mask: Region {}
|
||||||
|
|
||||||
Rectangle {
|
Tooltip {
|
||||||
// anchorX is the icon's horizontal center; center this bubble on it,
|
// anchorX is the icon's horizontal center; center this bubble on it,
|
||||||
// clamped so it never runs past the screen edges.
|
// clamped so it never runs past the screen edges.
|
||||||
x: Math.max(
|
x: Math.max(
|
||||||
@@ -48,20 +48,6 @@ PanelWindow {
|
|||||||
Math.min(tooltipWindow.anchorX - width / 2, tooltipWindow.width - width - Theme.geometry.spacing)
|
Math.min(tooltipWindow.anchorX - width / 2, tooltipWindow.width - width - Theme.geometry.spacing)
|
||||||
)
|
)
|
||||||
y: tooltipWindow.anchorY
|
y: tooltipWindow.anchorY
|
||||||
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: tooltipWindow.shownText
|
text: tooltipWindow.shownText
|
||||||
color: Theme.colors.text
|
|
||||||
font.family: Theme.font.family
|
|
||||||
font.pixelSize: 11
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Effects
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
@@ -9,6 +8,10 @@ PanelWindow {
|
|||||||
id: clipboardWindow
|
id: clipboardWindow
|
||||||
property QtObject rootState
|
property QtObject rootState
|
||||||
|
|
||||||
|
readonly property int headerHeight: 50
|
||||||
|
readonly property int footerHeight: 24
|
||||||
|
readonly property int emptyStateHeight: 40
|
||||||
|
|
||||||
visible: rootState.clipboardManagerOpen
|
visible: rootState.clipboardManagerOpen
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
@@ -31,17 +34,19 @@ PanelWindow {
|
|||||||
onClicked: rootState.clipboardManagerOpen = false
|
onClicked: rootState.clipboardManagerOpen = false
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Surface {
|
||||||
id: container
|
id: container
|
||||||
width: 800
|
width: 800
|
||||||
height: Math.min(600, (clipList.count > 0 ? clipList.contentHeight : 0) + (searchInput.text.length > 0 ? 50 + Theme.geometry.spacing : 0) + Theme.geometry.padding * 2)
|
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
|
anchors.centerIn: parent
|
||||||
radius: Theme.geometry.radiusMedium
|
tint: Theme.colors.secondary
|
||||||
color: Theme.colors.background
|
glow: true
|
||||||
border.color: Theme.colors.border
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
Behavior on scale { SpringAnimation { spring: 3; damping: 0.2 } }
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } }
|
||||||
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
||||||
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } }
|
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } }
|
||||||
|
|
||||||
@@ -54,158 +59,150 @@ PanelWindow {
|
|||||||
Column {
|
Column {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.geometry.padding
|
anchors.margins: Theme.geometry.padding
|
||||||
spacing: searchInput.text.length > 0 ? Theme.geometry.spacing : 0
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
Rectangle {
|
TextField {
|
||||||
width: parent.width
|
|
||||||
height: searchInput.text.length > 0 ? 50 : 0
|
|
||||||
opacity: searchInput.text.length > 0 ? 1 : 0
|
|
||||||
clip: true
|
|
||||||
color: Theme.colors.surface
|
|
||||||
radius: Theme.geometry.radiusSmall
|
|
||||||
border.width: 1
|
|
||||||
border.color: searchInput.activeFocus ? Theme.colors.primary : Theme.colors.border
|
|
||||||
|
|
||||||
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast } }
|
|
||||||
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
|
||||||
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
|
|
||||||
|
|
||||||
layer.enabled: searchInput.activeFocus
|
|
||||||
layer.effect: MultiEffect {
|
|
||||||
shadowEnabled: true
|
|
||||||
shadowColor: Theme.colors.primary
|
|
||||||
shadowOpacity: 0.35
|
|
||||||
shadowBlur: 0.4
|
|
||||||
shadowHorizontalOffset: 0
|
|
||||||
shadowVerticalOffset: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
TextInput {
|
|
||||||
id: searchInput
|
id: searchInput
|
||||||
anchors.fill: parent
|
width: parent.width
|
||||||
anchors.margins: Theme.geometry.padding
|
height: clipboardWindow.headerHeight
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
placeholder: "Search clipboard..."
|
||||||
font.family: Theme.font.family
|
|
||||||
font.pixelSize: 18
|
|
||||||
color: Theme.colors.text
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Search clipboard..."
|
|
||||||
color: Theme.colors.textMuted
|
|
||||||
font.family: Theme.font.family
|
|
||||||
font.pixelSize: 18
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
visible: searchInput.text.length === 0
|
|
||||||
}
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) forceActiveFocus();
|
if (visible) focusInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
loadProcess.restart();
|
loadProcess.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onEscapePressed: (event) => {
|
onEscapePressed: {
|
||||||
rootState.clipboardManagerOpen = false;
|
rootState.clipboardManagerOpen = false;
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onUpPressed: (event) => {
|
onUpPressed: {
|
||||||
if (clipList.currentIndex > 0) {
|
if (clipList.currentIndex > 0) {
|
||||||
clipList.currentIndex--;
|
clipList.currentIndex--;
|
||||||
clipList.positionViewAtIndex(clipList.currentIndex, ListView.Contain);
|
clipList.positionViewAtIndex(clipList.currentIndex, ListView.Contain);
|
||||||
}
|
}
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onDownPressed: (event) => {
|
onDownPressed: {
|
||||||
if (clipList.currentIndex < clipList.count - 1) {
|
if (clipList.currentIndex < clipList.count - 1) {
|
||||||
clipList.currentIndex++;
|
clipList.currentIndex++;
|
||||||
clipList.positionViewAtIndex(clipList.currentIndex, ListView.Contain);
|
clipList.positionViewAtIndex(clipList.currentIndex, ListView.Contain);
|
||||||
}
|
}
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onReturnPressed: (event) => {
|
onReturnPressed: {
|
||||||
if (clipList.currentIndex >= 0 && clipList.currentIndex < clipModel.count) {
|
if (clipList.currentIndex >= 0 && clipList.currentIndex < clipModel.count) {
|
||||||
let item = clipModel.get(clipList.currentIndex);
|
let item = clipModel.get(clipList.currentIndex);
|
||||||
copyToClipboard(item.id);
|
copyToClipboard(item.id);
|
||||||
}
|
}
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: (event) => {
|
onDeleteRequested: {
|
||||||
if (event.key === Qt.Key_Delete || (event.key === Qt.Key_Backspace && searchInput.text.length === 0)) {
|
|
||||||
if (clipList.currentIndex >= 0 && clipList.currentIndex < clipModel.count) {
|
if (clipList.currentIndex >= 0 && clipList.currentIndex < clipModel.count) {
|
||||||
let item = clipModel.get(clipList.currentIndex);
|
let item = clipModel.get(clipList.currentIndex);
|
||||||
deleteFromClipboard(item.id, item.rawLine, clipList.currentIndex);
|
deleteFromClipboard(item.id, item.rawLine, clipList.currentIndex);
|
||||||
}
|
}
|
||||||
event.accepted = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
ListView {
|
||||||
id: clipList
|
id: clipList
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - (searchInput.text.length > 0 ? 50 + Theme.geometry.spacing : 0)
|
height: parent.height - clipboardWindow.headerHeight - clipboardWindow.footerHeight - Theme.geometry.spacing * 2
|
||||||
|
visible: clipModel.count > 0
|
||||||
clip: true
|
clip: true
|
||||||
spacing: Theme.geometry.spacing
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
|
||||||
model: ListModel { id: clipModel }
|
model: ListModel { id: clipModel }
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: ListRow {
|
||||||
|
id: clipRow
|
||||||
width: clipList.width
|
width: clipList.width
|
||||||
height: 36
|
selected: ListView.isCurrentItem
|
||||||
color: ListView.isCurrentItem ? Theme.colors.surfaceHover : "transparent"
|
accent: Theme.colors.secondary
|
||||||
radius: Theme.geometry.radiusTiny
|
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.leftMargin: Theme.geometry.padding
|
|
||||||
anchors.rightMargin: Theme.geometry.padding
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: model.content
|
|
||||||
color: Theme.colors.text
|
|
||||||
font.family: Theme.font.family
|
|
||||||
font.pixelSize: 14
|
|
||||||
anchors.fill: parent
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: clipItemMouse
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
|
||||||
onEntered: clipList.currentIndex = index
|
onEntered: clipList.currentIndex = index
|
||||||
onClicked: (mouse) => {
|
onClicked: (mouse) => {
|
||||||
clipList.currentIndex = index;
|
clipList.currentIndex = index;
|
||||||
if (mouse.button === Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
let pos = clipItemMouse.mapToItem(backdrop, mouse.x, mouse.y);
|
let pos = mapToItem(backdrop, mouse.x, mouse.y);
|
||||||
let itemId = model.id;
|
let itemId = model.id;
|
||||||
let rawLine = model.rawLine;
|
let rawLine = model.rawLine;
|
||||||
let itemIndex = index;
|
let itemIndex = index;
|
||||||
contextMenu.model = [
|
contextMenu.model = [
|
||||||
{ label: "Copy", icon: "⧉", action: function() { copyToClipboard(itemId); } },
|
{ label: "Copy", icon: "", action: function() { copyToClipboard(itemId); } },
|
||||||
{ separator: true },
|
{ separator: true },
|
||||||
{ label: "Delete", icon: "🗑", destructive: true, action: function() { deleteFromClipboard(itemId, rawLine, itemIndex); } }
|
{ label: "Delete", icon: "", destructive: true, action: function() { deleteFromClipboard(itemId, rawLine, itemIndex); } }
|
||||||
];
|
];
|
||||||
contextMenu.openAt(pos.x, pos.y);
|
contextMenu.openAt(pos.x, pos.y);
|
||||||
} else {
|
} else {
|
||||||
copyToClipboard(model.id);
|
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 {
|
MouseArea {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Effects
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Wayland
|
import Quickshell.Wayland
|
||||||
import Quickshell.Services.Pipewire
|
import Quickshell.Services.Pipewire
|
||||||
@@ -12,6 +11,44 @@ PanelWindow {
|
|||||||
property bool enterQueued: false
|
property bool enterQueued: false
|
||||||
property var usageCounts: ({})
|
property var usageCounts: ({})
|
||||||
property string lastUsedApp: ""
|
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) {
|
function launchApp(index) {
|
||||||
if (index < 0 || index >= appModel.count) return;
|
if (index < 0 || index >= appModel.count) return;
|
||||||
@@ -49,24 +86,23 @@ PanelWindow {
|
|||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: rootState.commandPaletteOpen = false
|
||||||
rootState.commandPaletteOpen = false
|
|
||||||
rootState.commandPaletteOsdMode = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Surface {
|
||||||
id: container
|
id: container
|
||||||
// Sized appropriately for a 2560x1440 screen
|
// Sized appropriately for a 2560x1440 screen
|
||||||
width: 800
|
width: 800
|
||||||
height: Math.min(600, (appList.count > 0 ? appList.contentHeight : 0) + (searchInput.text.length > 0 ? 50 + Theme.geometry.spacing : 0) + Theme.geometry.padding * 2)
|
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
|
anchors.centerIn: parent
|
||||||
radius: Theme.geometry.radiusMedium
|
tint: Theme.colors.primary
|
||||||
color: Theme.colors.background
|
glow: true
|
||||||
border.color: Theme.colors.border
|
|
||||||
border.width: 1
|
|
||||||
|
|
||||||
Behavior on scale { SpringAnimation { spring: 3; damping: 0.2 } }
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } }
|
||||||
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
||||||
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } }
|
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } }
|
||||||
|
|
||||||
@@ -80,96 +116,50 @@ PanelWindow {
|
|||||||
Column {
|
Column {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.geometry.padding
|
anchors.margins: Theme.geometry.padding
|
||||||
spacing: searchInput.text.length > 0 ? Theme.geometry.spacing : 0
|
spacing: Theme.geometry.spacing
|
||||||
|
|
||||||
Rectangle {
|
TextField {
|
||||||
width: parent.width
|
|
||||||
height: searchInput.text.length > 0 ? 50 : 0
|
|
||||||
opacity: searchInput.text.length > 0 ? 1 : 0
|
|
||||||
clip: true
|
|
||||||
color: Theme.colors.surface
|
|
||||||
radius: Theme.geometry.radiusSmall
|
|
||||||
border.width: 1
|
|
||||||
border.color: searchInput.activeFocus ? Theme.colors.primary : Theme.colors.border
|
|
||||||
|
|
||||||
Behavior on height { NumberAnimation { duration: Theme.animation.durationFast } }
|
|
||||||
Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } }
|
|
||||||
Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } }
|
|
||||||
|
|
||||||
layer.enabled: searchInput.activeFocus
|
|
||||||
layer.effect: MultiEffect {
|
|
||||||
shadowEnabled: true
|
|
||||||
shadowColor: Theme.colors.primary
|
|
||||||
shadowOpacity: 0.35
|
|
||||||
shadowBlur: 0.4
|
|
||||||
shadowHorizontalOffset: 0
|
|
||||||
shadowVerticalOffset: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
TextInput {
|
|
||||||
id: searchInput
|
id: searchInput
|
||||||
anchors.fill: parent
|
width: parent.width
|
||||||
anchors.margins: Theme.geometry.padding
|
height: paletteWindow.headerHeight
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
placeholder: "Search apps..."
|
||||||
font.family: Theme.font.family
|
|
||||||
font.pixelSize: 18
|
|
||||||
color: Theme.colors.text
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
Text {
|
|
||||||
text: "Search apps..."
|
|
||||||
color: Theme.colors.textMuted
|
|
||||||
font.family: Theme.font.family
|
|
||||||
font.pixelSize: 18
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
visible: searchInput.text.length === 0
|
|
||||||
}
|
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
if (visible) forceActiveFocus();
|
if (visible) focusInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
searchTimer.restart();
|
if (paletteWindow.appsLoaded) {
|
||||||
|
paletteWindow.applyFilter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onEscapePressed: (event) => {
|
onEscapePressed: {
|
||||||
rootState.commandPaletteOpen = false;
|
rootState.commandPaletteOpen = false;
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onUpPressed: (event) => {
|
onUpPressed: {
|
||||||
if (appList.currentIndex > 0) {
|
if (appList.currentIndex > 0) {
|
||||||
appList.currentIndex--;
|
appList.currentIndex--;
|
||||||
appList.positionViewAtIndex(appList.currentIndex, ListView.Contain);
|
appList.positionViewAtIndex(appList.currentIndex, ListView.Contain);
|
||||||
}
|
}
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onDownPressed: (event) => {
|
onDownPressed: {
|
||||||
if (appList.currentIndex < appList.count - 1) {
|
if (appList.currentIndex < appList.count - 1) {
|
||||||
appList.currentIndex++;
|
appList.currentIndex++;
|
||||||
appList.positionViewAtIndex(appList.currentIndex, ListView.Contain);
|
appList.positionViewAtIndex(appList.currentIndex, ListView.Contain);
|
||||||
}
|
}
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onReturnPressed: (event) => {
|
onReturnPressed: {
|
||||||
if (appList.count > 0 && appList.currentIndex >= 0 && appList.currentIndex < appModel.count) {
|
if (appList.count > 0 && appList.currentIndex >= 0 && appList.currentIndex < appModel.count) {
|
||||||
paletteWindow.launchApp(appList.currentIndex);
|
paletteWindow.launchApp(appList.currentIndex);
|
||||||
} else {
|
} else {
|
||||||
paletteWindow.enterQueued = true;
|
paletteWindow.enterQueued = true;
|
||||||
}
|
}
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: searchTimer
|
|
||||||
interval: 200
|
|
||||||
onTriggered: searchProcess.restart()
|
|
||||||
}
|
|
||||||
|
|
||||||
Process {
|
Process {
|
||||||
id: historyProcess
|
id: historyProcess
|
||||||
@@ -192,20 +182,21 @@ PanelWindow {
|
|||||||
paletteWindow.usageCounts = counts;
|
paletteWindow.usageCounts = counts;
|
||||||
paletteWindow.lastUsedApp = lastUsed;
|
paletteWindow.lastUsedApp = lastUsed;
|
||||||
|
|
||||||
// Now that history is loaded, run the search
|
// Now that history is loaded, list every desktop entry once.
|
||||||
searchProcess.restart();
|
// 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 {
|
Process {
|
||||||
id: searchProcess
|
id: listProcess
|
||||||
command: [
|
command: [
|
||||||
"bash",
|
"bash",
|
||||||
"-c",
|
"-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 }' | { [ -z \"$1\" ] && cat || rg -i \"$1\"; } | head -n 20",
|
"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 }'"
|
||||||
"_",
|
|
||||||
searchInput.text
|
|
||||||
]
|
]
|
||||||
running: false
|
running: false
|
||||||
function restart() {
|
function restart() {
|
||||||
@@ -215,69 +206,64 @@ PanelWindow {
|
|||||||
stdout: StdioCollector {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
let lines = this.text.split('\n').filter(l => l.trim() !== "");
|
let lines = this.text.split('\n').filter(l => l.trim() !== "");
|
||||||
let results = [];
|
let apps = [];
|
||||||
|
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
let parts = lines[i].split('|');
|
let parts = lines[i].split('|');
|
||||||
if (parts.length >= 3) {
|
if (parts.length >= 3) {
|
||||||
let desktopName = parts[2].split('/').pop();
|
let desktopName = parts[2].split('/').pop();
|
||||||
|
|
||||||
// Calculate frecency score
|
|
||||||
let count = paletteWindow.usageCounts[desktopName] || 0;
|
|
||||||
let isLast = (desktopName === paletteWindow.lastUsedApp);
|
let isLast = (desktopName === paletteWindow.lastUsedApp);
|
||||||
// Give a massive boost to the absolute last used app, then weight by total usage
|
|
||||||
let score = count * 10 + (isLast ? 10000 : 0);
|
|
||||||
|
|
||||||
results.push({
|
apps.push({
|
||||||
"iconName": parts[0],
|
"iconName": parts[0],
|
||||||
"appName": parts[1],
|
"appName": parts[1],
|
||||||
"appPath": parts[2],
|
"appPath": parts[2],
|
||||||
"desktopName": desktopName,
|
"desktopName": desktopName,
|
||||||
"score": score
|
"isLastUsed": isLast,
|
||||||
|
"score": paletteWindow.scoreOf(desktopName)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort by score (descending), then alphabetically
|
paletteWindow.allApps = apps;
|
||||||
results.sort((a, b) => {
|
paletteWindow.appsLoaded = true;
|
||||||
if (b.score !== a.score) return b.score - a.score;
|
paletteWindow.applyFilter();
|
||||||
return a.appName.localeCompare(b.appName);
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
appModel.clear();
|
|
||||||
for (let i = 0; i < results.length; i++) {
|
|
||||||
appModel.append(results[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
appList.currentIndex = 0;
|
Text {
|
||||||
|
width: parent.width
|
||||||
if (paletteWindow.enterQueued && appModel.count > 0) {
|
height: paletteWindow.emptyStateHeight
|
||||||
paletteWindow.enterQueued = false;
|
visible: appModel.count === 0
|
||||||
paletteWindow.launchApp(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 {
|
ListView {
|
||||||
id: appList
|
id: appList
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - (searchInput.text.length > 0 ? 50 + Theme.geometry.spacing : 0)
|
height: parent.height - paletteWindow.headerHeight - paletteWindow.footerHeight - Theme.geometry.spacing * 2
|
||||||
|
visible: appModel.count > 0
|
||||||
clip: true
|
clip: true
|
||||||
spacing: Theme.geometry.spacing
|
spacing: Theme.geometry.spacing / 2
|
||||||
|
|
||||||
model: ListModel { id: appModel }
|
model: ListModel { id: appModel }
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: ListRow {
|
||||||
width: appList.width
|
width: appList.width
|
||||||
height: 36
|
selected: ListView.isCurrentItem
|
||||||
color: ListView.isCurrentItem ? Theme.colors.surfaceHover : "transparent"
|
accent: model.isLastUsed ? Theme.colors.secondary : Theme.colors.primary
|
||||||
radius: Theme.geometry.radiusTiny
|
|
||||||
|
|
||||||
Item {
|
onEntered: appList.currentIndex = index
|
||||||
anchors.fill: parent
|
onClicked: {
|
||||||
anchors.leftMargin: Theme.geometry.padding
|
appList.currentIndex = index;
|
||||||
anchors.rightMargin: Theme.geometry.padding
|
paletteWindow.launchApp(index);
|
||||||
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: appIcon
|
id: appIcon
|
||||||
@@ -297,7 +283,7 @@ PanelWindow {
|
|||||||
Text {
|
Text {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: model.appName.charAt(0).toUpperCase()
|
text: model.appName.charAt(0).toUpperCase()
|
||||||
color: Theme.colors.background
|
color: Theme.colors.textOnAccent
|
||||||
font.bold: true
|
font.bold: true
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
}
|
}
|
||||||
@@ -308,23 +294,24 @@ PanelWindow {
|
|||||||
text: model.appName
|
text: model.appName
|
||||||
color: Theme.colors.text
|
color: Theme.colors.text
|
||||||
font.family: Theme.font.family
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 14
|
font.pixelSize: Theme.type.label
|
||||||
anchors.left: appIcon.right
|
anchors.left: appIcon.right
|
||||||
anchors.leftMargin: Theme.geometry.spacing
|
anchors.leftMargin: Theme.geometry.spacing
|
||||||
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
HintBar {
|
||||||
anchors.fill: parent
|
width: parent.width
|
||||||
hoverEnabled: true
|
height: paletteWindow.footerHeight
|
||||||
onEntered: appList.currentIndex = index
|
hints: [
|
||||||
onClicked: {
|
{ key: "↑↓", label: "Navigate" },
|
||||||
appList.currentIndex = index;
|
{ key: "↵", label: "Launch" },
|
||||||
paletteWindow.launchApp(index);
|
{ key: "Esc", label: "Close" }
|
||||||
}
|
]
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,9 +339,10 @@ PanelWindow {
|
|||||||
container.scale = 1.0;
|
container.scale = 1.0;
|
||||||
searchInput.text = "";
|
searchInput.text = "";
|
||||||
paletteWindow.enterQueued = false;
|
paletteWindow.enterQueued = false;
|
||||||
|
paletteWindow.appsLoaded = false;
|
||||||
appModel.clear(); // Clear so it re-populates clean
|
appModel.clear(); // Clear so it re-populates clean
|
||||||
|
|
||||||
// Read history first, then search
|
// Read history first, then list every desktop entry once
|
||||||
historyProcess.restart();
|
historyProcess.restart();
|
||||||
} else {
|
} else {
|
||||||
container.scale = 0.95;
|
container.scale = 0.95;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ PanelWindow {
|
|||||||
height: buttonRow.height
|
height: buttonRow.height
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
Behavior on scale { SpringAnimation { spring: 3; damping: 0.2 } }
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } }
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: buttonRow
|
id: buttonRow
|
||||||
@@ -63,7 +63,7 @@ PanelWindow {
|
|||||||
|
|
||||||
// Lock
|
// Lock
|
||||||
LogoutButton {
|
LogoutButton {
|
||||||
icon: "🔒"
|
icon: ""
|
||||||
label: "Lock"
|
label: "Lock"
|
||||||
isSelected: logoutWindow.currentIndex === 0
|
isSelected: logoutWindow.currentIndex === 0
|
||||||
onClicked: executeAction(logoutWindow.actions[0].cmd)
|
onClicked: executeAction(logoutWindow.actions[0].cmd)
|
||||||
@@ -72,7 +72,7 @@ PanelWindow {
|
|||||||
|
|
||||||
// Suspend
|
// Suspend
|
||||||
LogoutButton {
|
LogoutButton {
|
||||||
icon: "🌙"
|
icon: ""
|
||||||
label: "Suspend"
|
label: "Suspend"
|
||||||
isSelected: logoutWindow.currentIndex === 1
|
isSelected: logoutWindow.currentIndex === 1
|
||||||
onClicked: executeAction(logoutWindow.actions[1].cmd)
|
onClicked: executeAction(logoutWindow.actions[1].cmd)
|
||||||
@@ -81,7 +81,7 @@ PanelWindow {
|
|||||||
|
|
||||||
// Logout
|
// Logout
|
||||||
LogoutButton {
|
LogoutButton {
|
||||||
icon: "🚪"
|
icon: ""
|
||||||
label: "Logout"
|
label: "Logout"
|
||||||
isSelected: logoutWindow.currentIndex === 2
|
isSelected: logoutWindow.currentIndex === 2
|
||||||
onClicked: executeAction(logoutWindow.actions[2].cmd)
|
onClicked: executeAction(logoutWindow.actions[2].cmd)
|
||||||
@@ -90,7 +90,7 @@ PanelWindow {
|
|||||||
|
|
||||||
// Reboot
|
// Reboot
|
||||||
LogoutButton {
|
LogoutButton {
|
||||||
icon: "🔄"
|
icon: ""
|
||||||
label: "Reboot"
|
label: "Reboot"
|
||||||
isSelected: logoutWindow.currentIndex === 3
|
isSelected: logoutWindow.currentIndex === 3
|
||||||
onClicked: executeAction(logoutWindow.actions[3].cmd)
|
onClicked: executeAction(logoutWindow.actions[3].cmd)
|
||||||
@@ -99,7 +99,7 @@ PanelWindow {
|
|||||||
|
|
||||||
// Poweroff
|
// Poweroff
|
||||||
LogoutButton {
|
LogoutButton {
|
||||||
icon: "⏻"
|
icon: ""
|
||||||
label: "Shutdown"
|
label: "Shutdown"
|
||||||
isDestructive: true
|
isDestructive: true
|
||||||
isSelected: logoutWindow.currentIndex === 4
|
isSelected: logoutWindow.currentIndex === 4
|
||||||
@@ -161,7 +161,7 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Inline component for the big buttons
|
// Inline component for the big buttons
|
||||||
component LogoutButton: Rectangle {
|
component LogoutButton: Surface {
|
||||||
property string icon: ""
|
property string icon: ""
|
||||||
property string label: ""
|
property string label: ""
|
||||||
property bool isDestructive: false
|
property bool isDestructive: false
|
||||||
@@ -171,12 +171,12 @@ PanelWindow {
|
|||||||
|
|
||||||
width: 120
|
width: 120
|
||||||
height: 120
|
height: 120
|
||||||
radius: Theme.geometry.radiusMedium
|
|
||||||
color: Theme.colors.surface
|
color: Theme.colors.surface
|
||||||
border.color: isSelected ? (isDestructive ? Theme.colors.alert : Theme.colors.primary) : Theme.colors.border
|
tint: isSelected ? (isDestructive ? Theme.colors.alert : Theme.colors.primary) : Theme.colors.border
|
||||||
border.width: isSelected ? 2 : 1
|
border.width: isSelected ? 2 : 1
|
||||||
|
glow: isSelected
|
||||||
|
|
||||||
Behavior on scale { SpringAnimation { spring: 4; damping: 0.3 } }
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSnappy.spring; damping: Theme.motion.springSnappy.damping } }
|
||||||
scale: isSelected ? 1.05 : 1.0
|
scale: isSelected ? 1.05 : 1.0
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -185,9 +185,10 @@ PanelWindow {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: parent.parent.icon
|
text: parent.parent.icon
|
||||||
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 36
|
font.pixelSize: 36
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
color: Theme.colors.text
|
color: parent.parent.isSelected ? parent.parent.tint : Theme.colors.text
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ PanelWindow {
|
|||||||
function colorFor(urgency) {
|
function colorFor(urgency) {
|
||||||
if (urgency === NotificationUrgency.Critical) return Theme.colors.alert;
|
if (urgency === NotificationUrgency.Critical) return Theme.colors.alert;
|
||||||
if (urgency === NotificationUrgency.Low) return Theme.colors.success;
|
if (urgency === NotificationUrgency.Low) return Theme.colors.success;
|
||||||
return Theme.colors.primary;
|
return Theme.colors.info;
|
||||||
}
|
}
|
||||||
|
|
||||||
function labelFor(urgency) {
|
function labelFor(urgency) {
|
||||||
@@ -158,8 +158,9 @@ PanelWindow {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: closeIcon
|
id: closeIcon
|
||||||
text: "✕"
|
text: ""
|
||||||
color: Theme.colors.textMuted
|
color: Theme.colors.textMuted
|
||||||
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 12
|
font.pixelSize: 12
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
||||||
|
|||||||
@@ -76,14 +76,13 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Surface {
|
||||||
width: 300
|
width: 300
|
||||||
height: parent.implicitHeight
|
height: 60
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: Theme.colors.background
|
|
||||||
radius: Theme.geometry.pillRadius
|
radius: Theme.geometry.pillRadius
|
||||||
border.color: Theme.colors.border
|
tint: osdWindow.levelColor
|
||||||
border.width: 1
|
glow: true
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -95,39 +94,32 @@ PanelWindow {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: {
|
text: {
|
||||||
if (mode === "volume") {
|
if (mode === "volume") {
|
||||||
if (isMuted) return "🔇";
|
if (isMuted) return ""; // nf-fa-volume_off
|
||||||
if (volumeLevel < 0.33) return "🔈";
|
if (volumeLevel < 0.5) return ""; // nf-fa-volume_down
|
||||||
if (volumeLevel < 0.66) return "🔉";
|
return ""; // nf-fa-volume_up
|
||||||
return "🔊";
|
|
||||||
} else {
|
} else {
|
||||||
return "☀️";
|
return ""; // nf-fa-sun_o
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
color: Theme.colors.text
|
color: osdWindow.levelColor
|
||||||
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
ProgressBar {
|
||||||
anchors.left: iconText.right
|
anchors.left: iconText.right
|
||||||
anchors.leftMargin: Theme.geometry.spacing
|
anchors.leftMargin: Theme.geometry.spacing
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
height: 8
|
value: mode === "volume" ? volumeLevel : brightnessLevel
|
||||||
color: Theme.colors.surfaceHover
|
fillColor: osdWindow.levelColor
|
||||||
radius: 4
|
}
|
||||||
clip: true
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
// Volume gets the primary accent, brightness gets a warm warning-ish
|
||||||
width: parent.width * (mode === "volume" ? volumeLevel : brightnessLevel)
|
// tint (sun-colored), muted volume falls back to a neutral color.
|
||||||
height: parent.height
|
readonly property color levelColor: (mode === "volume" && isMuted)
|
||||||
color: (mode === "volume" && isMuted) ? Theme.colors.textMuted : Theme.colors.primary
|
? Theme.colors.textMuted
|
||||||
radius: 4
|
: (mode === "volume" ? Theme.colors.primary : Theme.colors.warning)
|
||||||
|
|
||||||
Behavior on width {
|
|
||||||
NumberAnimation { duration: Theme.animation.durationFast }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -5,7 +5,7 @@ import "."
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: button
|
id: button
|
||||||
|
|
||||||
// "primary" | "secondary" | "accent" | "destructive"
|
// "primary" | "secondary" | "accent" | "destructive" | "success" | "warning" | "info"
|
||||||
property string variant: "primary"
|
property string variant: "primary"
|
||||||
property string text: ""
|
property string text: ""
|
||||||
signal clicked()
|
signal clicked()
|
||||||
@@ -15,6 +15,9 @@ Rectangle {
|
|||||||
readonly property bool filled: variant === "primary" || variant === "accent"
|
readonly property bool filled: variant === "primary" || variant === "accent"
|
||||||
readonly property color tint: variant === "accent" ? Theme.colors.accent
|
readonly property color tint: variant === "accent" ? Theme.colors.accent
|
||||||
: variant === "destructive" ? Theme.colors.alert
|
: variant === "destructive" ? Theme.colors.alert
|
||||||
|
: variant === "success" ? Theme.colors.success
|
||||||
|
: variant === "warning" ? Theme.colors.warning
|
||||||
|
: variant === "info" ? Theme.colors.info
|
||||||
: Theme.colors.primary
|
: Theme.colors.primary
|
||||||
|
|
||||||
implicitWidth: label.implicitWidth + Theme.geometry.padding * 2
|
implicitWidth: label.implicitWidth + Theme.geometry.padding * 2
|
||||||
@@ -31,13 +34,13 @@ Rectangle {
|
|||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
shadowEnabled: true
|
shadowEnabled: true
|
||||||
shadowColor: button.tint
|
shadowColor: button.tint
|
||||||
shadowOpacity: 0.5
|
shadowOpacity: Theme.elevation.medium.opacity
|
||||||
shadowBlur: 0.6
|
shadowBlur: Theme.elevation.medium.blur
|
||||||
shadowVerticalOffset: 2
|
shadowVerticalOffset: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } }
|
||||||
Behavior on scale { SpringAnimation { spring: 4; damping: 0.3 } }
|
Behavior on scale { SpringAnimation { spring: Theme.motion.springSnappy.spring; damping: Theme.motion.springSnappy.damping } }
|
||||||
scale: mouseArea.pressed ? 0.97 : 1.0
|
scale: mouseArea.pressed ? 0.97 : 1.0
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|||||||
@@ -57,15 +57,16 @@ Rectangle {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: modelData.icon || ""
|
text: modelData.icon || ""
|
||||||
width: 14
|
width: Theme.iconSize.small
|
||||||
font.pixelSize: 12
|
font.family: Theme.font.family
|
||||||
|
font.pixelSize: Theme.type.caption
|
||||||
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: modelData.label || ""
|
text: modelData.label || ""
|
||||||
font.family: Theme.font.family
|
font.family: Theme.font.family
|
||||||
font.pixelSize: 12
|
font.pixelSize: Theme.type.caption
|
||||||
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
color: modelData.destructive ? Theme.colors.alert : Theme.colors.text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,71 @@
|
|||||||
|
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 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,17 +13,29 @@ QtObject {
|
|||||||
property color surfaceHover: "#f2313244"
|
property color surfaceHover: "#f2313244"
|
||||||
property color overlay: "#6011111b"
|
property color overlay: "#6011111b"
|
||||||
|
|
||||||
property color primary: "#74c7ec"
|
property color primary: "#cba6f7"
|
||||||
property color secondary: "#b4befe"
|
property color secondary: "#f5c2e7"
|
||||||
property color accent: "#74c7ec"
|
property color tertiary: "#89b4fa"
|
||||||
|
property color accent: "#cba6f7"
|
||||||
|
|
||||||
|
property color primaryContainer: "#24cba6f7"
|
||||||
|
property color secondaryContainer: "#24f5c2e7"
|
||||||
|
property color tertiaryContainer: "#2489b4fa"
|
||||||
|
|
||||||
property color alert: "#f38ba8"
|
property color alert: "#f38ba8"
|
||||||
|
property color alertContainer: "#24f38ba8"
|
||||||
property color success: "#a6e3a1"
|
property color success: "#a6e3a1"
|
||||||
|
property color successContainer: "#24a6e3a1"
|
||||||
property color warning: "#f9e2af"
|
property color warning: "#f9e2af"
|
||||||
|
property color warningContainer: "#24f9e2af"
|
||||||
|
property color info: "#74c7ec"
|
||||||
|
property color infoContainer: "#2474c7ec"
|
||||||
|
|
||||||
property color text: "#cdd6f4"
|
property color text: "#cdd6f4"
|
||||||
property color textMuted: "#a6adc8"
|
property color textMuted: "#a6adc8"
|
||||||
|
property color textOnAccent: "#e611111b"
|
||||||
|
|
||||||
property color border: "#1a74c7ec"
|
property color border: "#1acba6f7"
|
||||||
}
|
}
|
||||||
// GENERATED:COLORS:END
|
// GENERATED:COLORS:END
|
||||||
|
|
||||||
@@ -42,6 +54,37 @@ QtObject {
|
|||||||
property int durationSlow: 400
|
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 QtObject font: QtObject {
|
||||||
property string family: "JetBrainsMono Nerd Font"
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
singleton Theme 1.0 Theme.qml
|
singleton Theme 1.0 Theme.qml
|
||||||
Button 1.0 Button.qml
|
Button 1.0 Button.qml
|
||||||
ContextMenu 1.0 ContextMenu.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
|
||||||
@@ -115,15 +115,15 @@ PanelWindow {
|
|||||||
width: isCurrent ? 260 : 170
|
width: isCurrent ? 260 : 170
|
||||||
height: 340
|
height: 340
|
||||||
|
|
||||||
Rectangle {
|
Surface {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: isCurrent ? 240 : 150
|
width: isCurrent ? 240 : 150
|
||||||
height: isCurrent ? 320 : 200
|
height: isCurrent ? 320 : 200
|
||||||
radius: Theme.geometry.radiusMedium
|
|
||||||
color: Theme.colors.surface
|
color: Theme.colors.surface
|
||||||
border.color: delegateRoot.isCurrent ? Theme.colors.primary : Theme.colors.border
|
tint: delegateRoot.isCurrent ? Theme.colors.primary : Theme.colors.border
|
||||||
border.width: delegateRoot.isCurrent ? 2 : 1
|
border.width: delegateRoot.isCurrent ? 2 : 1
|
||||||
opacity: delegateRoot.isCurrent ? 1.0 : 0.5
|
opacity: delegateRoot.isCurrent ? 1.0 : 0.5
|
||||||
|
glow: delegateRoot.isCurrent
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
|||||||
@@ -122,4 +122,15 @@ ShellRoot {
|
|||||||
id: wallpaperPicker
|
id: wallpaperPicker
|
||||||
rootState: root
|
rootState: root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IpcHandler {
|
||||||
|
target: "showcase"
|
||||||
|
function toggle() {
|
||||||
|
showcase.open = !showcase.open;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Showcase {
|
||||||
|
id: showcase
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user