diff --git a/quickshell/bar/Bar.qml b/quickshell/bar/Bar.qml index 7803f94..ab4451c 100644 --- a/quickshell/bar/Bar.qml +++ b/quickshell/bar/Bar.qml @@ -44,9 +44,10 @@ PanelWindow { radius: BarDrawers.radius border.width: 0 // In notch mode the side rows move into their islands; the notch replaces the centre. - ModuleRow { id: leftRow; parent: root.notch ? leftIsland : panel; position: "left"; barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter } - ModuleRow { position: "center"; barScreen: root.screen; anchors.centerIn: parent } - ModuleRow { id: rightRow; parent: root.notch ? rightIsland : panel; position: "right"; barScreen: root.screen; anchors.right: parent.right; anchors.rightMargin: 6; anchors.verticalCenter: parent.verticalCenter } + // Notch mode unloads these; its islands carry their own module lists. + ModuleRow { position: "left"; active: !root.notch; barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter } + ModuleRow { position: "center"; active: !root.notch; barScreen: root.screen; anchors.centerIn: parent } + ModuleRow { position: "right"; active: !root.notch; barScreen: root.screen; anchors.right: parent.right; anchors.rightMargin: 6; anchors.verticalCenter: parent.verticalCenter } } // Outline with openings where drawers hang from the bar. Shape { @@ -77,21 +78,23 @@ PanelWindow { // Notch mode ------------------------------------------------------------- GlassPanel { id: leftIsland - visible: root.notch + visible: root.notch && ConfigService.ready && ConfigService.data.notch.left.length > 0 x: root.outerMargin y: root.outerMargin width: leftRow.implicitWidth + 12 height: BarDrawers.height radius: BarDrawers.radius + ModuleRow { id: leftRow; position: "left"; active: root.notch; modules: BarLayout.notchModules(root.screen ? root.screen.name : "", "left"); barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter } } GlassPanel { id: rightIsland - visible: root.notch + visible: root.notch && ConfigService.ready && ConfigService.data.notch.right.length > 0 x: root.width - root.outerMargin - width y: root.outerMargin width: rightRow.implicitWidth + 12 height: BarDrawers.height radius: BarDrawers.radius + ModuleRow { id: rightRow; position: "right"; active: root.notch; modules: BarLayout.notchModules(root.screen ? root.screen.name : "", "right"); barScreen: root.screen; anchors.right: parent.right; anchors.rightMargin: 6; anchors.verticalCenter: parent.verticalCenter } } NotchPill { id: notchPill diff --git a/quickshell/bar/ModuleRow.qml b/quickshell/bar/ModuleRow.qml index 69325b5..6846708 100644 --- a/quickshell/bar/ModuleRow.qml +++ b/quickshell/bar/ModuleRow.qml @@ -5,9 +5,12 @@ Row { id: root required property string position property var barScreen + // Notch mode passes its own module entries; inactive rows load nothing. + property var modules: null + property bool active: true spacing: 8 Repeater { - model: BarLayout.modulesFor(root.barScreen ? root.barScreen.name : "").filter(m => m.enabled && m.position === root.position) + model: !root.active ? [] : root.modules !== null ? root.modules : BarLayout.modulesFor(root.barScreen ? root.barScreen.name : "").filter(m => m.enabled && m.position === root.position) ModuleLoader { required property var modelData; moduleId: modelData.id; barScreen: root.barScreen; entry: modelData } } } diff --git a/quickshell/components/GlassPanel.qml b/quickshell/components/GlassPanel.qml index 5a52a4a..3f7d6a2 100644 --- a/quickshell/components/GlassPanel.qml +++ b/quickshell/components/GlassPanel.qml @@ -4,6 +4,8 @@ import "../theme" Rectangle { id: root property real surfaceOpacity: Theme.glassOpacity + // Drops the shadow and highlights, for panels drawn on another shape. + property bool plain: false radius: Theme.radius color: Qt.alpha(Theme.surface, surfaceOpacity) border.width: 1 @@ -15,12 +17,12 @@ Rectangle { anchors.bottomMargin: -4 radius: root.radius color: Theme.shadow - visible: Theme.shadows + visible: Theme.shadows && !root.plain } Rectangle { anchors.fill: parent radius: root.radius - visible: Theme.highlights + visible: Theme.highlights && !root.plain gradient: Gradient { GradientStop { position: 0 @@ -43,6 +45,6 @@ Rectangle { width: Math.max(0, parent.width - root.radius * 2) height: 1 color: Theme.border - visible: Theme.highlights + visible: Theme.highlights && !root.plain } } diff --git a/quickshell/config/defaults.json b/quickshell/config/defaults.json index f9d7fb6..7c02bbb 100644 --- a/quickshell/config/defaults.json +++ b/quickshell/config/defaults.json @@ -264,7 +264,10 @@ }, "notch": { "enabled": false, - "mediaFirst": true + "mediaFirst": true, + "left": ["workspaces"], + "right": ["tray"], + "strip": [] }, "dashboard": { "enabled": true, diff --git a/quickshell/controlcenter/ControlCenter.qml b/quickshell/controlcenter/ControlCenter.qml index 2b330bb..cf5c9c4 100644 --- a/quickshell/controlcenter/ControlCenter.qml +++ b/quickshell/controlcenter/ControlCenter.qml @@ -150,6 +150,10 @@ PanelWindow { function onControlCenterOpenChanged() { if (!ShellState.controlCenterOpen) root.editing = false; + else if (ShellState.controlCenterEditRequested) { + ShellState.controlCenterEditRequested = false; + root.editing = true; + } } } diff --git a/quickshell/core/BarLayout.qml b/quickshell/core/BarLayout.qml index 0b9e258..f8083ca 100644 --- a/quickshell/core/BarLayout.qml +++ b/quickshell/core/BarLayout.qml @@ -16,6 +16,20 @@ Singleton { return []; return hasOwn(screenName) ? screens[screenName].modules : ConfigService.data.bar.modules; } + // Entries for a notch module list ("left", "right" or "strip"). Each reuses + // the module's bar entry for its options when the layout has one. + function notchModules(screenName, key) { + if (!ConfigService.ready || !ConfigService.data.notch) + return []; + const layout = modulesFor(screenName); + return (ConfigService.data.notch[key] || []).map(id => Object.assign({}, layout.find(m => m.id === id) || { + id: id + }, { + id: id, + enabled: true, + position: key === "right" ? "right" : key === "left" ? "left" : "center" + })); + } // Saves to the screen's own layout when it has one, else the shared layout. function save(screenName, modules) { if (!hasOwn(screenName)) diff --git a/quickshell/core/SettingsRegistry.qml b/quickshell/core/SettingsRegistry.qml index b2d1b93..a13974b 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", "Open on Media while audio plays", "Pocket-dots", "Island"] + keywords: ["Notch", "Notch mode", "Open on Media while audio plays", "Pocket-dots", "Left island", "Right island", "Notch strip"] }, { id: "tray", diff --git a/quickshell/core/ShellState.qml b/quickshell/core/ShellState.qml index 6e91e9e..4a39831 100644 --- a/quickshell/core/ShellState.qml +++ b/quickshell/core/ShellState.qml @@ -94,6 +94,34 @@ Singleton { } onNotchModeChanged: if (!notchMode) notchOpen = false + // Super+N: swaps between notch mode and the full bar. + function toggleNotchMode() { + if (!ConfigService.ready) + return false; + notchOpen = false; + return ConfigService.setValue("notch.enabled", !notchMode); + } + // The notch's cog edits its tiles in the Control Center editor, then the + // notch comes back once the Control Center closes. + property bool controlCenterEditRequested: false + property bool notchReturn: false + function editControlCenter() { + notchReturn = notchMode; + notchOpen = false; + wallpaperPickerOpen = false; + overviewOpen = false; + dashboardOpen = false; + launcherOpen = false; + settingsOpen = false; + controlCenterScreen = notchScreen || activeScreen(); + controlCenterEditRequested = true; + controlCenterOpen = true; + } + onControlCenterOpenChanged: if (!controlCenterOpen && notchReturn) { + notchReturn = false; + if (notchMode) + Qt.callLater(openNotch); + } // Workspace overview (SUPER+Tab): a drawer of live workspace thumbnails. property bool overviewOpen: false property var overviewScreen: null diff --git a/quickshell/launcher/Launcher.qml b/quickshell/launcher/Launcher.qml index fb70e85..6cf499a 100644 --- a/quickshell/launcher/Launcher.qml +++ b/quickshell/launcher/Launcher.qml @@ -2,7 +2,6 @@ pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls import QtQuick.Layouts -import QtQuick.Shapes import Quickshell import Quickshell.Wayland import "../components" @@ -73,14 +72,15 @@ PanelWindow { // Room is kept for the mode pills on the right of the bar. readonly property int pillSize: 48 readonly property real pillsWidth: 2 * pillSize + 2 * 10 - readonly property real targetWidth: Math.min(options.width, root.width - 40 - 2 * pillsWidth) + readonly property real targetWidth: Math.min(options.width, root.width - 40 - (notch ? 0 : 2 * pillsWidth)) // A hovered mode pill names itself in the empty search bar. property string pillHover: "" readonly property int barHeight: 60 // Notch mode: the launcher drops out of the notch at the top edge. The // panel's top corners sit above the screen and concave ears join it there. readonly property bool notch: ShellState.notchMode - readonly property real notchInset: notch ? panel.radius : 0 + // Pills sit inside the search bar in notch mode, smaller. + readonly property int notchPill: 36 readonly property real maxBodyHeight: Math.min(460, root.height * 0.78 - barHeight - (notch ? 0 : root.height * 0.22)) // Clipboard mode shows the latest five rows; the rest scroll. readonly property real clipboardRows: 5 * 48 - 2 @@ -197,9 +197,10 @@ PanelWindow { Row { id: pills objectName: "launcherPills" - x: panel.x + panel.width + 10 - y: panel.y + root.notchInset + (root.barHeight - root.pillSize) / 2 - spacing: 10 + x: root.notch ? panel.x + panel.width - width - 14 : panel.x + panel.width + 10 + y: panel.y + (root.barHeight - (root.notch ? root.notchPill : root.pillSize)) / 2 + z: 1 + spacing: root.notch ? 6 : 10 opacity: panel.opacity scale: panel.scale Repeater { @@ -222,10 +223,12 @@ PanelWindow { required property var modelData readonly property bool active: ShellState.launcherMode === modelData.mode objectName: "launcherPill-" + modelData.mode - width: root.pillSize - height: root.pillSize + width: root.notch ? root.notchPill : root.pillSize + height: width radius: width / 2 - color: active ? Theme.accent : Qt.alpha(Theme.surface, Math.min(1, surfaceOpacity + (pillArea.containsMouse ? 0.18 : 0))) + color: active ? Theme.accent : root.notch ? (pillArea.containsMouse ? Theme.hover : Theme.fill) : Qt.alpha(Theme.surface, Math.min(1, surfaceOpacity + (pillArea.containsMouse ? 0.18 : 0))) + border.color: root.notch ? Theme.hairline : Theme.border + plain: root.notch Accessible.role: Accessible.Button Accessible.name: modelData.label scale: pillArea.pressed ? 0.92 : 1 @@ -239,7 +242,7 @@ PanelWindow { anchors.centerIn: parent text: Icons.available ? pill.modelData.glyph : pill.modelData.fallback font.family: Icons.available ? Icons.family : "" - font.pixelSize: 21 + font.pixelSize: root.notch ? 17 : 21 color: pill.active ? Theme.accentText : Theme.text } MouseArea { @@ -261,44 +264,29 @@ PanelWindow { } } } - // Notch ears: concave fillets joining the panel to the screen's top edge. - Repeater { - model: root.notch ? [0, 1] : [] - Shape { - id: earShape - required property int modelData - readonly property real e: BarDrawers.ear - x: modelData === 0 ? panel.x - e : panel.x + panel.width - y: 0 - width: e - height: e - opacity: panel.opacity - preferredRendererType: Shape.CurveRenderer - ShapePath { - fillColor: panel.color - strokeColor: "transparent" - strokeWidth: 0 - PathSvg { - path: earShape.modelData === 0 ? `M 0 0 L ${earShape.e} 0 L ${earShape.e} ${earShape.e} A ${earShape.e} ${earShape.e} 0 0 0 0 0 Z` : `M 0 0 L ${earShape.e} 0 A ${earShape.e} ${earShape.e} 0 0 0 0 ${earShape.e} Z` - } - } - ShapePath { - fillColor: "transparent" - strokeColor: panel.border.color - strokeWidth: 1 - PathSvg { - path: earShape.modelData === 0 ? `M 0 0.5 A ${earShape.e} ${earShape.e} 0 0 1 ${earShape.e - 0.5} ${earShape.e}` : `M 0.5 ${earShape.e} A ${earShape.e} ${earShape.e} 0 0 1 ${earShape.e} 0.5` - } - } - } + // Notch mode: the notch's own shape (ears at the top edge) behind the + // panel, which then draws no glass of its own. + DrawerShape { + visible: root.notch + x: panel.x - BarDrawers.ear + y: 0 + opacity: panel.opacity + bodyWidth: panel.width + bodyHeight: panel.height + ear: BarDrawers.ear + radius: panel.radius } GlassPanel { id: panel objectName: "launcherSurface" x: Math.round((root.width - width) / 2) - y: root.notch ? -root.notchInset : Math.round(root.height * 0.22) + y: root.notch ? 0 : Math.round(root.height * 0.22) + // Notch mode grows out of the collapsed notch and shrinks back into it. width: ShellState.launcherOpen ? root.targetWidth : root.notch ? ShellState.notchPillWidth : Math.min(320, root.targetWidth) - height: root.barHeight + root.bodyHeight + root.notchInset + height: root.notch && !ShellState.launcherOpen ? BarDrawers.bottom : root.barHeight + root.bodyHeight + color: root.notch ? Theme.transparent : Qt.alpha(Theme.surface, surfaceOpacity) + border.width: root.notch ? 0 : 1 + plain: root.notch radius: Math.min(Theme.radius + 6, root.barHeight / 2) opacity: ShellState.launcherOpen ? 1 : 0 scale: ShellState.launcherOpen || root.notch ? 1 : 1 - 0.04 * Theme.intensity @@ -337,10 +325,10 @@ PanelWindow { anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top - anchors.topMargin: root.notchInset height: root.barHeight anchors.leftMargin: 12 - anchors.rightMargin: 18 + // Room for the mode pills inside the bar in notch mode. + anchors.rightMargin: root.notch ? 18 + 2 * root.notchPill + 6 + 8 : 18 spacing: 10 Rectangle { objectName: "launcherBrowse" @@ -438,7 +426,7 @@ PanelWindow { anchors.right: parent.right anchors.top: bar.bottom anchors.bottom: parent.bottom - visible: root.bodyHeight > 0 || panel.height > root.barHeight + root.notchInset + 1 + visible: root.bodyHeight > 0 || panel.height > root.barHeight + 1 Rectangle { anchors.left: parent.left anchors.right: parent.right diff --git a/quickshell/notch/Notch.qml b/quickshell/notch/Notch.qml index 0c0486e..088ba4d 100644 --- a/quickshell/notch/Notch.qml +++ b/quickshell/notch/Notch.qml @@ -5,11 +5,11 @@ import Quickshell import Quickshell.Io import Quickshell.Wayland import "../components" +import "../bar" import "../controlcenter" import "../controlcenter/GridLogic.js" as Grid import "../core" import "../dashboard" -import "../media" import "../services" import "../theme" import "../widgets/faces" as Faces @@ -35,10 +35,13 @@ PanelWindow { readonly property int sideWidth: 330 readonly property int middleWidth: 440 readonly property int columnGap: 44 + // The open notch's header: the band plus room for the divider below it. + readonly property real header: band + 8 + readonly property int gutter: 16 // Open size of each view, then the morph between the pill and that size. readonly property real mainWidth: 2 * sideWidth + middleWidth + 2 * columnGap + 2 * pad - readonly property real mainHeight: Math.max(440, middle.contentHeight + band + pad) + readonly property real mainHeight: Math.max(600, middle.contentHeight + header + gutter + pad) readonly property Item computerItem: computerLoader.item as Item readonly property real computerWidth: (computerItem ? computerItem.implicitWidth : 800) + 2 * pad readonly property real computerHeight: band + 44 + (computerItem ? computerItem.implicitHeight : 400) + pad @@ -147,6 +150,7 @@ PanelWindow { precision: SystemClock.Minutes } Row { + id: clockRow anchors.horizontalCenter: parent.horizontalCenter y: (root.band - height) / 2 spacing: 8 @@ -167,13 +171,84 @@ PanelWindow { } } + // Header: chosen bar modules left of the clock (the wheel scrolls them + // sideways), the tile editor cog, and a divider under it all. + readonly property bool headerShown: !root.computer && root.contentOpacity > 0 + Flickable { + id: strip + objectName: "notchStrip" + x: main.x + width: Math.max(0, clockRow.x - 24 - main.x) + height: root.band + visible: body.headerShown + opacity: root.contentOpacity + contentWidth: stripRow.implicitWidth + contentHeight: height + flickableDirection: Flickable.HorizontalFlick + boundsBehavior: Flickable.StopAtBounds + clip: true + ModuleRow { + id: stripRow + position: "center" + active: ShellState.notchOpen + modules: BarLayout.notchModules(root.screen ? root.screen.name : "", "strip") + barScreen: root.screen + anchors.verticalCenter: parent.verticalCenter + } + } + MouseArea { + anchors.fill: strip + visible: strip.visible + acceptedButtons: Qt.NoButton + onWheel: wheel => { + const delta = wheel.angleDelta.y !== 0 ? wheel.angleDelta.y : wheel.angleDelta.x; + strip.contentX = Math.max(0, Math.min(strip.contentWidth - strip.width, strip.contentX - delta * 0.6)); + } + } + Rectangle { + objectName: "notchEditControls" + x: main.x + root.sideWidth + root.columnGap + root.middleWidth - width + y: (root.band - height) / 2 + width: 30 + height: 30 + radius: 15 + visible: body.headerShown + opacity: root.contentOpacity + color: cogArea.containsMouse ? Theme.hover : Theme.transparent + Accessible.role: Accessible.Button + Accessible.name: "Edit controls" + Text { + anchors.centerIn: parent + text: Icons.available ? "󰒓" : "⚙" + font.family: Icons.available ? Icons.family : "" + font.pixelSize: 16 + color: Theme.textSecondary + } + MouseArea { + id: cogArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: ShellState.editControlCenter() + } + } + Rectangle { + x: main.x + y: root.header + width: main.width + height: 1 + visible: body.headerShown + opacity: root.contentOpacity + color: Theme.hairline + } + // Main view ---------------------------------------------------------- Item { id: main x: (root.bodyWidth - root.mainWidth) / 2 + root.pad - y: root.band + y: root.header + root.gutter width: root.mainWidth - 2 * root.pad - height: root.targetHeight - root.band - root.pad + height: root.targetHeight - root.header - root.gutter - root.pad visible: opacity > 0 opacity: root.computer ? 0 : root.contentOpacity Behavior on opacity { @@ -210,32 +285,28 @@ PanelWindow { } } // Media - Item { - width: pager.width + NotchMedia { + width: pager.width - 16 height: pager.height - MediaCard { - anchors.centerIn: parent - width: parent.width - 20 - compact: true - color: Theme.transparent - border.width: 0 - } + active: ShellState.notchOpen && pager.page === 0 } // Performance: click for the full view. Item { id: perf - width: pager.width + width: pager.width - 16 height: pager.height readonly property var disk: (MetricsService.snapshot.storage || []).find(s => s.available) || ({}) + readonly property var gpu: MetricsService.gpu || ({}) + readonly property var rows: [["CPU", [MetricsService.value(MetricsService.cpu.temperature, " °C"), MetricsService.value(MetricsService.cpu.frequency / 1000, " GHz", 2)].filter(v => v !== "—").join(" · ") || "—"], ["GPU", Number.isFinite(gpu.percent) ? Math.round(gpu.percent) + "%" + (Number.isFinite(gpu.temperature) ? " · " + Math.round(gpu.temperature) + " °C" : "") : "—"], ["Memory", MetricsService.bytes(MetricsService.ram.used) + " / " + MetricsService.bytes(MetricsService.ram.total)], ["Network", "↓ " + MetricsService.bytes(MetricsService.network.download) + "/s ↑ " + MetricsService.bytes(MetricsService.network.upload) + "/s"]] Demand { service: MetricsService active: ShellState.notchOpen && pager.page === 1 } Rectangle { - anchors.centerIn: parent - width: parent.width - 20 - height: perfColumn.implicitHeight + 36 - radius: Math.max(12, Theme.radius * 0.75) + anchors.fill: parent + anchors.topMargin: 6 + anchors.bottomMargin: 6 + radius: Math.max(16, Theme.radius) color: perfArea.containsMouse ? Theme.hover : Theme.surfaceVariant border.width: 1 border.color: Theme.hairline @@ -245,17 +316,16 @@ PanelWindow { } } Column { - id: perfColumn anchors.centerIn: parent - width: parent.width - 36 - spacing: 18 + width: parent.width - 40 + spacing: 22 Item { width: parent.width - height: 22 + height: 24 Text { text: "Your computer" color: Theme.text - font.pixelSize: 15 + font.pixelSize: 17 font.weight: Font.DemiBold } Text { @@ -263,35 +333,61 @@ PanelWindow { text: Icons.available ? "󰅂" : "›" font.family: Icons.available ? Icons.family : "" color: Theme.textSecondary - font.pixelSize: 18 + font.pixelSize: 20 } } Row { anchors.horizontalCenter: parent.horizontalCenter - spacing: 14 + spacing: 10 Gauge { - size: 76 + size: (perf.width - 40 - 20) / 3 value: MetricsService.cpu.percent caption: "CPU" } Gauge { - size: 76 + size: (perf.width - 40 - 20) / 3 value: MetricsService.ram.percent caption: "Memory" } Gauge { - size: 76 + size: (perf.width - 40 - 20) / 3 value: perf.disk.percent caption: "Disk" } } - Text { + Column { width: parent.width - horizontalAlignment: Text.AlignHCenter - readonly property var gpu: MetricsService.gpu || ({}) - text: Number.isFinite(gpu.percent) ? "GPU " + Math.round(gpu.percent) + "%" + (Number.isFinite(gpu.temperature) ? " · " + Math.round(gpu.temperature) + " °C" : "") : "Click for details" - color: Theme.textSecondary - font.pixelSize: 12 + Repeater { + model: perf.rows + Item { + required property var modelData + required property int index + width: parent.width + height: 38 + Rectangle { + visible: parent.index > 0 + width: parent.width + height: 1 + color: Theme.hairline + } + Text { + anchors.verticalCenter: parent.verticalCenter + text: parent.modelData[0] + color: Theme.textSecondary + font.pixelSize: 13 + } + Text { + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + text: parent.modelData[1] + color: Theme.text + font.pixelSize: 13 + font.features: { + "tnum": 1 + } + } + } + } } } MouseArea { @@ -306,12 +402,35 @@ PanelWindow { } // Calendar Item { - width: pager.width + width: pager.width - 16 height: pager.height + Column { + id: dateHead + anchors.horizontalCenter: parent.horizontalCenter + y: 6 + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: Qt.formatDateTime(clock.date, ConfigService.ready && !ConfigService.data.bar.clock.use24Hour ? "h:mm" : "HH:mm") + color: Theme.text + font.pixelSize: 54 + font.weight: Font.Light + font.features: { + "tnum": 1 + } + } + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: Qt.formatDateTime(clock.date, "dddd, d MMMM") + color: Theme.textSecondary + font.pixelSize: 14 + } + } Faces.CalendarFace { - anchors.centerIn: parent - width: parent.width - 20 - height: Math.min(parent.height, 300) + anchors.left: parent.left + anchors.right: parent.right + anchors.top: dateHead.bottom + anchors.topMargin: 14 + anchors.bottom: parent.bottom } } } @@ -358,8 +477,9 @@ PanelWindow { } Rectangle { x: root.sideWidth + root.columnGap / 2 + y: -root.gutter width: 1 - height: parent.height + height: parent.height + root.gutter color: Theme.hairline } @@ -485,8 +605,9 @@ PanelWindow { } Rectangle { x: root.sideWidth + root.columnGap + root.middleWidth + root.columnGap / 2 + y: -root.gutter width: 1 - height: parent.height + height: parent.height + root.gutter color: Theme.hairline } @@ -514,7 +635,7 @@ PanelWindow { x: root.pad y: root.band width: root.bodyWidth - 2 * root.pad - height: root.bodyHeight - root.band - root.pad + height: Math.max(0, root.bodyHeight - root.band - root.pad) visible: opacity > 0 opacity: root.computer ? root.contentOpacity : 0 Behavior on opacity { @@ -573,6 +694,12 @@ PanelWindow { function page(index: int): void { pager.go(index); } + function editControls(): void { + ShellState.editControlCenter(); + } + function toggleMode(): bool { + return ShellState.toggleNotchMode(); + } function view(name: string): void { ShellState.notchView = name === "computer" ? "computer" : "main"; } diff --git a/quickshell/notch/NotchMedia.qml b/quickshell/notch/NotchMedia.qml new file mode 100644 index 0000000..c5aae12 --- /dev/null +++ b/quickshell/notch/NotchMedia.qml @@ -0,0 +1,177 @@ +pragma ComponentBehavior: Bound +import QtQuick +import Quickshell.Widgets +import "../components" +import "../dashboard" +import "../services" +import "../theme" + +// The notch's Media page: large artwork, track, seek bar, transport and a +// Cava strip, sized to fill the left column. +Item { + id: root + property bool active: false + // Streams report no length or absurd ones; show them as live. + readonly property bool live: MediaService.length <= 0 || MediaService.length > 7 * 86400 + readonly property bool hasPlayer: !!MediaService.player + readonly property real artSize: Math.max(120, Math.min(width - 40, height - 250, 250)) + Demand { + service: MediaService + counter: "progressConsumers" + active: root.active + } + Demand { + service: CavaService + counter: "widgetConsumers" + active: root.active + } + Column { + anchors.centerIn: parent + width: parent.width - 24 + spacing: 14 + ClippingRectangle { + anchors.horizontalCenter: parent.horizontalCenter + width: root.artSize + height: root.artSize + radius: 24 + color: Theme.fill + border.width: 1 + border.color: Theme.hairline + Text { + anchors.centerIn: parent + visible: art.status !== Image.Ready + text: Icons.available ? "󰝚" : "♪" + font.family: Icons.available ? Icons.family : "" + font.pixelSize: root.artSize * 0.32 + color: Theme.textSecondary + } + Image { + id: art + anchors.fill: parent + source: MediaService.artwork + sourceSize: Qt.size(500, 500) + fillMode: Image.PreserveAspectCrop + asynchronous: true + retainWhileLoading: true + opacity: status === Image.Ready ? 1 : 0 + Behavior on opacity { + NumberAnimation { + duration: Theme.duration + } + } + } + } + Column { + width: parent.width + spacing: 3 + Text { + width: parent.width + horizontalAlignment: Text.AlignHCenter + text: MediaService.title + color: Theme.text + font.pixelSize: 18 + font.weight: Font.DemiBold + elide: Text.ElideRight + } + Text { + width: parent.width + horizontalAlignment: Text.AlignHCenter + text: MediaService.artist + color: Theme.textSecondary + font.pixelSize: 13 + elide: Text.ElideRight + } + } + Column { + visible: root.hasPlayer + width: parent.width + GlassSlider { + objectName: "notchSeek" + width: parent.width + from: 0 + to: root.live ? 1 : Math.max(1, MediaService.length) + value: root.live ? 0 : MediaService.position + enabled: MediaService.seekable && !root.live + opacity: root.live ? 0.4 : 1 + onMoved: MediaService.seek(value) + } + Item { + width: parent.width + height: 14 + Text { + text: root.live ? "" : MediaService.time(MediaService.position) + color: Theme.textSecondary + font.pixelSize: 11 + font.features: { + "tnum": 1 + } + } + Text { + anchors.right: parent.right + text: root.live ? "LIVE" : MediaService.time(MediaService.length) + color: Theme.textSecondary + font.pixelSize: 11 + font.features: { + "tnum": 1 + } + } + } + } + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 22 + DashButton { + anchors.verticalCenter: parent.verticalCenter + objectName: "notchPrevious" + size: 44 + glyph: "󰒮" + fallback: "⏮" + interactive: root.hasPlayer && MediaService.player.canControl && MediaService.player.canGoPrevious + onClicked: MediaService.previous() + Accessible.name: "Previous track" + } + DashButton { + anchors.verticalCenter: parent.verticalCenter + objectName: "notchToggle" + size: 60 + accented: true + glyph: MediaService.playing ? "󰏤" : "󰐊" + fallback: MediaService.playing ? "⏸" : "▶" + interactive: root.hasPlayer && MediaService.player.canControl && MediaService.player.canTogglePlaying + onClicked: MediaService.toggle() + Accessible.name: MediaService.playing ? "Pause" : "Play" + } + DashButton { + anchors.verticalCenter: parent.verticalCenter + objectName: "notchNext" + size: 44 + glyph: "󰒭" + fallback: "⏭" + interactive: root.hasPlayer && MediaService.player.canControl && MediaService.player.canGoNext + onClicked: MediaService.next() + Accessible.name: "Next track" + } + } + // Fixed-height wrapper keeps Cava frames from re-laying out the column. + Item { + width: parent.width + height: 30 + Row { + anchors.fill: parent + spacing: 3 + opacity: MediaService.playing ? 1 : 0.25 + Repeater { + model: 24 + Rectangle { + required property int index + anchors.bottom: parent.bottom + width: (root.width - 24 - 23 * 3) / 24 + radius: 2 + height: Math.max(3, 30 * (MediaService.playing ? (CavaService.bars[index] || 0) : 0.05)) + color: Qt.alpha(Theme.accentVivid, 0.85) + } + } + } + } + } +} diff --git a/quickshell/services/ConfigLogic.js b/quickshell/services/ConfigLogic.js index 5848d0c..954eb5c 100644 --- a/quickshell/services/ConfigLogic.js +++ b/quickshell/services/ConfigLogic.js @@ -85,6 +85,7 @@ function validate(c) { const dashTabs=new Set(); for(const t of dash.tabs) { if(!t || typeof t.id!=="string" || dashTabs.has(t.id) || typeof t.enabled!=="boolean")throw Error("Invalid dashboard tab"); dashTabs.add(t.id); } if(!c.notch || ["enabled","mediaFirst"].some(k=>typeof c.notch[k]!=="boolean"))throw Error("Invalid notch preferences"); + 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(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 187e6b7..76dd0bf 100644 --- a/quickshell/settings/pages/Notch.qml +++ b/quickshell/settings/pages/Notch.qml @@ -1,12 +1,67 @@ +pragma ComponentBehavior: Bound import QtQuick +import QtQuick.Layouts import "../controls" import "../../components" import "../../core" import "../../services" +import "../../theme" SettingsPage { id: root readonly property var options: ConfigService.data.notch + // Adds or removes a bar module from one of the notch's module lists. + function toggleModule(key, id) { + const list = (options[key] || []).slice(); + const at = list.indexOf(id); + if (at >= 0) + list.splice(at, 1); + else + list.push(id); + ConfigService.setValue("notch." + key, list); + } + // Chips for every bar module; filled ones are shown there, in click order. + component ModulePicker: SettingRow { + id: picker + property string key + below: Flow { + Layout.fillWidth: true + spacing: 6 + Repeater { + model: ModuleRegistry.available + Rectangle { + id: chip + required property string modelData + readonly property bool on: (root.options[picker.key] || []).includes(modelData) + objectName: "notchModule-" + picker.key + "-" + modelData + implicitWidth: chipLabel.implicitWidth + 24 + implicitHeight: 28 + radius: 14 + color: on ? (chipArea.containsMouse ? Theme.accentHover : Theme.accent) : chipArea.containsMouse ? Theme.hover : Theme.fill + border.width: on ? 0 : 1 + border.color: Theme.hairline + Accessible.role: Accessible.CheckBox + Accessible.name: ModuleRegistry.title(modelData) + Accessible.checked: on + Text { + id: chipLabel + anchors.centerIn: parent + text: ModuleRegistry.title(chip.modelData) + color: chip.on ? Theme.accentText : Theme.text + font.pixelSize: 12 + font.weight: Font.Medium + } + MouseArea { + id: chipArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: root.toggleModule(picker.key, chip.modelData) + } + } + } + } + } SettingsSection { title: "Notch" description: "Splits the bar into side islands with a notch at the top centre. Super+C, Super+X and a click on the notch open it: dashboard pages on the left (scroll to switch), controls and weather in the middle, notifications on the right. The launcher drops out of it." @@ -37,7 +92,27 @@ SettingsPage { } } } + SettingsSection { + title: "Modules" + description: "Which bar modules show in notch mode. The strip sits left of the clock in the open notch; the mouse wheel scrolls it sideways when it overflows." + enabled: root.options.enabled + ModulePicker { + title: "Left island" + icon: "󰁍" + key: "left" + } + ModulePicker { + title: "Right island" + icon: "󰁔" + key: "right" + } + ModulePicker { + title: "Notch strip" + icon: "󰹑" + key: "strip" + } + } SettingNote { - text: "The middle column uses your Control Center tiles; change them in Control Center → Edit Controls." + text: "Super+N switches between notch mode and the full bar. The middle column uses your Control Center tiles; edit them with the cog in the open notch." } } diff --git a/scripts/glassmxrph b/scripts/glassmxrph index a9b9689..c0ff57a 100755 --- a/scripts/glassmxrph +++ b/scripts/glassmxrph @@ -50,6 +50,12 @@ case "${1:-run}" in # glassmxrph dashboard [dashboard|media|performance|power] exec quickshell ipc --path "$project_dir/quickshell" call dashboard toggle "${2:-}" ;; + notch) + # glassmxrph notch [toggle|open|close|mode]; mode swaps notch mode and the full bar + action=${2:-toggle} + [ "$action" = mode ] && action=toggleMode + exec quickshell ipc --path "$project_dir/quickshell" call notch "$action" + ;; lock) exec quickshell ipc --path "$project_dir/quickshell" call lock lock ;; @@ -73,5 +79,5 @@ case "${1:-run}" in settings|close|status) exec quickshell ipc --path "$project_dir/quickshell" call shell "$1" ;; - *) echo 'Usage: glassmxrph [run|wallpaper|launcher|overview|clipboard|emoji|dashboard [TAB]|plugin ACTION|controlcenter|lock|widgets|osd ACTION|notifications ACTION|settings|close|status|doctor]' >&2; exit 2 ;; + *) echo 'Usage: glassmxrph [run|wallpaper|launcher|overview|clipboard|emoji|dashboard [TAB]|notch [toggle|mode]|plugin ACTION|controlcenter|lock|widgets|osd ACTION|notifications ACTION|settings|close|status|doctor]' >&2; exit 2 ;; esac