diff --git a/config/nushell/scripts/wallpaper-theme.nu b/config/nushell/scripts/wallpaper-theme.nu index a02473f..16c95c2 100644 --- a/config/nushell/scripts/wallpaper-theme.nu +++ b/config/nushell/scripts/wallpaper-theme.nu @@ -13,6 +13,13 @@ def hex-byte [] { $"0x($in)" | into int } +def to-hex-byte [n: int] { + let digits = "0123456789abcdef" + let hi = ($n // 16) + let lo = ($n mod 16) + $"($digits | str substring $hi..$hi)($digits | str substring $lo..$lo)" +} + def rgb-to-hsl [rgb: record] { let r = $rgb.r / 255 let g = $rgb.g / 255 @@ -130,9 +137,25 @@ def pick-accents [flavor: string, swatches: list, want: int, min_sep: float] { $chosen_names } -def container-tint [hex: string] { - # accent-tinted, ~14% opacity - a soft fill for badges/containers - $"#24($hex | str substring 1..)" +def blend-hex [a: string, b: string, ratio: float] { + # Opaque RGB interpolation - neo-brutalist surfaces are solid blocks, never + # alpha blends, so "muted container" colors are baked as real flat hex. + let ar = ($a | str substring 1..2 | hex-byte) + let ag = ($a | str substring 3..4 | hex-byte) + let ab = ($a | str substring 5..6 | hex-byte) + let br = ($b | str substring 1..2 | hex-byte) + let bg = ($b | str substring 3..4 | hex-byte) + let bb = ($b | str substring 5..6 | hex-byte) + let mix = {|x, y| (($x * (1 - $ratio)) + ($y * $ratio)) | math round | into int } + let r = (to-hex-byte (do $mix $ar $br)) + let g = (to-hex-byte (do $mix $ag $bg)) + let b2 = (to-hex-byte (do $mix $ab $bb)) + $"#($r)($g)($b2)" +} + +def container-tint [base: string, accent: string] { + # Opaque muted tile: ~30% accent blended into the base surface, no alpha. + blend-hex $base $accent 0.3 } def write-theme-colors [flavor: string, accent_names: list] { @@ -141,37 +164,39 @@ def write-theme-colors [flavor: string, accent_names: list] { 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 background: \"($p.base)\"" + $" property color surface: \"($p.mantle)\"" + $" property color surfaceHover: \"($p.surface0)\"" + $" property color overlay: \"#cc($p.crust | str substring 1..)\"" + "" + $" property color crust: \"($p.crust)\"" + $" property color outlineVariant: \"($p.surface1)\"" "" $" 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 primaryContainer: \"(container-tint $p.surface0 $primary)\"" + $" property color secondaryContainer: \"(container-tint $p.surface0 $secondary)\"" + $" property color tertiaryContainer: \"(container-tint $p.surface0 $tertiary)\"" "" $" property color alert: \"($p.red)\"" - $" property color alertContainer: \"(container-tint $p.red)\"" + $" property color alertContainer: \"(container-tint $p.surface0 $p.red)\"" $" property color success: \"($p.green)\"" - $" property color successContainer: \"(container-tint $p.green)\"" + $" property color successContainer: \"(container-tint $p.surface0 $p.green)\"" $" property color warning: \"($p.yellow)\"" - $" property color warningContainer: \"(container-tint $p.yellow)\"" + $" property color warningContainer: \"(container-tint $p.surface0 $p.yellow)\"" $" property color info: \"($info)\"" - $" property color infoContainer: \"(container-tint $info)\"" + $" property color infoContainer: \"(container-tint $p.surface0 $info)\"" "" $" property color text: \"($p.text)\"" $" property color textMuted: \"($p.subtext0)\"" - $" property color textOnAccent: \"#e6($p.crust | str substring 1..)\"" + $" property color textOnAccent: \"($p.crust)\"" "" - $" property color border: \"($border)\"" + $" property color border: \"($p.crust)\"" ] let theme_path = $"($env.HOME)/.config/quickshell/components/Shared/Theme.qml" diff --git a/mutable_config/hypr/hyprland.lua b/mutable_config/hypr/hyprland.lua index 2b64d1f..0b3ca8a 100644 --- a/mutable_config/hypr/hyprland.lua +++ b/mutable_config/hypr/hyprland.lua @@ -78,7 +78,7 @@ hl.config({ gaps_out = 20, border_size = 2, col = { - active_border = "rgb(f38ba8)", + active_border = "rgb(cba6f7)", inactive_border = "rgb(45475a)", }, resize_on_border = false, @@ -86,15 +86,11 @@ hl.config({ layout = "dwindle", }, decoration = { - rounding = 2, - rounding_power = 2, + rounding = 0, active_opacity = 1.0, inactive_opacity = 0.9, shadow = { - enabled = true, - range = 4, - render_power = 3, - color = "rgba(1a1a1aee)", + enabled = false, }, blur = { enabled = true, @@ -178,6 +174,7 @@ hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(fileManager)) hl.bind(mainMod .. " + H", hl.dsp.window.float({ action = "toggle" })) 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 .. " + A", hl.dsp.exec_cmd("quickshell ipc call quickSettings toggle")) hl.bind(mainMod .. " + P", hl.dsp.window.pseudo()) hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen({ action = "toggle" })) hl.bind(mainMod .. " + L", hl.dsp.exec_cmd(lock)) diff --git a/mutable_config/quickshell/components/Bar/Bar.qml b/mutable_config/quickshell/components/Bar/Bar.qml index e21a42c..3d73384 100644 --- a/mutable_config/quickshell/components/Bar/Bar.qml +++ b/mutable_config/quickshell/components/Bar/Bar.qml @@ -106,8 +106,9 @@ PanelWindow { delegate: Rectangle { width: 24 height: 24 - radius: Theme.geometry.radiusTiny color: modelData.active ? Theme.colors.primary : Theme.colors.surfaceHover + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } } @@ -235,6 +236,17 @@ PanelWindow { : "No battery" visible: battery.isPresent } + + TrayIcon { + glyph: "⚙" // gear (U+2699) + active: barWindow.rootState.quickSettingsOpen + tint: Theme.colors.primary + tooltip: "Quick Settings (SUPER+A)" + onClicked: { + barWindow.rootState.quickSettingsOpen = !barWindow.rootState.quickSettingsOpen; + if (barWindow.rootState.quickSettingsOpen) barWindow.rootState.closeOtherOverlays("quickSettings"); + } + } } property QtObject battery: UPower.displayDevice @@ -460,16 +472,16 @@ PanelWindow { property string tooltip: "" property bool active: false property color tint: Theme.colors.primary + signal clicked() 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") + color: hoverArea.containsMouse ? Theme.colors.surfaceHover : "transparent" + border.width: trayIcon.active ? Theme.geometry.borderWidth : 0 + border.color: trayIcon.tint Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } } @@ -488,6 +500,7 @@ PanelWindow { id: hoverArea anchors.fill: parent hoverEnabled: true + cursorShape: Qt.PointingHandCursor onEntered: { if (trayIcon.tooltip.length > 0) { // Anchor on the icon's horizontal center; the tooltip @@ -497,6 +510,7 @@ PanelWindow { } } onExited: barWindow.hideTooltip() + onClicked: trayIcon.clicked() } } } diff --git a/mutable_config/quickshell/components/ClipboardManager/ClipboardManager.qml b/mutable_config/quickshell/components/ClipboardManager/ClipboardManager.qml index 1ec2361..6722fba 100644 --- a/mutable_config/quickshell/components/ClipboardManager/ClipboardManager.qml +++ b/mutable_config/quickshell/components/ClipboardManager/ClipboardManager.qml @@ -46,7 +46,7 @@ PanelWindow { tint: Theme.colors.secondary glow: true - Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } } + Behavior on scale { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } } Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } } Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } } @@ -157,7 +157,7 @@ PanelWindow { Text { text: model.content - color: Theme.colors.text + color: clipRow.selected ? Theme.colors.textOnAccent : Theme.colors.text font.family: Theme.font.family font.pixelSize: Theme.type.label anchors.left: parent.left diff --git a/mutable_config/quickshell/components/CommandPalette/CommandPalette.qml b/mutable_config/quickshell/components/CommandPalette/CommandPalette.qml index 209374a..05cc75b 100644 --- a/mutable_config/quickshell/components/CommandPalette/CommandPalette.qml +++ b/mutable_config/quickshell/components/CommandPalette/CommandPalette.qml @@ -46,6 +46,7 @@ PanelWindow { } } + readonly property int titleBarHeight: 28 readonly property int headerHeight: 50 readonly property int footerHeight: 24 readonly property int emptyStateHeight: 40 @@ -94,7 +95,8 @@ PanelWindow { // Sized appropriately for a 2560x1440 screen width: 800 height: Math.min(600, - headerHeight + Theme.geometry.spacing + titleBarHeight + Theme.geometry.spacing + + headerHeight + Theme.geometry.spacing + (appModel.count > 0 ? appList.contentHeight : emptyStateHeight) + Theme.geometry.spacing + footerHeight + Theme.geometry.padding * 2) @@ -102,7 +104,7 @@ PanelWindow { tint: Theme.colors.primary glow: true - Behavior on scale { SpringAnimation { spring: Theme.motion.springSoft.spring; damping: Theme.motion.springSoft.damping } } + Behavior on scale { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } } Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } } Behavior on height { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } } @@ -118,11 +120,49 @@ PanelWindow { anchors.margins: Theme.geometry.padding spacing: Theme.geometry.spacing + Item { + width: parent.width + height: paletteWindow.titleBarHeight + + Row { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.geometry.spacing / 2 + + Rectangle { + width: 10 + height: 10 + anchors.verticalCenter: parent.verticalCenter + color: Theme.colors.primary + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + } + + Text { + text: "QUICKSHELL :: APP_ROFI_MODAL [WAYLAND]" + color: Theme.colors.textMuted + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + + Text { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: "[ESC] Close" + color: Theme.colors.textMuted + font.family: Theme.font.family + font.pixelSize: Theme.type.caption + } + } + TextField { id: searchInput width: parent.width height: paletteWindow.headerHeight placeholder: "Search apps..." + prefix: "❯" onVisibleChanged: { if (visible) focusInput(); @@ -255,6 +295,7 @@ PanelWindow { model: ListModel { id: appModel } delegate: ListRow { + id: appRow width: appList.width selected: ListView.isCurrentItem accent: model.isLastUsed ? Theme.colors.secondary : Theme.colors.primary @@ -277,7 +318,6 @@ PanelWindow { Rectangle { anchors.fill: parent color: Theme.colors.primary - radius: 12 visible: parent.status === Image.Error || parent.status === Image.Null || model.iconName === "" Text { @@ -292,7 +332,7 @@ PanelWindow { Text { text: model.appName - color: Theme.colors.text + color: appRow.selected ? Theme.colors.textOnAccent : Theme.colors.text font.family: Theme.font.family font.pixelSize: Theme.type.label anchors.left: appIcon.right @@ -304,14 +344,42 @@ PanelWindow { } } - HintBar { + Item { width: parent.width height: paletteWindow.footerHeight - hints: [ - { key: "↑↓", label: "Navigate" }, - { key: "↵", label: "Launch" }, - { key: "Esc", label: "Close" } - ] + + HintBar { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + hints: [ + { key: "↑↓", label: "Navigate" }, + { key: "↵", label: "Launch" }, + { key: "Esc", label: "Close" } + ] + } + + Row { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.geometry.spacing / 2 + + Rectangle { + width: 8 + height: 8 + anchors.verticalCenter: parent.verticalCenter + color: Theme.colors.tertiary + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + } + + Text { + text: "HYPR_IPC OK" + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } } } diff --git a/mutable_config/quickshell/components/LockScreen/LockScreen.qml b/mutable_config/quickshell/components/LockScreen/LockScreen.qml index 93838bc..9afeedc 100644 --- a/mutable_config/quickshell/components/LockScreen/LockScreen.qml +++ b/mutable_config/quickshell/components/LockScreen/LockScreen.qml @@ -1,6 +1,7 @@ import QtQuick import Quickshell import Quickshell.Wayland +import Quickshell.Io import Quickshell.Services.Pam import Quickshell.Services.UPower import "../Shared" @@ -92,6 +93,68 @@ WlSessionLock { precision: SystemClock.Seconds } + property string hostLabel: "localhost" + + Process { + id: hostnameProcess + command: ["hostname"] + running: true + stdout: StdioCollector { + onStreamFinished: lockSurface.hostLabel = this.text.trim() + } + } + + // Top telemetry strip + Item { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: Theme.geometry.spacing * 2 + height: 28 + + Row { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.geometry.spacing + + Pill { + tint: Theme.colors.success + Rectangle { width: 6; height: 6; anchors.verticalCenter: parent.verticalCenter; color: Theme.colors.success } + Text { + text: Quickshell.env("USER") + " // " + lockSurface.hostLabel + color: Theme.colors.text + font.family: Theme.font.family + font.pixelSize: Theme.type.caption + font.bold: true + } + } + + Pill { + tint: Theme.colors.outlineVariant + Text { + text: "WAYLAND_0 [HYPRLAND]" + color: Theme.colors.textMuted + font.family: Theme.font.family + font.pixelSize: Theme.type.caption + } + } + } + + Pill { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + tint: Theme.colors.primary + glow: true + Text { + text: "PAM::SECURED" + color: Theme.colors.primary + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + } + Column { anchors.centerIn: parent spacing: Theme.geometry.spacing * 3 @@ -182,6 +245,8 @@ WlSessionLock { id: passwordField width: parent.width placeholder: "Password" + prefix: "❯" + passwordCharacter: "■" echoMode: sessionLock.responseVisible ? TextInput.Normal : TextInput.Password onVisibleChanged: { if (visible) focusInput(); } @@ -191,6 +256,10 @@ WlSessionLock { authCtx.respond(sessionLock.password); sessionLock.awaitingResponse = false; } + onEscapePressed: { + passwordField.text = ""; + sessionLock.errorText = ""; + } } } @@ -205,7 +274,10 @@ WlSessionLock { HintBar { anchors.horizontalCenter: parent.horizontalCenter - hints: [ { key: "↵", label: "Unlock" } ] + hints: [ + { key: "↵", label: "Unlock" }, + { key: "Esc", label: "Clear" } + ] } } } diff --git a/mutable_config/quickshell/components/LogoutMenu/LogoutMenu.qml b/mutable_config/quickshell/components/LogoutMenu/LogoutMenu.qml index a0bb531..d87c45b 100644 --- a/mutable_config/quickshell/components/LogoutMenu/LogoutMenu.qml +++ b/mutable_config/quickshell/components/LogoutMenu/LogoutMenu.qml @@ -8,12 +8,15 @@ PanelWindow { id: logoutWindow property QtObject rootState property int currentIndex: 2 // Default to Logout in the middle + // Destructive actions (Reboot/Shutdown) require a second confirmation + // before executing - selecting them the first time just arms them. + property int armedIndex: -1 property var actions: [ - { cmd: "loginctl lock-session" }, - { cmd: "systemctl suspend" }, - { cmd: "loginctl terminate-user $USER" }, - { cmd: "systemctl reboot" }, - { cmd: "systemctl poweroff" } + { cmd: "loginctl lock-session", key: "L", label: "Lock", sub: "loginctl lock-session", destructive: false }, + { cmd: "loginctl terminate-user $USER", key: "E", label: "Logout", sub: "loginctl terminate-user", destructive: false }, + { cmd: "systemctl suspend", key: "U", label: "Suspend", sub: "systemctl suspend", destructive: false }, + { cmd: "systemctl reboot", key: "R", label: "Reboot", sub: "systemctl reboot", destructive: true }, + { cmd: "systemctl poweroff", key: "S", label: "Shutdown", sub: "systemctl poweroff", destructive: true } ] visible: rootState.logoutMenuOpen @@ -24,7 +27,7 @@ PanelWindow { left: true right: true } - + exclusiveZone: 0 color: "transparent" @@ -39,74 +42,101 @@ PanelWindow { Rectangle { anchors.fill: parent - color: Theme.colors.overlay // Full screen dim/blur + color: Theme.colors.overlay // Full screen dim Behavior on opacity { NumberAnimation { duration: Theme.animation.durationNormal } } opacity: rootState.logoutMenuOpen ? 1 : 0 - + MouseArea { anchors.fill: parent onClicked: rootState.logoutMenuOpen = false } - Item { + Surface { id: container - width: buttonRow.width - height: buttonRow.height - anchors.centerIn: parent + width: modalColumn.width + Theme.geometry.padding * 2 + height: modalColumn.height + 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 scale { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.OutCubic } } - 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 + MouseArea { + anchors.fill: parent } - - // Suspend - LogoutButton { - icon: "" - label: "Suspend" - isSelected: logoutWindow.currentIndex === 1 - onClicked: executeAction(logoutWindow.actions[1].cmd) - onHovered: logoutWindow.currentIndex = 1 + + Column { + id: modalColumn + anchors.centerIn: parent + spacing: Theme.geometry.spacing + + // Title strip + Item { + width: buttonRow.width + height: 24 + + Row { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.geometry.spacing / 2 + + Rectangle { + width: 10 + height: 10 + anchors.verticalCenter: parent.verticalCenter + color: Theme.colors.primary + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + } + + Text { + text: "[SYSTEM // POWER MANAGEMENT]" + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + + Text { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: logoutWindow.armedIndex >= 0 ? "LATCH: ARMED" : "LATCH: IDLE" + color: logoutWindow.armedIndex >= 0 ? Theme.colors.alert : Theme.colors.textMuted + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + + Row { + id: buttonRow + spacing: Theme.geometry.spacing * 2 + + Repeater { + model: logoutWindow.actions + + delegate: LogoutButton { + action: modelData + index: model.index + isSelected: logoutWindow.currentIndex === model.index + isArmed: logoutWindow.armedIndex === model.index + onClicked: logoutWindow.select(model.index) + onHovered: logoutWindow.currentIndex = model.index + } + } + } + + HintBar { + anchors.horizontalCenter: parent.horizontalCenter + hints: [ + { key: "L/E/U/R/S", label: "Select" }, + { key: "↵", label: "Confirm" }, + { key: "Esc", label: "Abort" } + ] + } } - - // 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 - } - } } } @@ -114,30 +144,43 @@ PanelWindow { Item { anchors.fill: parent focus: true - + Keys.onEscapePressed: (event) => { - rootState.logoutMenuOpen = false; + if (logoutWindow.armedIndex >= 0) { + logoutWindow.armedIndex = -1; + } else { + rootState.logoutMenuOpen = false; + } event.accepted = true; } - + Keys.onLeftPressed: (event) => { - if (logoutWindow.currentIndex > 0) { - logoutWindow.currentIndex--; - } + if (logoutWindow.currentIndex > 0) logoutWindow.currentIndex--; + logoutWindow.armedIndex = -1; event.accepted = true; } - + Keys.onRightPressed: (event) => { - if (logoutWindow.currentIndex < 4) { - logoutWindow.currentIndex++; - } + if (logoutWindow.currentIndex < logoutWindow.actions.length - 1) logoutWindow.currentIndex++; + logoutWindow.armedIndex = -1; event.accepted = true; } - + Keys.onReturnPressed: (event) => { - executeAction(logoutWindow.actions[logoutWindow.currentIndex].cmd); + logoutWindow.select(logoutWindow.currentIndex); event.accepted = true; } + + Keys.onPressed: (event) => { + for (let i = 0; i < logoutWindow.actions.length; i++) { + if (event.text.toUpperCase() === logoutWindow.actions[i].key) { + logoutWindow.currentIndex = i; + logoutWindow.select(i); + event.accepted = true; + return; + } + } + } } Process { @@ -145,9 +188,19 @@ PanelWindow { running: false } - function executeAction(cmd) { - actionProcess.command = ["bash", "-c", cmd]; + // Non-destructive actions execute immediately. Destructive ones + // (Reboot/Shutdown) arm on first selection and only execute once armed + // and selected again - the "dual-stage confirmation / latch" from the + // power-menu design. + function select(index) { + let action = logoutWindow.actions[index]; + if (action.destructive && logoutWindow.armedIndex !== index) { + logoutWindow.armedIndex = index; + return; + } + actionProcess.command = ["bash", "-c", action.cmd]; actionProcess.running = true; + logoutWindow.armedIndex = -1; rootState.logoutMenuOpen = false; } @@ -155,50 +208,89 @@ PanelWindow { if (visible) { container.scale = 1.0; logoutWindow.currentIndex = 2; // Reset to center + logoutWindow.armedIndex = -1; } else { container.scale = 0.95; } } - - // Inline component for the big buttons + + // Inline component for the big power-action tiles. component LogoutButton: Surface { - property string icon: "" - property string label: "" - property bool isDestructive: false + id: button + property var action + property int index: 0 property bool isSelected: false + property bool isArmed: 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 + readonly property color actionColor: isArmed ? Theme.colors.alert + : action.destructive ? Theme.colors.alert + : Theme.colors.primary - Behavior on scale { SpringAnimation { spring: Theme.motion.springSnappy.spring; damping: Theme.motion.springSnappy.damping } } - scale: isSelected ? 1.05 : 1.0 + width: 128 + height: 128 + color: isSelected ? Theme.colors.surfaceHover : Theme.colors.surface + tint: isSelected || isArmed ? actionColor : Theme.colors.border + glow: isSelected || isArmed + pressed: hoverArea.pressed Column { anchors.centerIn: parent - spacing: Theme.geometry.spacing - - Text { - text: parent.parent.icon - font.family: Theme.font.family - font.pixelSize: 36 + spacing: Theme.geometry.spacing / 2 + + Row { anchors.horizontalCenter: parent.horizontalCenter - color: parent.parent.isSelected ? parent.parent.tint : Theme.colors.text + spacing: Theme.geometry.spacing / 2 + + Rectangle { + width: 16 + height: 16 + anchors.verticalCenter: parent.verticalCenter + color: button.isArmed ? Theme.colors.alert : "transparent" + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + + Text { + anchors.centerIn: parent + text: button.action.key + font.family: Theme.font.family + font.bold: true + font.pixelSize: 10 + color: button.isArmed ? Theme.colors.textOnAccent : Theme.colors.text + } + } + + Text { + anchors.verticalCenter: parent.verticalCenter + text: button.isArmed ? "ARMED" : ("#0" + (button.index + 1)) + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + color: button.isArmed ? Theme.colors.alert : Theme.colors.textMuted + } } - + Text { - text: parent.parent.label - font.family: Theme.font.family + text: button.action.label + font.family: Theme.font.headlineFamily font.pixelSize: 16 font.bold: true + font.capitalization: Font.AllUppercase color: Theme.colors.text anchors.horizontalCenter: parent.horizontalCenter } + + Text { + text: button.action.sub + font.family: Theme.font.family + font.pixelSize: 9 + color: button.action.destructive ? Theme.colors.alert : Theme.colors.textMuted + width: button.width - Theme.geometry.spacing * 2 + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + anchors.horizontalCenter: parent.horizontalCenter + } } MouseArea { @@ -206,8 +298,8 @@ PanelWindow { anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor - onEntered: parent.hovered() - onClicked: parent.clicked() + onEntered: button.hovered() + onClicked: button.clicked() } } } diff --git a/mutable_config/quickshell/components/Notifications/Notifications.qml b/mutable_config/quickshell/components/Notifications/Notifications.qml index f24cc70..2793840 100644 --- a/mutable_config/quickshell/components/Notifications/Notifications.qml +++ b/mutable_config/quickshell/components/Notifications/Notifications.qml @@ -6,6 +6,7 @@ import "../Shared" PanelWindow { id: notifWindow + property QtObject rootState anchors { top: true @@ -35,6 +36,12 @@ PanelWindow { onNotification: notification => { notification.tracked = true; + + // Do Not Disturb: the notification is still tracked/available + // to whatever reads NotificationServer directly, just not + // surfaced as a toast. + if (notifWindow.rootState && notifWindow.rootState.dndEnabled) return; + toastModel.insert(0, { notifObj: notification, appName: notification.appName, @@ -101,76 +108,88 @@ PanelWindow { Repeater { model: toastModel - delegate: Rectangle { + delegate: Surface { 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 + height: 20 + content.implicitHeight + color: Theme.colors.surface + tint: notifWindow.colorFor(model.urgency) + glow: model.urgency === NotificationUrgency.Critical 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 + Column { + anchors.fill: parent + // Solid accent header strip Rectangle { - width: 16 - height: 16 - radius: 8 + width: parent.width + height: 20 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 + anchors.left: parent.left + anchors.leftMargin: Theme.geometry.spacing + anchors.verticalCenter: parent.verticalCenter + text: notifWindow.labelFor(model.urgency).toUpperCase() + " :: " + 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 + font.pixelSize: Theme.type.caption + color: Theme.colors.textOnAccent } } - Text { - id: closeIcon - text: "" - color: Theme.colors.textMuted - font.family: Theme.font.family - font.pixelSize: 12 - anchors.top: parent.top + Row { + id: content + width: parent.width + leftPadding: Theme.geometry.padding + rightPadding: Theme.geometry.padding + topPadding: Theme.geometry.spacing + bottomPadding: Theme.geometry.spacing + spacing: Theme.geometry.spacing - MouseArea { - anchors.fill: parent - anchors.margins: -6 - cursorShape: Qt.PointingHandCursor - onClicked: { - model.notifObj.dismiss(); - toastModel.remove(index); + Column { + width: content.width - content.leftPadding - content.rightPadding - 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: Theme.colors.text + 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.textMuted + 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 + + MouseArea { + anchors.fill: parent + anchors.margins: -6 + cursorShape: Qt.PointingHandCursor + onClicked: { + model.notifObj.dismiss(); + toastModel.remove(index); + } } } } diff --git a/mutable_config/quickshell/components/OSD/OSD.qml b/mutable_config/quickshell/components/OSD/OSD.qml index 1e61da7..bc87413 100644 --- a/mutable_config/quickshell/components/OSD/OSD.qml +++ b/mutable_config/quickshell/components/OSD/OSD.qml @@ -43,8 +43,8 @@ PanelWindow { Behavior on margins.bottom { NumberAnimation { - duration: Theme.animation.durationNormal - easing.type: Easing.OutBack + duration: Theme.animation.durationFast + easing.type: Easing.OutCubic } } @@ -80,7 +80,6 @@ PanelWindow { width: 300 height: 60 anchors.centerIn: parent - radius: Theme.geometry.pillRadius tint: osdWindow.levelColor glow: true diff --git a/mutable_config/quickshell/components/QuickSettings/QuickSettings.qml b/mutable_config/quickshell/components/QuickSettings/QuickSettings.qml new file mode 100644 index 0000000..7124024 --- /dev/null +++ b/mutable_config/quickshell/components/QuickSettings/QuickSettings.qml @@ -0,0 +1,589 @@ +import QtQuick +import Quickshell +import Quickshell.Wayland +import Quickshell.Io +import Quickshell.Services.Pipewire +import Quickshell.Services.Mpris +import Quickshell.Networking +import Quickshell.Bluetooth +import "../Shared" + +PanelWindow { + id: qsWindow + property QtObject rootState + + readonly property int panelWidth: 380 + + visible: rootState.quickSettingsOpen + + // Spans the whole screen (like the other overlays) purely so the + // click-outside-to-close MouseArea below has somewhere to catch clicks - + // the visible chrome is just the anchored `panel` Surface in the corner. + anchors { top: true; bottom: true; left: true; right: true } + exclusiveZone: 0 + color: "transparent" + + WlrLayershell.layer: WlrLayer.Overlay + WlrLayershell.namespace: "quickshell-quicksettings" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive + + // --- Host / uptime --- + property string hostLabel: "localhost" + property string uptimeLabel: "" + + Process { + id: hostnameProcess + command: ["hostname"] + running: qsWindow.visible + stdout: StdioCollector { onStreamFinished: qsWindow.hostLabel = this.text.trim() } + } + + Process { + id: uptimeProcess + command: ["bash", "-c", "uptime -p | sed 's/^up //'"] + running: qsWindow.visible + stdout: StdioCollector { onStreamFinished: qsWindow.uptimeLabel = this.text.trim() } + } + + // --- Brightness (polled only while the panel is open) --- + property real brightnessLevel: 0.5 + + Timer { + interval: 1000 + running: qsWindow.visible + repeat: true + triggeredOnStart: true + onTriggered: brightnessProcess.restart() + } + + Process { + id: brightnessProcess + 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)) qsWindow.brightnessLevel = val / 100.0; + } + } + } + + Process { + id: setBrightnessProcess + running: false + function set(pct) { command = ["brightnessctl", "set", pct + "%"]; running = false; running = true; } + } + + // --- Volume (live Pipewire binding) --- + property QtObject sink: Pipewire.defaultAudioSink + property bool sinkReady: sink !== null && sink.ready && sink.audio !== null + property real volumeLevel: sinkReady ? sink.audio.volume : 0.0 + + // --- Audio sinks (all real hardware/software sinks, for the routing list) --- + readonly property var sinkNodes: Pipewire.nodes.values.filter(n => n.isSink && !n.isStream) + + PwObjectTracker { + objects: qsWindow.sinkNodes + } + + // --- Wi-Fi / Bluetooth status --- + function wifiNetworkName() { + let devices = Networking.devices ? Networking.devices.values : []; + for (const d of devices) { + if (d.type === DeviceType.Wifi && d.networks) { + for (const n of d.networks.values) if (n.connected) return n.name; + } + } + return ""; + } + + function bluetoothDeviceName() { + let adapter = Bluetooth.defaultAdapter; + if (!adapter || !adapter.devices) return ""; + for (const d of adapter.devices.values) if (d.connected) return d.name || d.deviceName; + return ""; + } + + // --- Night light: only wire the toggle to a binary that's actually installed --- + property string nightLightBinary: "" + property bool nightLightOn: false + + Process { + id: nightLightDetect + command: ["bash", "-c", "command -v gammastep || command -v wlsunset || true"] + running: true + stdout: StdioCollector { onStreamFinished: qsWindow.nightLightBinary = this.text.trim() } + } + + Process { + id: nightLightProcess + running: false + function toggle() { + if (qsWindow.nightLightBinary.length === 0) return; + if (qsWindow.nightLightOn) { + command = ["pkill", "-f", qsWindow.nightLightBinary]; + } else { + command = [qsWindow.nightLightBinary]; + } + running = false; + running = true; + qsWindow.nightLightOn = !qsWindow.nightLightOn; + } + } + + // --- Media player (first available MPRIS source) --- + readonly property var player: Mpris.players.values.length > 0 ? Mpris.players.values[0] : null + + MouseArea { + anchors.fill: parent + onClicked: rootState.quickSettingsOpen = false + } + + Item { + anchors.fill: parent + focus: qsWindow.visible + Keys.onEscapePressed: (event) => { rootState.quickSettingsOpen = false; event.accepted = true; } + } + + Surface { + id: panel + anchors.top: parent.top + anchors.right: parent.right + anchors.topMargin: 12 + anchors.rightMargin: 12 + width: qsWindow.panelWidth + height: content.implicitHeight + Theme.geometry.padding * 2 + tint: Theme.colors.primary + glow: true + + MouseArea { anchors.fill: parent } // absorb clicks so they don't fall through to the backdrop + + Column { + id: content + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: Theme.geometry.padding + spacing: Theme.geometry.spacing * 1.5 + + // --- Header --- + Item { + width: parent.width + height: 44 + + Row { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + spacing: Theme.geometry.spacing + + Rectangle { + width: 44 + height: 44 + color: Theme.colors.surfaceHover + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + Text { + anchors.centerIn: parent + text: Quickshell.env("USER").charAt(0).toUpperCase() + font.family: Theme.font.headlineFamily + font.bold: true + font.pixelSize: 20 + color: Theme.colors.primary + } + } + + Column { + anchors.verticalCenter: parent.verticalCenter + spacing: 2 + Text { + text: Quickshell.env("USER") + "@" + qsWindow.hostLabel + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.label + } + Text { + text: "UP " + qsWindow.uptimeLabel + color: Theme.colors.textMuted + font.family: Theme.font.family + font.pixelSize: Theme.type.caption + } + } + } + + Rectangle { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + width: 28 + height: 28 + color: "transparent" + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.alert + + Text { + anchors.centerIn: parent + text: "PWR" + color: Theme.colors.alert + font.family: Theme.font.family + font.bold: true + font.pixelSize: 9 + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + rootState.quickSettingsOpen = false; + rootState.logoutMenuOpen = true; + } + } + } + } + + // --- 2x2 toggle grid --- + Grid { + width: parent.width + columns: 2 + rowSpacing: Theme.geometry.spacing + columnSpacing: Theme.geometry.spacing + + ToggleTile { + label: "Wi-Fi" + sub: on ? (qsWindow.wifiNetworkName() || "Connected") : "Disabled" + on: Networking.wifiEnabled + accent: Theme.colors.primary + onToggledSwitch: Networking.wifiEnabled = !Networking.wifiEnabled + } + + ToggleTile { + label: "Bluetooth" + sub: on ? (qsWindow.bluetoothDeviceName() || "On") : "Disabled" + on: Bluetooth.defaultAdapter ? Bluetooth.defaultAdapter.enabled : false + accent: Theme.colors.secondary + onToggledSwitch: { + if (Bluetooth.defaultAdapter) Bluetooth.defaultAdapter.enabled = !Bluetooth.defaultAdapter.enabled; + } + } + + ToggleTile { + label: "Do Not Disturb" + sub: on ? "Notifications Off" : "Notifications On" + on: rootState.dndEnabled + accent: Theme.colors.warning + onToggledSwitch: rootState.dndEnabled = !rootState.dndEnabled + } + + ToggleTile { + label: "Night Light" + sub: qsWindow.nightLightBinary.length === 0 ? "Unavailable" : (on ? "Enabled" : "Disabled") + on: qsWindow.nightLightOn + enabled: qsWindow.nightLightBinary.length > 0 + accent: Theme.colors.tertiary + onToggledSwitch: nightLightProcess.toggle() + } + } + + // --- Sliders --- + Column { + width: parent.width + spacing: Theme.geometry.spacing + + Column { + width: parent.width + spacing: Theme.geometry.spacing / 2 + + Item { + width: parent.width + height: 16 + + Text { + anchors.left: parent.left + text: "OUTPUT LEVEL" + color: Theme.colors.textMuted + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + Text { + anchors.right: parent.right + text: Math.round(qsWindow.volumeLevel * 100) + "%" + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + + MouseArea { + width: parent.width + height: 16 + function apply(mx) { + if (!qsWindow.sinkReady) return; + qsWindow.sink.audio.volume = Math.max(0, Math.min(1, mx / width)); + } + onPressed: (mouse) => apply(mouse.x) + onPositionChanged: (mouse) => { if (pressed) apply(mouse.x); } + + ProgressBar { + anchors.verticalCenter: parent.verticalCenter + width: parent.width + value: qsWindow.volumeLevel + fillColor: Theme.colors.secondary + } + } + } + + Column { + width: parent.width + spacing: Theme.geometry.spacing / 2 + + Item { + width: parent.width + height: 16 + + Text { + anchors.left: parent.left + text: "BRIGHTNESS" + color: Theme.colors.textMuted + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + Text { + anchors.right: parent.right + text: Math.round(qsWindow.brightnessLevel * 100) + "%" + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + + MouseArea { + width: parent.width + height: 16 + function apply(mx) { + let pct = Math.round(Math.max(0, Math.min(1, mx / width)) * 100); + qsWindow.brightnessLevel = pct / 100.0; + setBrightnessProcess.set(pct); + } + onPressed: (mouse) => apply(mouse.x) + onPositionChanged: (mouse) => { if (pressed) apply(mouse.x); } + + ProgressBar { + anchors.verticalCenter: parent.verticalCenter + width: parent.width + value: qsWindow.brightnessLevel + fillColor: Theme.colors.primary + } + } + } + } + + // --- Audio sink routing --- + Column { + width: parent.width + spacing: Theme.geometry.spacing / 2 + visible: qsWindow.sinkNodes.length > 0 + + Repeater { + model: qsWindow.sinkNodes + + delegate: ListRow { + width: parent.width + accent: Theme.colors.primary + selected: qsWindow.sink !== null && modelData.id === qsWindow.sink.id + onClicked: Pipewire.preferredDefaultAudioSink = modelData + + Text { + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.right: statusChip.left + anchors.rightMargin: Theme.geometry.spacing + text: modelData.description || modelData.name + color: (qsWindow.sink !== null && modelData.id === qsWindow.sink.id) ? Theme.colors.textOnAccent : Theme.colors.text + font.family: Theme.font.family + font.pixelSize: Theme.type.caption + elide: Text.ElideRight + } + + Text { + id: statusChip + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: (qsWindow.sink !== null && modelData.id === qsWindow.sink.id) ? "DEFAULT" : "" + color: Theme.colors.textOnAccent + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + } + } + + // --- Media player --- + Surface { + width: parent.width + height: 96 + visible: qsWindow.player !== null + color: Theme.colors.surface + tint: Theme.colors.tertiary + + Column { + anchors.fill: parent + anchors.margins: Theme.geometry.spacing + spacing: Theme.geometry.spacing / 2 + + Row { + width: parent.width + spacing: Theme.geometry.spacing + + Text { + text: "♪" + color: Theme.colors.tertiary + font.family: Theme.font.family + font.pixelSize: 18 + } + + Column { + anchors.verticalCenter: parent.verticalCenter + Text { + text: qsWindow.player ? qsWindow.player.trackTitle : "" + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + elide: Text.ElideRight + width: 260 + } + Text { + text: qsWindow.player ? qsWindow.player.trackArtist : "" + color: Theme.colors.textMuted + font.family: Theme.font.family + font.pixelSize: Theme.type.caption + elide: Text.ElideRight + width: 260 + } + } + } + + ProgressBar { + width: parent.width + value: (qsWindow.player && qsWindow.player.length > 0) ? qsWindow.player.position / qsWindow.player.length : 0 + fillColor: Theme.colors.tertiary + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: Theme.geometry.spacing * 1.5 + + Text { + text: "◀" + color: Theme.colors.text + font.family: Theme.font.family + font.pixelSize: 14 + MouseArea { anchors.fill: parent; anchors.margins: -6; cursorShape: Qt.PointingHandCursor; onClicked: qsWindow.player && qsWindow.player.previous() } + } + + Text { + text: (qsWindow.player && qsWindow.player.isPlaying) ? "II" : "▶" + color: Theme.colors.tertiary + font.family: Theme.font.family + font.bold: true + font.pixelSize: 14 + MouseArea { anchors.fill: parent; anchors.margins: -6; cursorShape: Qt.PointingHandCursor; onClicked: qsWindow.player && qsWindow.player.togglePlaying() } + } + + Text { + text: "▶" + color: Theme.colors.text + font.family: Theme.font.family + font.pixelSize: 14 + MouseArea { anchors.fill: parent; anchors.margins: -6; cursorShape: Qt.PointingHandCursor; onClicked: qsWindow.player && qsWindow.player.next() } + } + } + } + } + + // --- Footer --- + Row { + width: parent.width + spacing: Theme.geometry.spacing / 2 + + Rectangle { + width: 8 + height: 8 + anchors.verticalCenter: parent.verticalCenter + color: Theme.colors.success + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + } + + Text { + text: "STATUS: OK" + color: Theme.colors.textMuted + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } + } + } + } + + // Inline component for a 2x2 toggle tile. + component ToggleTile: Surface { + id: tile + property string label: "" + property string sub: "" + property bool on: false + property color accent: Theme.colors.primary + signal toggledSwitch() + + width: (qsWindow.panelWidth - Theme.geometry.padding * 2 - Theme.geometry.spacing) / 2 + height: 68 + color: Theme.colors.surface + tint: on ? accent : Theme.colors.border + glow: on + opacity: enabled ? 1.0 : 0.5 + + Item { + anchors.fill: parent + anchors.margins: Theme.geometry.spacing + + Column { + anchors.left: parent.left + anchors.right: toggleSwitch.left + anchors.rightMargin: Theme.geometry.spacing / 2 + anchors.verticalCenter: parent.verticalCenter + spacing: 2 + + Text { + text: tile.label + color: Theme.colors.text + font.family: Theme.font.headlineFamily + font.bold: true + font.pixelSize: Theme.type.body + } + Text { + text: tile.sub + color: Theme.colors.textMuted + font.family: Theme.font.family + font.pixelSize: Theme.type.caption + elide: Text.ElideRight + width: parent.width + } + } + + ToggleSwitch { + id: toggleSwitch + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + checked: tile.on + onColor: tile.accent + + onToggled: tile.toggledSwitch() + } + } + } +} diff --git a/mutable_config/quickshell/components/Shared/Button.qml b/mutable_config/quickshell/components/Shared/Button.qml index a4f1f18..8a90af8 100644 --- a/mutable_config/quickshell/components/Shared/Button.qml +++ b/mutable_config/quickshell/components/Shared/Button.qml @@ -1,8 +1,7 @@ import QtQuick -import QtQuick.Effects import "." -Rectangle { +Surface { id: button // "primary" | "secondary" | "accent" | "destructive" | "success" | "warning" | "info" @@ -13,7 +12,7 @@ Rectangle { // 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 + readonly property color variantColor: variant === "accent" ? Theme.colors.accent : variant === "destructive" ? Theme.colors.alert : variant === "success" ? Theme.colors.success : variant === "warning" ? Theme.colors.warning @@ -22,35 +21,27 @@ Rectangle { implicitWidth: label.implicitWidth + Theme.geometry.padding * 2 implicitHeight: label.implicitHeight + Theme.geometry.padding + width: implicitWidth + height: implicitHeight - 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 - } + ? (mouseArea.containsMouse ? Qt.lighter(variantColor, 1.15) : variantColor) + : (mouseArea.containsMouse ? Theme.colors.surfaceHover : Theme.colors.surface) + tint: variantColor + glow: !filled && mouseArea.containsMouse + pressed: mouseArea.pressed 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.family: Theme.font.headlineFamily + font.pixelSize: 14 font.bold: true - color: button.filled ? Theme.colors.background : button.tint + font.capitalization: Font.AllUppercase + color: button.filled ? Theme.colors.textOnAccent : button.variantColor } MouseArea { diff --git a/mutable_config/quickshell/components/Shared/Checkbox.qml b/mutable_config/quickshell/components/Shared/Checkbox.qml new file mode 100644 index 0000000..a38e1b9 --- /dev/null +++ b/mutable_config/quickshell/components/Shared/Checkbox.qml @@ -0,0 +1,36 @@ +import QtQuick +import "." + +// 18x18 square checkbox with a 10x10 solid core when checked, per +// DESIGN.md's Checkboxes spec. +Item { + id: box + + // Controlled component - see ToggleSwitch.qml. + property bool checked: false + signal toggled() + + implicitWidth: 18 + implicitHeight: 18 + + Rectangle { + anchors.fill: parent + color: Theme.colors.surface + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + + Rectangle { + width: 10 + height: 10 + anchors.centerIn: parent + color: Theme.colors.primary + visible: box.checked + } + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: box.toggled() + } +} diff --git a/mutable_config/quickshell/components/Shared/ContextMenu.qml b/mutable_config/quickshell/components/Shared/ContextMenu.qml index 9535c60..2cd09ea 100644 --- a/mutable_config/quickshell/components/Shared/ContextMenu.qml +++ b/mutable_config/quickshell/components/Shared/ContextMenu.qml @@ -14,7 +14,7 @@ Rectangle { radius: Theme.geometry.radiusMedium color: Theme.colors.background border.color: Theme.colors.border - border.width: 1 + border.width: Theme.geometry.borderWidth height: column.implicitHeight + Theme.geometry.spacing function openAt(px, py) { diff --git a/mutable_config/quickshell/components/Shared/HintBar.qml b/mutable_config/quickshell/components/Shared/HintBar.qml index abe22b5..6460677 100644 --- a/mutable_config/quickshell/components/Shared/HintBar.qml +++ b/mutable_config/quickshell/components/Shared/HintBar.qml @@ -1,7 +1,7 @@ import QtQuick import "." -// Row of "key label" keyboard hints shown under launcher-style overlays, +// Row of "[KEY] label" keyboard hints shown under launcher-style overlays, // e.g. [ [↑↓, "Navigate"], ["↵", "Launch"], ["Esc", "Close"] ]. Row { id: hintBar @@ -16,12 +16,16 @@ Row { 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 + Pill { + tint: Theme.colors.outlineVariant + + Text { + text: "[" + modelData.key + "]" + color: Theme.colors.text + font.family: Theme.font.family + font.bold: true + font.pixelSize: Theme.type.caption + } } Text { @@ -29,6 +33,7 @@ Row { color: Theme.colors.textMuted font.family: Theme.font.family font.pixelSize: Theme.type.caption + anchors.verticalCenter: parent.verticalCenter } } } diff --git a/mutable_config/quickshell/components/Shared/ListRow.qml b/mutable_config/quickshell/components/Shared/ListRow.qml index ef54631..e70a603 100644 --- a/mutable_config/quickshell/components/Shared/ListRow.qml +++ b/mutable_config/quickshell/components/Shared/ListRow.qml @@ -1,8 +1,8 @@ import QtQuick import "." -// Selectable list row: a colored left accent bar plus a tinted background -// when current, shared by CommandPalette and ClipboardManager so both +// Selectable list row: solid accent fill + crust text when selected (not a +// soft tint), shared by CommandPalette and ClipboardManager so both // launchers read as the same design language. Rectangle { id: row @@ -16,25 +16,20 @@ Rectangle { signal entered() height: 40 - radius: Theme.geometry.radiusTiny - color: selected ? Qt.alpha(accent, 0.16) : "transparent" + color: selected ? accent : (hovered ? Theme.colors.surfaceHover : "transparent") + border.width: selected ? Theme.geometry.borderWidth : 0 + border.color: Theme.colors.crust Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } } Rectangle { - width: 3 - height: parent.height - 10 - anchors.verticalCenter: parent.verticalCenter + width: 4 + height: parent.height anchors.left: parent.left - radius: 2 - color: row.accent - opacity: row.selected ? 1 : 0 - Behavior on opacity { NumberAnimation { duration: Theme.animation.durationFast } } + color: Theme.colors.crust + visible: row.selected } - // 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 @@ -47,7 +42,9 @@ Rectangle { Item { id: contentItem anchors.fill: parent - anchors.leftMargin: Theme.geometry.padding + 4 + anchors.leftMargin: Theme.geometry.padding + ((row.selected || row.hovered) ? 8 : 4) anchors.rightMargin: Theme.geometry.padding + + Behavior on anchors.leftMargin { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.Linear } } } } diff --git a/mutable_config/quickshell/components/Shared/Pill.qml b/mutable_config/quickshell/components/Shared/Pill.qml index 62e0b65..11a2509 100644 --- a/mutable_config/quickshell/components/Shared/Pill.qml +++ b/mutable_config/quickshell/components/Shared/Pill.qml @@ -1,54 +1,46 @@ 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 { +// Status chip / telemetry badge: sharp corners, 2px border, a tight 2px +// offset shadow (deliberately smaller than Surface's, per DESIGN.md's +// "Status Chips & Telemetry Badges" spec). Children are centered in an +// internal Row - place them directly as this component's children, same as +// putting them in a Row. +Item { id: pill - property color tint: Theme.colors.border + property color tint: Theme.colors.outlineVariant 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 - ); - } + readonly property color edgeColor: glow ? tint : Theme.colors.crust + readonly property int offset: 2 - implicitWidth: contentRow.implicitWidth + Theme.geometry.padding * 2 - implicitHeight: contentRow.implicitHeight + Theme.geometry.padding + implicitWidth: contentRow.implicitWidth + Theme.geometry.padding * 2 + offset + implicitHeight: contentRow.implicitHeight + Theme.geometry.spacing + offset 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 + Rectangle { + x: pill.offset + y: pill.offset + width: pill.width - pill.offset + height: pill.height - pill.offset + color: pill.edgeColor } - Row { - id: contentRow - anchors.centerIn: parent - spacing: Theme.geometry.spacing + Rectangle { + width: pill.width - pill.offset + height: pill.height - pill.offset + color: Theme.colors.surface + border.width: Theme.geometry.borderWidth + border.color: pill.edgeColor + + Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } } + + Row { + id: contentRow + anchors.centerIn: parent + spacing: Theme.geometry.spacing + } } } diff --git a/mutable_config/quickshell/components/Shared/ProgressBar.qml b/mutable_config/quickshell/components/Shared/ProgressBar.qml index 01e541d..f52b146 100644 --- a/mutable_config/quickshell/components/Shared/ProgressBar.qml +++ b/mutable_config/quickshell/components/Shared/ProgressBar.qml @@ -1,25 +1,28 @@ import QtQuick import "." -// Colored fill bar for OSD volume/brightness and similar level readouts. +// Sharp-cornered track+fill for OSD volume/brightness and similar level +// readouts, and the base for slider-style controls in Quick Settings. Item { id: bar property real value: 0 // 0..1 property color fillColor: Theme.colors.primary - height: 8 + height: 10 Rectangle { anchors.fill: parent color: Theme.colors.surfaceHover - radius: height / 2 + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust clip: true Rectangle { - width: parent.width * Math.max(0, Math.min(1, bar.value)) - height: parent.height - radius: parent.radius + width: Math.max(0, parent.width * Math.max(0, Math.min(1, bar.value)) - parent.border.width * 2) + height: parent.height - parent.border.width * 2 + x: parent.border.width + y: parent.border.width color: bar.fillColor Behavior on width { NumberAnimation { duration: Theme.animation.durationFast } } diff --git a/mutable_config/quickshell/components/Shared/Surface.qml b/mutable_config/quickshell/components/Shared/Surface.qml index 5f77cdd..e280981 100644 --- a/mutable_config/quickshell/components/Shared/Surface.qml +++ b/mutable_config/quickshell/components/Shared/Surface.qml @@ -1,26 +1,47 @@ import QtQuick -import QtQuick.Effects import "." -// Base panel/card chrome shared by menus, pickers, and dialogs: rounded -// background, border, optional colored glow. -Rectangle { +// Base panel/card chrome shared by menus, pickers, and dialogs: sharp +// corners, a solid 2px border, and a hard offset "shadow" - a flat duplicate +// rectangle displaced down-right, never blurred. `glow` switches the border +// and shadow from the default crust to `tint` (DESIGN.md's "Focused / +// Active" state, also used for danger/selected emphasis). `pressed` +// collapses the shadow and slides the face onto it - the mechanical +// depression press effect. Children declared on a Surface instance attach +// to the face, not the outer Item, so they translate together with it. +Item { id: surface - property color tint: Theme.colors.border + default property alias content: face.data + property alias color: face.color + property color tint: Theme.colors.primary property bool glow: false + property bool pressed: false - radius: Theme.geometry.radiusMedium - color: Theme.colors.background - border.color: tint - border.width: 1 + readonly property int offset: glow ? Theme.elevation.high : Theme.elevation.low + readonly property color edgeColor: glow ? tint : Theme.colors.crust - layer.enabled: glow - layer.effect: MultiEffect { - shadowEnabled: true - shadowColor: surface.tint - shadowOpacity: Theme.elevation.medium.opacity - shadowBlur: Theme.elevation.medium.blur - shadowVerticalOffset: 2 + Rectangle { + id: shadow + x: surface.offset + y: surface.offset + width: surface.width + height: surface.height + color: surface.edgeColor + visible: !surface.pressed + } + + Rectangle { + id: face + x: surface.pressed ? surface.offset : 0 + y: surface.pressed ? surface.offset : 0 + width: surface.width + height: surface.height + color: Theme.colors.background + border.width: Theme.geometry.borderWidth + border.color: surface.edgeColor + + Behavior on x { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.Linear } } + Behavior on y { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.Linear } } } } diff --git a/mutable_config/quickshell/components/Shared/TextField.qml b/mutable_config/quickshell/components/Shared/TextField.qml index 1438459..320aded 100644 --- a/mutable_config/quickshell/components/Shared/TextField.qml +++ b/mutable_config/quickshell/components/Shared/TextField.qml @@ -1,17 +1,18 @@ import QtQuick -import QtQuick.Effects import "." -// Search/filter input with an animated focus border + glow, shared by +// Search/filter input with a hard focus border + shadow, 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 { +Item { id: field property alias text: input.text property alias echoMode: input.echoMode + property alias passwordCharacter: input.passwordCharacter property string placeholder: "" + property string prefix: "" signal escapePressed() signal upPressed() @@ -21,6 +22,12 @@ Rectangle { function focusInput() { input.forceActiveFocus(); } + readonly property bool focused: input.activeFocus + readonly property color edgeColor: focused ? Theme.colors.primary : Theme.colors.crust + readonly property int offset: focused ? Theme.elevation.high : Theme.elevation.low + + height: 50 + // The layer-shell surface only gets real keyboard focus from the // compositor asynchronously after it's first mapped, so a single // forceActiveFocus() call right on visible-toggle can silently lose @@ -34,51 +41,70 @@ Rectangle { onTriggered: 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 + Rectangle { + x: field.offset + y: field.offset + width: field.width + height: field.height + color: field.edgeColor } - 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 + Rectangle { + width: field.width + height: field.height + color: Theme.colors.surface + border.width: Theme.geometry.borderWidth + border.color: field.edgeColor + + Behavior on border.color { ColorAnimation { duration: Theme.animation.durationFast } } Text { - text: field.placeholder - color: Theme.colors.textMuted + id: prefixText + text: field.prefix + visible: field.prefix.length > 0 + color: Theme.colors.secondary font.family: Theme.font.family + font.bold: true font.pixelSize: 18 + anchors.left: parent.left + anchors.leftMargin: Theme.geometry.padding 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; + TextInput { + id: input + anchors.fill: parent + anchors.margins: Theme.geometry.padding + anchors.leftMargin: field.prefix.length > 0 ? prefixText.width + Theme.geometry.padding + Theme.geometry.spacing / 2 : Theme.geometry.padding + verticalAlignment: TextInput.AlignVCenter + font.family: Theme.font.family + font.pixelSize: 18 + color: Theme.colors.text + clip: true + + cursorDelegate: Rectangle { + width: 9 + color: Theme.colors.primary + } + + 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; + } } } } diff --git a/mutable_config/quickshell/components/Shared/Theme.qml b/mutable_config/quickshell/components/Shared/Theme.qml index 3314102..2d2bc1d 100644 --- a/mutable_config/quickshell/components/Shared/Theme.qml +++ b/mutable_config/quickshell/components/Shared/Theme.qml @@ -5,61 +5,70 @@ QtObject { id: theme // Regenerated by wallpaper-theme.nu on every wallpaper change - don't - // hand-edit between these markers, it gets overwritten. + // hand-edit between these markers, it gets overwritten. Colors are + // always opaque (no alpha blending) per the neo-brutalist system: solid + // blocks, no soft/translucent surfaces. `overlay` is the one exception + // (a full-screen dimming scrim, not a card surface). // 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 background: "#1e1e2e" + property color surface: "#181825" + property color surfaceHover: "#313244" + property color overlay: "#cc11111b" - property color primary: "#74c7ec" + property color crust: "#11111b" + property color outlineVariant: "#45475a" + + property color primary: "#eba0ac" property color secondary: "#cba6f7" - property color tertiary: "#a6e3a1" - property color accent: "#74c7ec" + property color tertiary: "#f2cdcd" + property color accent: "#eba0ac" - property color primaryContainer: "#2474c7ec" - property color secondaryContainer: "#24cba6f7" - property color tertiaryContainer: "#24a6e3a1" + property color primaryContainer: "#695363" + property color secondaryContainer: "#5f557a" + property color tertiaryContainer: "#6b616d" property color alert: "#f38ba8" - property color alertContainer: "#24f38ba8" + property color alertContainer: "#6b4d62" property color success: "#a6e3a1" - property color successContainer: "#24a6e3a1" + property color successContainer: "#546760" property color warning: "#f9e2af" - property color warningContainer: "#24f9e2af" + property color warningContainer: "#6d6764" property color info: "#74c7ec" - property color infoContainer: "#2474c7ec" + property color infoContainer: "#455f76" property color text: "#cdd6f4" property color textMuted: "#a6adc8" - property color textOnAccent: "#e611111b" + property color textOnAccent: "#11111b" - property color border: "#1a74c7ec" + property color border: "#11111b" } // 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 radiusTiny: 0 + property int radiusSmall: 0 + property int radiusMedium: 0 + property int pillRadius: 0 property int padding: 12 property int spacing: 8 + property int borderWidth: 2 } property QtObject animation: QtObject { - property int durationFast: 150 - property int durationNormal: 250 - property int durationSlow: 400 + property int durationFast: 100 + property int durationNormal: 150 + property int durationSlow: 250 } - // 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 } + // Hard offset-shadow steps (px), replacing the old blur/glow elevation + // system. No blur, ever - depth comes from a flat displaced duplicate + // rectangle. `high` is used for the focused/active accent-colored + // variant; `overlay` for big floating surfaces (launcher, modals). + property QtObject elevation: QtObject { + property int low: 4 + property int high: 6 + property int overlay: 8 } // Type scale. Family stays fixed - this is only about size/weight steps. @@ -77,15 +86,8 @@ QtObject { 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" + property string headlineFamily: "Plus Jakarta Sans" } } diff --git a/mutable_config/quickshell/components/Shared/ToggleSwitch.qml b/mutable_config/quickshell/components/Shared/ToggleSwitch.qml new file mode 100644 index 0000000..fdaac3f --- /dev/null +++ b/mutable_config/quickshell/components/Shared/ToggleSwitch.qml @@ -0,0 +1,44 @@ +import QtQuick +import "." + +// Rectangular tray + square thumb toggle, per DESIGN.md: 36x20 tray, 12x12 +// thumb that translates (never curves) between two hard-stop positions. +Item { + id: toggle + + // Controlled component: clicking never mutates `checked` itself, it + // only requests a change via `toggled()` - the caller owns the real + // state (usually a live system property) and rebinds `checked` to it. + property bool checked: false + property color onColor: Theme.colors.success + signal toggled() + + implicitWidth: 36 + implicitHeight: 20 + + Rectangle { + anchors.fill: parent + color: toggle.checked ? toggle.onColor : Theme.colors.surface + border.width: Theme.geometry.borderWidth + border.color: Theme.colors.crust + + Behavior on color { ColorAnimation { duration: Theme.animation.durationFast } } + + Rectangle { + id: thumb + width: 12 + height: 12 + y: (parent.height - height) / 2 + x: toggle.checked ? parent.width - width - 4 : 4 + color: Theme.colors.crust + + Behavior on x { NumberAnimation { duration: Theme.animation.durationFast; easing.type: Easing.Linear } } + } + } + + MouseArea { + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: toggle.toggled() + } +} diff --git a/mutable_config/quickshell/components/Shared/Tooltip.qml b/mutable_config/quickshell/components/Shared/Tooltip.qml index f4bf5b0..ded390d 100644 --- a/mutable_config/quickshell/components/Shared/Tooltip.qml +++ b/mutable_config/quickshell/components/Shared/Tooltip.qml @@ -11,7 +11,7 @@ Rectangle { radius: Theme.geometry.radiusMedium color: Theme.colors.background border.color: Theme.colors.border - border.width: 1 + border.width: Theme.geometry.borderWidth width: label.implicitWidth + Theme.geometry.padding * 2 height: label.implicitHeight + Theme.geometry.padding diff --git a/mutable_config/quickshell/components/Shared/qmldir b/mutable_config/quickshell/components/Shared/qmldir index 20295c2..9a8cac3 100644 --- a/mutable_config/quickshell/components/Shared/qmldir +++ b/mutable_config/quickshell/components/Shared/qmldir @@ -9,3 +9,5 @@ Tooltip 1.0 Tooltip.qml Showcase 1.0 Showcase.qml ListRow 1.0 ListRow.qml HintBar 1.0 HintBar.qml +ToggleSwitch 1.0 ToggleSwitch.qml +Checkbox 1.0 Checkbox.qml diff --git a/mutable_config/quickshell/components/WallpaperPicker/WallpaperPicker.qml b/mutable_config/quickshell/components/WallpaperPicker/WallpaperPicker.qml index de281be..b53ff7e 100644 --- a/mutable_config/quickshell/components/WallpaperPicker/WallpaperPicker.qml +++ b/mutable_config/quickshell/components/WallpaperPicker/WallpaperPicker.qml @@ -121,7 +121,6 @@ PanelWindow { 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 diff --git a/mutable_config/quickshell/shell.qml b/mutable_config/quickshell/shell.qml index 357d92d..2cce179 100644 --- a/mutable_config/quickshell/shell.qml +++ b/mutable_config/quickshell/shell.qml @@ -11,6 +11,7 @@ import "components/ClipboardManager" import "components/Notifications" import "components/WallpaperPicker" import "components/LockScreen" +import "components/QuickSettings" ShellRoot { id: root @@ -20,15 +21,26 @@ ShellRoot { property bool logoutMenuOpen: false property bool clipboardManagerOpen: false property bool wallpaperPickerOpen: false + property bool quickSettingsOpen: false + property bool dndEnabled: false + + // Only one overlay is ever open at once - closing every other one is + // simpler and less error-prone than each toggle() hand-listing its + // siblings (which is how this used to work, and reliably went stale + // every time a new overlay was added). + function closeOtherOverlays(keepOpen) { + if (keepOpen !== "commandPalette") commandPaletteOpen = false; + if (keepOpen !== "logoutMenu") logoutMenuOpen = false; + if (keepOpen !== "clipboardManager") clipboardManagerOpen = false; + if (keepOpen !== "wallpaperPicker") wallpaperPickerOpen = false; + if (keepOpen !== "quickSettings") quickSettingsOpen = false; + } IpcHandler { target: "commandPalette" function toggle() { commandPaletteOpen = !commandPaletteOpen; - if (commandPaletteOpen) { - logoutMenuOpen = false; - clipboardManagerOpen = false; - } + if (commandPaletteOpen) closeOtherOverlays("commandPalette"); } } @@ -36,10 +48,7 @@ ShellRoot { target: "logoutMenu" function toggle() { logoutMenuOpen = !logoutMenuOpen; - if (logoutMenuOpen) { - commandPaletteOpen = false; - clipboardManagerOpen = false; - } + if (logoutMenuOpen) closeOtherOverlays("logoutMenu"); } } @@ -47,10 +56,15 @@ ShellRoot { target: "clipboardManager" function toggle() { clipboardManagerOpen = !clipboardManagerOpen; - if (clipboardManagerOpen) { - commandPaletteOpen = false; - logoutMenuOpen = false; - } + if (clipboardManagerOpen) closeOtherOverlays("clipboardManager"); + } + } + + IpcHandler { + target: "quickSettings" + function toggle() { + quickSettingsOpen = !quickSettingsOpen; + if (quickSettingsOpen) closeOtherOverlays("quickSettings"); } } @@ -68,11 +82,7 @@ ShellRoot { target: "wallpaperSwitcher" function open() { wallpaperPickerOpen = !wallpaperPickerOpen; - if (wallpaperPickerOpen) { - commandPaletteOpen = false; - logoutMenuOpen = false; - clipboardManagerOpen = false; - } + if (wallpaperPickerOpen) closeOtherOverlays("wallpaperPicker"); } function random() { randomWallpaperProcess.running = false; @@ -117,6 +127,12 @@ ShellRoot { Notifications { id: notifications + rootState: root + } + + QuickSettings { + id: quickSettings + rootState: root } WallpaperPicker {