Give notch-mode panels their own liquid drop animation

With no bar to unroll from, attached drawers in notch mode now open as a
glass bead that swells out under the clicked island icon on a tapered
neck, flips the wallpaper behind it like a lens, then widens into the
panel and lets go. NotchDrop draws it with a signed-distance shader;
BarDrawer swaps to it in notch mode, and hosts pass the icon's screen x.
The notch-shaped wallpaper picker keeps its own motion.

Notch settings gain panel opening and closing speeds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-26 14:06:14 +01:00
1 parent 6ad9c0b17e
commit b03bd77941
14 files changed
+287 -9

No files matched your search

+1
View File
@@ -96,6 +96,7 @@ PanelWindow {
drawerId: "popout"
screenName: root.screen ? root.screen.name : ""
screenX: root.animX
sourceScreenX: root.anchorPoint.x + (root.placementItem ? root.placementItem.width / 2 : 0)
onHoveredChanged: PopoutState.setPopoutHovered(hovered)
Text {
id: tip
@@ -84,6 +84,7 @@ PanelWindow {
drawerId: "noctalia-panel-" + (root.api ? root.api.pluginId : "")
screenName: root.screen ? root.screen.name : ""
screenX: root.drawerX
sourceScreenX: root.fromBar ? root.anchorCenter : -1
focus: root.open
Keys.onEscapePressed: root.api.closePanel(null)
@@ -165,6 +165,7 @@ PanelWindow {
drawerId: "plugin-popup-" + (root.owner && root.owner.moduleName ? root.owner.moduleName : "")
screenName: root.screen ? root.screen.name : ""
screenX: root.drawerX
sourceScreenX: root.centerOnBar ? -1 : root.anchorScreenPos.x + root.anchorW / 2
// Swallow clicks on the card so they never reach the outside catcher.
MouseArea {
+39 -7
View File
@@ -21,17 +21,27 @@ Item {
// "slide" unrolls out of the bar; "drop" falls into place and away
// downwards; "fade" fades in place; "shrink" grows from / shrinks to nothing.
property string style: "slide"
// Notch mode has no bar to unroll from: attached drawers use NotchDrop
// instead, with the notch's own panel speeds. Opt out with `liquid: false`.
property bool liquid: ShellState.notchMode && attached
// Screen x of the icon the drawer belongs to; the drop comes out under it.
property real sourceScreenX: -1
// Fill and timing; notch mode passes the notch's own.
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
property real openDuration: Theme.duration * 1.8
property real closeDuration: Theme.duration
readonly property bool unrolls: style === "slide"
readonly property bool unrolls: style === "slide" && !liquid
property real progress: open ? 1 : 0
readonly property real revealed: unrolls ? Math.max(0, contentHeight * progress) : contentHeight
// Drop moves down on the way in and on the way out.
property real dropFrom: -1
onOpenChanged: dropFrom = open ? -1 : 1
readonly property bool shown: progress > 0.001
// NotchDrop's content fade: in once the panel has its size, out first.
readonly property real dropContent: {
const t = Math.min(1, Math.max(0, (progress - 0.82) / 0.18));
return t * t * (3 - 2 * t);
}
readonly property bool settled: !anim.running && open
// Input/hover region: the full body as soon as it opens (the pointer may
// reach the drawer before the reveal finishes), the visible part while closing.
@@ -43,8 +53,9 @@ Item {
Behavior on progress {
NumberAnimation {
id: anim
duration: root.open ? root.openDuration : root.closeDuration
easing.type: Easing.BezierSpline
duration: root.liquid ? (root.open ? Theme.notchPanelOpenDuration : Theme.notchPanelCloseDuration) : root.open ? root.openDuration : root.closeDuration
// NotchDrop eases each phase itself.
easing.type: root.liquid ? Easing.Linear : Easing.BezierSpline
easing.bezierCurve: root.open ? [0.05, 0.7, 0.1, 1, 1, 1] : [0.3, 0, 0.8, 0.15, 1, 1]
}
}
@@ -69,14 +80,32 @@ Item {
id: motion
width: root.width
height: root.height
opacity: root.style === "fade" || root.style === "drop" ? root.progress : root.style === "shrink" ? Math.min(1, root.progress * 1.5) : 1
scale: root.style === "shrink" ? Math.max(0.001, root.progress) : 1
opacity: root.liquid ? 1 : root.style === "fade" || root.style === "drop" ? root.progress : root.style === "shrink" ? Math.min(1, root.progress * 1.5) : 1
scale: !root.liquid && root.style === "shrink" ? Math.max(0.001, root.progress) : 1
transformOrigin: Item.Center
transform: Translate {
y: root.style === "drop" ? (1 - root.progress) * 28 * root.dropFrom * Math.max(0.3, Theme.intensity) : 0
y: !root.liquid && root.style === "drop" ? (1 - root.progress) * 28 * root.dropFrom * Math.max(0.3, Theme.intensity) : 0
}
Loader {
active: root.liquid
width: root.width
sourceComponent: NotchDrop {
width: root.width
progress: root.progress
bodyX: root.ear
bodyWidth: root.contentWidth
bodyHeight: root.contentHeight
sourceX: root.sourceScreenX < 0 ? -1 : root.sourceScreenX - root.screenX
topSpace: Math.max(0, root.y)
islandBottom: Math.round((BarDrawers.bottom - BarDrawers.height) / 2) + BarDrawers.height - root.y
fillColor: root.fillColor
screenName: root.screenName
screenX: root.screenX
}
}
DrawerShape {
id: shape
visible: !root.liquid
bodyWidth: root.contentWidth
bodyHeight: root.revealed
ear: BarDrawers.ear
@@ -94,7 +123,10 @@ Item {
width: root.contentWidth
height: root.contentHeight
y: root.revealed - root.contentHeight
opacity: root.unrolls ? Math.min(1, root.progress * 1.6) : 1
opacity: root.liquid ? root.dropContent : root.unrolls ? Math.min(1, root.progress * 1.6) : 1
transform: Translate {
y: root.liquid ? (1 - root.dropContent) * 6 : 0
}
}
}
}
+120
View File
@@ -0,0 +1,120 @@
import QtQuick
import Quickshell
import "../services"
import "../theme"
// Notch mode's own panel animation (BarDrawer swaps to it while notch mode
// is on). There is no bar to unroll from, so a glass bead swells out under the
// clicked island icon on a tapered neck, works as a lens on the wallpaper
// while it hangs, then widens into the panel and lets go of the island.
// Drawer-local coordinates; `progress` runs linearly, the easing lives here.
Item {
id: root
property real progress: 0
property real bodyX: 0
property real bodyWidth: 300
property real bodyHeight: 200
// Drawer-local x of the icon the panel belongs to; -1 is the middle.
property real sourceX: -1
// Distance from the screen top to the drawer's top edge.
property real topSpace: 0
// Drawer-local y of the islands' bottom edge (negative: above the drawer).
property real islandBottom: -5
property real radius: Theme.radius
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
property color borderColor: Theme.border
property string screenName: ""
property real screenX: 0
y: -topSpace
height: topSpace + bodyHeight
visible: progress > 0.002
function clamp(x, a, b) {
return Math.min(b, Math.max(a, x));
}
function lerp(a, b, t) {
return a + (b - a) * t;
}
function sstep(a, b, x) {
const t = clamp((x - a) / (b - a), 0, 1);
return t * t * (3 - 2 * t);
}
function out3(t) {
return 1 - Math.pow(1 - clamp(t, 0, 1), 3);
}
readonly property var g: {
const p = progress, W = bodyWidth, H = bodyHeight, X = bodyX;
const panelR = Math.min(radius, W / 2, H / 2);
// Small panels (tooltips) get a smaller bead.
const bulbMax = Math.max(6, Math.min(40, W / 2 - 2, H / 2 - 2));
const top = islandBottom - 3;
const sx = clamp(sourceX < 0 ? X + W / 2 : sourceX, X + bulbMax + 2, X + W - bulbMax - 2);
const a = out3(p / 0.4); // bead swells and sinks
const b = clamp((p - 0.3) / 0.62, 0, 1); // bead becomes the panel
const eb = out3(b);
const release = sstep(0.8, 0.95, p); // the neck lets go
const bulbR = lerp(3, bulbMax, a);
const hang = Math.max(4, Math.min(66, H - bulbMax - 2 - top));
const beadY = top + lerp(4, hang, a);
// A small sideways swell as it settles, kept inside the ears.
const swell = Math.sin(clamp((b - 0.55) / 0.45, 0, 1) * Math.PI) * 0.03;
const halfW = Math.min(lerp(bulbR, W / 2, eb) * (1 + swell), W / 2 + X - 1);
const halfH = lerp(bulbR, H / 2, eb);
const cx = lerp(sx, X + W / 2, eb), cy = lerp(beadY, H / 2, eb);
return {
stem: Qt.vector4d(sx, top, lerp(6, 11, a) * (1 - release), lerp(bulbR * 0.9, 10, eb) * (1 - release)),
stemH: lerp(beadY, 12, eb) - top,
box: Qt.vector4d(cx, cy, halfW, halfH),
boxR: Math.min(lerp(bulbR, panelR, eb), halfW, halfH),
melt: lerp(20, 6, release),
// Only the bead is a lens; it clears before the panel takes shape.
lens: Qt.vector4d(cx, cy, Math.min(Math.max(halfW, halfH), bulbMax * 1.4), 1 - sstep(0.3, 0.52, p))
};
}
// The wallpaper under this screen, for the lens. Loaded only while the drop
// is out; the pixmap cache keeps it for the next opening.
readonly property var screenObj: Quickshell.screens.find(s => s.name === screenName) || null
readonly property string wallPath: {
if (!screenName || !ConfigService.ready)
return "";
return WallpaperService.observed[screenName] || ConfigService.data.wallpaper.byMonitor[screenName] || "";
}
Image {
id: wallImage
visible: false
asynchronous: true
cache: true
sourceSize.width: 1280
source: root.visible && root.wallPath ? "file://" + root.wallPath : ""
}
readonly property vector4d cover: {
const iw = wallImage.implicitWidth, ih = wallImage.implicitHeight;
const sw = screenObj ? screenObj.width : 1920, sh = screenObj ? screenObj.height : 1080;
if (iw <= 0 || ih <= 0)
return Qt.vector4d(0, 0, 0, 0);
const sc = Math.max(sw / iw, sh / ih), w = iw * sc, h = ih * sc;
return Qt.vector4d(1 / w, 1 / h, (w - sw) / 2 / w, (h - sh) / 2 / h);
}
ShaderEffect {
anchors.fill: parent
property point size: Qt.point(width, height)
property real topY: -root.topSpace
property vector4d stem: root.g.stem
property real stemH: root.g.stemH
property vector4d box: root.g.box
property real boxR: root.g.boxR
property real melt: root.g.melt
property vector4d lens: root.g.lens
property vector4d fill: Qt.vector4d(root.fillColor.r * root.fillColor.a, root.fillColor.g * root.fillColor.a, root.fillColor.b * root.fillColor.a, root.fillColor.a)
property vector4d edge: Qt.vector4d(root.borderColor.r * root.borderColor.a, root.borderColor.g * root.borderColor.a, root.borderColor.b * root.borderColor.a, root.borderColor.a)
property vector4d cover: root.cover
property point screenOrigin: Qt.point(root.screenX, root.topSpace)
property real hasWall: wallImage.status === Image.Ready ? 1 : 0
property var wall: wallImage
fragmentShader: Qt.resolvedUrl("shaders/notchdrop.frag.qsb")
}
}
@@ -0,0 +1,96 @@
#version 440
// Notch-mode panel opening (NotchDrop.qml): a glass bead swells out of the
// island under the clicked icon on a tapered neck, flips the wallpaper behind
// it like a lens, then widens into the panel and the neck lets go.
// The shape is one signed distance field: an uneven capsule (the neck) melted
// into a rounded box (bead, then panel). Geometry comes from QML per frame.
// Output is premultiplied; HyprGlass adds its blur where alpha is above its
// mask threshold, so the lens and fill sit on top of the compositor glass.
// Rebuild notchdrop.frag.qsb with scripts/build-shaders after editing.
layout(location = 0) in vec2 qt_TexCoord0;
layout(location = 0) out vec4 fragColor;
layout(std140, binding = 0) uniform buf {
mat4 qt_Matrix;
float qt_Opacity;
vec2 size; // item size, px
float topY; // drawer-local y of the item's top edge
vec4 stem; // neck: top x, top y, top radius, bottom radius
float stemH; // neck length
vec4 box; // bead/panel: centre x, y, half width, half height
float boxR;
float melt; // smooth-union width between neck and bead
vec4 lens; // centre x, y, radius, strength
vec4 fill; // premultiplied
vec4 edge; // premultiplied hairline
vec4 cover; // screen px -> wallpaper uv: scale xy, offset zw
vec2 screenOrigin; // screen position of drawer-local (0, 0)
float hasWall;
};
layout(binding = 1) uniform sampler2D wall;
float sdBox(vec2 p, vec2 c, vec2 h, float r) {
r = min(r, min(h.x, h.y));
vec2 q = abs(p - c) - h + r;
return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
}
// Vertical capsule with different end radii, axis pointing down (+y).
float sdNeck(vec2 p, float r1, float r2, float h) {
h = max(h, abs(r1 - r2) + 0.5);
p.x = abs(p.x);
float b = (r1 - r2) / h;
float a = sqrt(max(1.0 - b * b, 0.0));
float k = dot(p, vec2(-b, a));
if (k < 0.0)
return length(p) - r1;
if (k > a * h)
return length(p - vec2(0.0, h)) - r2;
return dot(p, vec2(a, b)) - r1;
}
float smin(float a, float b, float k) {
k = max(k, 0.001);
float h = max(k - abs(a - b), 0.0) / k;
return min(a, b) - h * h * k * 0.25;
}
float scene(vec2 p) {
float n = stem.z + stem.w > 0.05 ? sdNeck(p - stem.xy, stem.z, stem.w, stemH) : 1e5;
return smin(n, sdBox(p, box.xy, box.zw, boxR), melt);
}
vec3 wallAt(vec2 p) {
return texture(wall, (p + screenOrigin) * cover.xy + cover.zw).rgb;
}
void main() {
vec2 p = qt_TexCoord0 * size + vec2(0.0, topY);
float d = scene(p);
if (d > 1.5) {
fragColor = vec4(0.0);
return;
}
vec2 e = vec2(1.0, 0.0);
vec2 g = vec2(scene(p + e.xy) - scene(p - e.xy), scene(p + e.yx) - scene(p - e.yx));
g = length(g) > 1e-5 ? normalize(g) : vec2(0.0, 1.0); // points outwards
float depth = clamp(-d / 16.0, 0.0, 1.0);
float rim = pow(1.0 - depth, 2.2);
vec4 c = fill;
// The hanging bead is a lens: the wallpaper behind it, upside down.
float la = lens.w * hasWall * (1.0 - smoothstep(lens.z * 0.55, lens.z * 1.05, length(p - lens.xy)));
if (la > 0.002) {
vec2 q = lens.xy - (p - lens.xy) * 0.9 + g * rim * 10.0;
vec3 w = (wallAt(q) * 2.0 + wallAt(q + vec2(1.5, 0.0)) + wallAt(q - vec2(1.5, 0.0))
+ wallAt(q + vec2(0.0, 1.5)) + wallAt(q - vec2(0.0, 1.5))) / 6.0;
c = mix(c, vec4(w * 0.94, 1.0), la * 0.9);
}
// Light from the top left, and the bright lower lip of a drop.
float r6 = pow(1.0 - depth, 6.0);
float hl = r6 * (0.26 * max(0.0, dot(g, normalize(vec2(-0.6, -1.0))))
+ 0.42 * max(0.0, g.y) * (0.35 + 0.65 * lens.w));
c = clamp(c + vec4(hl, hl, hl, hl * 0.6), 0.0, 1.0);
// Hairline, as the other drawers have.
float line = smoothstep(1.2, 0.0, abs(d + 0.5));
c = mix(c, edge + c * (1.0 - edge.a), line);
fragColor = c * clamp(0.5 - d, 0.0, 1.0) * qt_Opacity;
}
Binary file not shown.
+2
View File
@@ -277,6 +277,8 @@
"openSpeed": 100,
"closeSpeed": 100,
"colorSpeed": 100,
"panelOpenSpeed": 100,
"panelCloseSpeed": 100,
"workspaceStyle": "bar",
"islandStyle": "float"
},
+1
View File
@@ -138,6 +138,7 @@ PanelWindow {
drawerId: root.isRoot ? "tray" : ""
screenName: root.screen ? root.screen.name : ""
screenX: root.animX
sourceScreenX: root.isRoot ? root.placementCenter : -1
onHoveredChanged: if (root.isRoot) TrayService.setHovered(root, hovered)
}
// Shared menu body, placed in whichever surface this menu uses.
+1 -1
View File
@@ -89,7 +89,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" || typeof c.notch.launcherMatch!=="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.notch.glassOnOpen!=="boolean" || typeof c.notch.launcherMatch!=="boolean" || ["openSpeed","closeSpeed","colorSpeed","panelOpenSpeed","panelCloseSpeed"].some(k=>!Number.isFinite(c.notch[k]) || c.notch[k]<25 || c.notch[k]>300))throw Error("Invalid notch animation");
if(!["bar","numbers","roman","kanji","dots","pacman"].includes(c.notch.workspaceStyle))throw Error("Invalid notch workspace style");
if(!["float","pill","notch"].includes(c.notch.islandStyle))throw Error("Invalid notch island style");
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");
+19
View File
@@ -216,5 +216,24 @@ SettingsPage {
step: 5
unit: "%"
}
PreferenceSlider {
label: "Panel opening speed"
description: "Quick Fix, tray menus and other panels that drop out of an island"
icon: "󰖌"
setting: "notch.panelOpenSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
PreferenceSlider {
label: "Panel closing speed"
icon: "󰖌"
setting: "notch.panelCloseSpeed"
from: 25
to: 300
step: 5
unit: "%"
}
}
}
+3
View File
@@ -50,6 +50,9 @@ Singleton {
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").
// Notch-mode panels (Quick Fix, tray menus, plugin panels): the liquid drop.
readonly property real notchPanelOpenDuration: duration * 4.2 * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.panelOpenSpeed) : 100)
readonly property real notchPanelCloseDuration: duration * 2.5 * 100 / (ConfigService.ready ? Math.max(25, ConfigService.data.notch.panelCloseSpeed) : 100)
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
+2
View File
@@ -123,6 +123,8 @@ PanelWindow {
fillColor:root.notch ? Theme.notchOpenFill : Qt.alpha(Theme.surface,Theme.glassOpacity)
openDuration:root.notch ? Theme.notchOpenDuration*2 : Theme.duration*1.8
closeDuration:root.notch ? Theme.notchCloseDuration*1.3 : Theme.duration
// The notch-shaped picker keeps the notch's own motion.
liquid:false
drawerId:"wallpaper"
screenName:root.screen ? root.screen.name : ""
screenX:(root.screenWidth-width)/2