Files
glassMxrph/quickshell/theme/Theme.qml
T
mxandClaude Opus 5.5 e4ca1f5d9c Add notch opacity and colour; open plugin panels from the notch strip
- Settings → Notch → Look: opacity (0% glass to 100% solid) and colour
  for the notch, the open notch and the notch-mode launcher.
- Bar popouts and plugin panels add the open notch's screen offset, so
  tooltips and panels from the strip land under their module.
- Opening a plugin panel keeps the notch open; the notch hands keyboard
  focus to the panel and takes it back when it closes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 17:18:58 +01:00

62 lines
3.7 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);
}
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
}