Files
glassMxrph/quickshell/notch/NotchPill.qml
T
mxandClaude Opus 5.5 5217af4f67 Add a notch mode that splits the bar around a pocket-dots style notch
Settings → Notch switches it on. The bar becomes left and right islands
with a notch at the top centre. Super+C, Super+X and a click on the notch
open a three-column panel: dashboard pages on the left (Media,
Performance, Calendar; the wheel switches them), the Control Center tiles
and weather in the middle, and notifications on the right. The
Performance card opens the full "Your computer" view. The launcher drops
out of the notch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 16:39:35 +01:00

112 lines
3.6 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import Quickshell.Widgets
import "../components"
import "../core"
import "../services"
import "../theme"
// The collapsed notch: a glass island hanging from the screen's top edge with
// concave ears, showing the time, plus cover art and a small visualizer while
// audio plays. Clicking it opens the notch panel.
Item {
id: root
property var barScreen
readonly property real bodyWidth: ShellState.notchPillWidth
readonly property bool playing: MediaService.playing
implicitWidth: bodyWidth + 2 * BarDrawers.ear
implicitHeight: BarDrawers.bottom
Behavior on implicitWidth {
NumberAnimation {
duration: Theme.duration * 1.6
easing.type: Easing.BezierSpline
easing.bezierCurve: [0.2, 0, 0, 1, 1, 1]
}
}
SystemClock {
id: clock
precision: SystemClock.Minutes
}
Demand {
service: CavaService
counter: "widgetConsumers"
active: root.visible && root.playing
}
DrawerShape {
bodyWidth: root.width - 2 * BarDrawers.ear
bodyHeight: root.height
ear: BarDrawers.ear
radius: Math.min(Theme.radius, root.height / 2)
}
Row {
id: content
anchors.centerIn: parent
spacing: 10
ClippingRectangle {
visible: root.playing
anchors.verticalCenter: parent.verticalCenter
width: 22
height: 22
radius: 6
color: Theme.fill
Image {
anchors.fill: parent
source: MediaService.artwork
sourceSize: Qt.size(44, 44)
fillMode: Image.PreserveAspectCrop
asynchronous: true
}
}
Text {
anchors.verticalCenter: parent.verticalCenter
text: Qt.formatDateTime(clock.date, ConfigService.ready && !ConfigService.data.bar.clock.use24Hour ? "h:mm" : "HH:mm")
color: Theme.text
font.pixelSize: 14
font.weight: Font.DemiBold
font.features: {
"tnum": 1
}
}
Row {
visible: root.playing
anchors.verticalCenter: parent.verticalCenter
height: 16
spacing: 2
Repeater {
model: 8
Rectangle {
required property int index
// Every third Cava band, so the eight span the spectrum.
readonly property real level: CavaService.bars[index * 3] || 0
width: 3
height: Math.max(3, 16 * level)
y: 16 - height
radius: 1.5
color: Theme.accent
}
}
}
}
MouseArea {
anchors.fill: parent
anchors.leftMargin: BarDrawers.ear
anchors.rightMargin: BarDrawers.ear
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse => {
if (mouse.button === Qt.RightButton)
MediaService.toggle();
else
ShellState.toggleNotch();
}
// Wheel changes the volume, as on pocket-dots.
onWheel: wheel => {
const audio = AudioService.sink ? AudioService.sink.audio : null;
const step = ConfigService.ready ? ConfigService.data.osd.step : 5;
if (audio && wheel.angleDelta.y !== 0)
AudioService.volume(false, audio.volume + (wheel.angleDelta.y > 0 ? 1 : -1) * step / 100);
}
}
}