The launcher used the open notch's fill, so with "Glassy when open" it
turned back to glass. It now keeps the docked notch's colour by default;
notch.launcherMatch ("Launcher keeps notch colour", shown under the
glassy toggle) can turn it off to follow the open notch again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
79 lines
5.2 KiB
QML
79 lines
5.2 KiB
QML
pragma Singleton
|
|
import QtQuick
|
|
import Quickshell
|
|
import "../services"
|
|
import "ColorLogic.js" as ColorLogic
|
|
|
|
Singleton {
|
|
id: root
|
|
property color accent: ThemeManager.accent
|
|
Behavior on accent {
|
|
ColorAnimation {
|
|
duration: Theme.duration
|
|
}
|
|
}
|
|
readonly property color accentHover: Qt.lighter(accent, 1.12)
|
|
// Same hue, lifted so dark accents stay visible as fills on dark glass.
|
|
readonly property color accentVivid: accent.hslLightness < 0.5 ? Qt.hsla(accent.hslHue, accent.hslSaturation, 0.6, 1) : accent
|
|
readonly property color accentPressed: Qt.darker(accent, 1.12)
|
|
readonly property color accentDarkText: "#000000"
|
|
readonly property color accentLightText: "#ffffff"
|
|
readonly property color accentText: textOn(accent)
|
|
readonly property color accentHoverText: textOn(accentHover)
|
|
readonly property color accentPressedText: textOn(accentPressed)
|
|
function textOn(background) {
|
|
const palette = MatugenService.accentText;
|
|
const base = ColorLogic.luminance(background.r, background.g, background.b);
|
|
if (ThemeManager.source === "matugen" && MatugenService.available && palette.a > 0 && ColorLogic.contrast(base, ColorLogic.luminance(palette.r, palette.g, palette.b)) >= 4.5)
|
|
return palette;
|
|
return ColorLogic.darkForeground(background.r, background.g, background.b) ? accentDarkText : accentLightText;
|
|
}
|
|
// Glass tint, like Ghostty's `background`: panels use it at the configured
|
|
// opacity, controls and cards are translucent shades of it (never grey overlays).
|
|
readonly property color tint: ConfigService.ready && /^#[0-9a-fA-F]{6}$/.test(ConfigService.data.appearance.glassTint) ? ConfigService.data.appearance.glassTint : "#000000"
|
|
readonly property color surface: tint
|
|
// Notch mode's fill: at opacity 0 it is the normal glass; raising it moves
|
|
// towards a solid colour (the glass tint unless a notch colour is set).
|
|
readonly property color notchFill: {
|
|
const n = ConfigService.ready ? ConfigService.data.notch : null;
|
|
const c = n && /^#[0-9a-fA-F]{6}$/.test(n.color) ? n.color : tint;
|
|
const o = n ? Math.max(0, Math.min(100, n.opacity)) / 100 : 0;
|
|
return Qt.alpha(c, glassOpacity + (1 - glassOpacity) * o);
|
|
}
|
|
// The open notch's fill: the plain glass when "glassy when open" is on.
|
|
readonly property color notchOpenFill: ConfigService.ready && ConfigService.data.notch.glassOnOpen ? Qt.alpha(tint, glassOpacity) : notchFill
|
|
// The launcher keeps the docked notch's colour unless it is set to follow
|
|
// "glassy when open".
|
|
readonly property color notchLauncherFill: ConfigService.ready && !ConfigService.data.notch.launcherMatch ? notchOpenFill : notchFill
|
|
// Notch animations run at their own speeds (percent; 100 follows the shell),
|
|
// one for opening and one for closing.
|
|
readonly property real notchOpenDuration: duration * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.openSpeed) : 100)
|
|
readonly property real notchCloseDuration: duration * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.closeSpeed) : 100)
|
|
// Docked colour to the open fill and back (only differs with "glassy when open").
|
|
readonly property real notchColorDuration: duration * 0.6 * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.colorSpeed) : 100)
|
|
// Motion inside the open notch (pages, tiles, the pill's width) uses the opening speed.
|
|
readonly property real notchDuration: notchOpenDuration
|
|
function mixColor(a, b, t) {
|
|
const k = Math.max(0, Math.min(1, t));
|
|
return Qt.rgba(a.r + (b.r - a.r) * k, a.g + (b.g - a.g) * k, a.b + (b.b - a.b) * k, a.a + (b.a - a.a) * k);
|
|
}
|
|
readonly property color surfaceVariant: Qt.alpha(tint, 0.38)
|
|
readonly property color fill: Qt.alpha(tint, 0.22)
|
|
readonly property color hover: Qt.alpha(text, 0.09)
|
|
readonly property color hairline: Qt.alpha(text, 0.08)
|
|
readonly property color text: "#f6f6f6"
|
|
readonly property color textSecondary: "#bdbdbd"
|
|
readonly property color transparent: "transparent"
|
|
readonly property color urgent: "#f6b86b"
|
|
readonly property color shadow: "#10000000"
|
|
readonly property real panelOpacity: ConfigService.ready ? ConfigService.data.appearance.panelOpacity : 0.86
|
|
readonly property real intensity: ConfigService.ready ? (ConfigService.data.animation.reducedMotion ? 0 : ConfigService.data.animation.intensity) : 1
|
|
readonly property real glassOpacity: ConfigService.ready ? ConfigService.data.appearance.glassOpacity : 0.76
|
|
readonly property real borderOpacity: ConfigService.ready ? ConfigService.data.appearance.borderOpacity : 0.18
|
|
readonly property real radius: ConfigService.ready ? ConfigService.data.appearance.radius : 22
|
|
readonly property color border: Qt.alpha(text, borderOpacity)
|
|
readonly property bool highlights: !ConfigService.ready || ConfigService.data.appearance.highlights
|
|
readonly property bool shadows: !ConfigService.ready || ConfigService.data.appearance.shadows
|
|
readonly property int duration: ConfigService.ready ? (ConfigService.data.animation.reducedMotion ? 0 : ConfigService.data.animation.duration) : 220
|
|
}
|