diff --git a/quickshell/config/defaults.json b/quickshell/config/defaults.json index 40e3cd4..4a975a1 100644 --- a/quickshell/config/defaults.json +++ b/quickshell/config/defaults.json @@ -270,7 +270,11 @@ "strip": [], "controls": [], "opacity": 0, - "color": "" + "color": "", + "glassOnOpen": false, + "openSpeed": 100, + "closeSpeed": 100, + "colorSpeed": 100 }, "dashboard": { "enabled": true, diff --git a/quickshell/core/SettingsRegistry.qml b/quickshell/core/SettingsRegistry.qml index 0762612..23207a6 100644 --- a/quickshell/core/SettingsRegistry.qml +++ b/quickshell/core/SettingsRegistry.qml @@ -79,7 +79,7 @@ Singleton { available: true, group: "shell", icon: "󰹑", - keywords: ["Notch", "Notch mode", "Notch opacity", "Notch colour", "Open on Media while audio plays", "Pocket-dots", "Left island", "Right island", "Notch strip"] + keywords: ["Notch", "Notch mode", "Notch opacity", "Notch colour", "Glassy when open", "Opening speed", "Closing speed", "Colour change speed", "Open on Media while audio plays", "Pocket-dots", "Left island", "Right island", "Notch strip"] }, { id: "tray", diff --git a/quickshell/launcher/Launcher.qml b/quickshell/launcher/Launcher.qml index e70a629..e5a960d 100644 --- a/quickshell/launcher/Launcher.qml +++ b/quickshell/launcher/Launcher.qml @@ -275,7 +275,13 @@ PanelWindow { bodyHeight: panel.height ear: BarDrawers.ear radius: panel.radius - fillColor: Theme.notchFill + // Docked colour, turning to the open fill as the launcher unfolds. + fillColor: ShellState.launcherOpen ? Theme.notchOpenFill : Theme.notchFill + Behavior on fillColor { + ColorAnimation { + duration: ShellState.launcherOpen ? Theme.notchColorDuration : Math.min(Theme.notchColorDuration, Theme.notchCloseDuration) + } + } } GlassPanel { id: panel @@ -294,25 +300,25 @@ PanelWindow { clip: true Behavior on width { NumberAnimation { - duration: Theme.duration + duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration easing.type: Easing.OutCubic } } Behavior on height { enabled: !root.snapping NumberAnimation { - duration: Theme.duration + duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration easing.type: Easing.OutCubic } } Behavior on opacity { NumberAnimation { - duration: Theme.duration + duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration } } Behavior on scale { NumberAnimation { - duration: Theme.duration + duration: !root.notch ? Theme.duration : ShellState.launcherOpen ? Theme.notchOpenDuration : Theme.notchCloseDuration easing.type: Easing.OutCubic } } diff --git a/quickshell/notch/Notch.qml b/quickshell/notch/Notch.qml index c7fd59b..7e0cdd7 100644 --- a/quickshell/notch/Notch.qml +++ b/quickshell/notch/Notch.qml @@ -51,7 +51,7 @@ PanelWindow { Behavior on progress { NumberAnimation { id: morph - duration: ShellState.notchOpen ? Theme.duration * 2 : Theme.duration * 1.3 + duration: ShellState.notchOpen ? Theme.notchOpenDuration * 2 : Theme.notchCloseDuration * 1.3 easing.type: Easing.BezierSpline easing.bezierCurve: ShellState.notchOpen ? [0.2, 0, 0, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1] } @@ -64,7 +64,7 @@ PanelWindow { Behavior on targetWidth { enabled: root.settled NumberAnimation { - duration: Theme.duration * 1.4 + duration: Theme.notchDuration * 1.4 easing.type: Easing.BezierSpline easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] } @@ -72,7 +72,7 @@ PanelWindow { Behavior on targetHeight { enabled: root.settled NumberAnimation { - duration: Theme.duration * 1.4 + duration: Theme.notchDuration * 1.4 easing.type: Easing.BezierSpline easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] } @@ -135,7 +135,14 @@ PanelWindow { bodyHeight: root.bodyHeight ear: root.ear radius: Math.min(Theme.radius + 8, root.bodyHeight / 2) - fillColor: Theme.notchFill + // Fades between the docked and open fill at its own speed; closing, it + // never outlasts the shrink so it docks in the docked colour. + fillColor: ShellState.notchOpen ? Theme.notchOpenFill : Theme.notchFill + Behavior on fillColor { + ColorAnimation { + duration: ShellState.notchOpen ? Theme.notchColorDuration : Math.min(Theme.notchColorDuration, Theme.notchCloseDuration * 1.3) + } + } } Item { @@ -296,7 +303,7 @@ PanelWindow { Behavior on opacity { enabled: root.settled NumberAnimation { - duration: Theme.duration + duration: Theme.notchDuration } } @@ -321,7 +328,7 @@ PanelWindow { y: -pager.page * pager.height Behavior on y { NumberAnimation { - duration: Theme.duration * 1.6 + duration: Theme.notchDuration * 1.6 easing.type: Easing.BezierSpline easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] } @@ -354,7 +361,7 @@ PanelWindow { border.color: Theme.hairline Behavior on color { ColorAnimation { - duration: Theme.duration / 2 + duration: Theme.notchDuration / 2 } } Column { @@ -503,7 +510,7 @@ PanelWindow { color: pager.page === index ? Theme.accent : Qt.alpha(Theme.text, 0.25) Behavior on height { NumberAnimation { - duration: Theme.duration + duration: Theme.notchDuration easing.type: Easing.OutCubic } } @@ -602,7 +609,7 @@ PanelWindow { Behavior on y { enabled: root.settled NumberAnimation { - duration: Theme.duration + duration: Theme.notchDuration easing.type: Easing.OutCubic } } @@ -692,7 +699,7 @@ PanelWindow { Behavior on opacity { enabled: root.settled NumberAnimation { - duration: Theme.duration + duration: Theme.notchDuration } } Rectangle { diff --git a/quickshell/notch/NotchMedia.qml b/quickshell/notch/NotchMedia.qml index c5aae12..6d762a8 100644 --- a/quickshell/notch/NotchMedia.qml +++ b/quickshell/notch/NotchMedia.qml @@ -56,7 +56,7 @@ Item { opacity: status === Image.Ready ? 1 : 0 Behavior on opacity { NumberAnimation { - duration: Theme.duration + duration: Theme.notchDuration } } } diff --git a/quickshell/notch/NotchPill.qml b/quickshell/notch/NotchPill.qml index 6cb0216..63d06fe 100644 --- a/quickshell/notch/NotchPill.qml +++ b/quickshell/notch/NotchPill.qml @@ -19,7 +19,7 @@ Item { implicitHeight: BarDrawers.bottom Behavior on implicitWidth { NumberAnimation { - duration: Theme.duration * 1.6 + duration: Theme.notchDuration * 1.6 easing.type: Easing.BezierSpline easing.bezierCurve: [0.2, 0, 0, 1, 1, 1] } diff --git a/quickshell/services/ConfigLogic.js b/quickshell/services/ConfigLogic.js index 42e7a87..d2c5066 100644 --- a/quickshell/services/ConfigLogic.js +++ b/quickshell/services/ConfigLogic.js @@ -88,6 +88,7 @@ function validate(c) { for(const key of ["left","right","strip"]) if(!Array.isArray(c.notch[key]) || c.notch[key].some(id=>typeof id!=="string" || !id))throw Error("Invalid notch modules"); if(!Array.isArray(c.notch.controls) || c.notch.controls.some(m=>!m || typeof m.id!=="string" || typeof m.enabled!=="boolean" || ["w","h"].some(k=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<1 || m[k]>4)) || [["x",3],["y",63]].some(([k,max])=>m[k]!==undefined && (!Number.isInteger(m[k]) || m[k]<0 || m[k]>max))))throw Error("Invalid notch controls"); if(!Number.isFinite(c.notch.opacity) || c.notch.opacity<0 || c.notch.opacity>100 || typeof c.notch.color!=="string" || (c.notch.color!=="" && !/^#[0-9a-fA-F]{6}$/.test(c.notch.color)))throw Error("Invalid notch colour"); + if(typeof c.notch.glassOnOpen!=="boolean" || ["openSpeed","closeSpeed","colorSpeed"].some(k=>!Number.isFinite(c.notch[k]) || c.notch[k]<25 || c.notch[k]>300))throw Error("Invalid notch animation"); if(typeof c.osd.enabled!=="boolean" || !["slide","drop","fade","shrink"].includes(c.osd.animation) || !["top-right","top-center","bottom-center"].includes(c.osd.position) || !Number.isInteger(c.osd.timeout) || c.osd.timeout<500 || c.osd.timeout>5000 || !Number.isInteger(c.osd.step) || c.osd.step<1 || c.osd.step>20)throw Error("Invalid OSD preferences"); const notes=c.notifications; if(!notes || ["enabled","doNotDisturb","criticalInDnd"].some(k=>typeof notes[k]!=="boolean") || !["slide","drop","fade","shrink"].includes(notes.animation) || !["top-right","top-center"].includes(notes.position) || !Number.isInteger(notes.timeout) || notes.timeout<1000 || notes.timeout>30000 || !Number.isInteger(notes.maxPopups) || notes.maxPopups<1 || notes.maxPopups>6)throw Error("Invalid notification preferences"); diff --git a/quickshell/settings/pages/Notch.qml b/quickshell/settings/pages/Notch.qml index 3c3db8f..b34b4eb 100644 --- a/quickshell/settings/pages/Notch.qml +++ b/quickshell/settings/pages/Notch.qml @@ -85,6 +85,42 @@ SettingsPage { step: 1 unit: "%" } + PreferenceToggle { + label: "Glassy when open" + description: "Keeps the colour and opacity on the docked notch; the open notch and launcher fade back to the normal glass" + icon: "󰂵" + setting: "notch.glassOnOpen" + } + PreferenceSlider { + label: "Opening speed" + description: "Notch and launcher; 100% follows the shell's animation duration" + icon: "󰓅" + setting: "notch.openSpeed" + from: 25 + to: 300 + step: 5 + unit: "%" + } + PreferenceSlider { + label: "Closing speed" + description: "100% follows the shell's animation duration" + icon: "󰾆" + setting: "notch.closeSpeed" + from: 25 + to: 300 + step: 5 + unit: "%" + } + PreferenceSlider { + label: "Colour change speed" + description: "How fast the docked colour turns glassy when opening (closing never outlasts the close)" + icon: "󰏘" + setting: "notch.colorSpeed" + from: 25 + to: 300 + step: 5 + unit: "%" + } SettingRow { title: "Notch colour" description: root.options.color ? "Custom colour" : "Glass tint (Appearance)" diff --git a/quickshell/theme/Theme.qml b/quickshell/theme/Theme.qml index c628b9a..5ea1b77 100644 --- a/quickshell/theme/Theme.qml +++ b/quickshell/theme/Theme.qml @@ -40,6 +40,20 @@ Singleton { 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 + // 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)