From 73de4b06a8a7b8c9a7607f87ddca5ef5efd2640f Mon Sep 17 00:00:00 2001 From: mx Date: Thu, 12 Nov 2026 17:08:46 +0100 Subject: [PATCH] Give notch mode its own control layout and backgroundless islands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The notch's cog edits a separate tile layout (notch.controls); normal mode keeps the Control Center's. Reset follows the Control Center again. - Notch islands draw no bar behind their modules. - The notch strip picker comes first in Settings → Notch, and an empty strip offers a shortcut to it. Co-Authored-By: Claude Opus 5.5 --- quickshell/bar/Bar.qml | 8 ++++ quickshell/config/defaults.json | 3 +- quickshell/controlcenter/ControlCenter.qml | 14 ++++--- quickshell/controlcenter/ControlRegistry.qml | 10 +++++ quickshell/core/ShellState.qml | 16 ++++++-- quickshell/notch/Notch.qml | 41 +++++++++++++++++++- quickshell/services/ConfigLogic.js | 1 + quickshell/services/SystemService.qml | 2 +- quickshell/settings/pages/Notch.qml | 13 ++++--- 9 files changed, 89 insertions(+), 19 deletions(-) diff --git a/quickshell/bar/Bar.qml b/quickshell/bar/Bar.qml index ab4451c..6bcb94b 100644 --- a/quickshell/bar/Bar.qml +++ b/quickshell/bar/Bar.qml @@ -78,6 +78,10 @@ PanelWindow { // Notch mode ------------------------------------------------------------- GlassPanel { id: leftIsland + // No bar behind the modules in notch mode: they float on their own. + color: Theme.transparent + border.width: 0 + plain: true visible: root.notch && ConfigService.ready && ConfigService.data.notch.left.length > 0 x: root.outerMargin y: root.outerMargin @@ -88,6 +92,10 @@ PanelWindow { } GlassPanel { id: rightIsland + // No bar behind the modules in notch mode: they float on their own. + color: Theme.transparent + border.width: 0 + plain: true visible: root.notch && ConfigService.ready && ConfigService.data.notch.right.length > 0 x: root.width - root.outerMargin - width y: root.outerMargin diff --git a/quickshell/config/defaults.json b/quickshell/config/defaults.json index 7c02bbb..3ec8eeb 100644 --- a/quickshell/config/defaults.json +++ b/quickshell/config/defaults.json @@ -267,7 +267,8 @@ "mediaFirst": true, "left": ["workspaces"], "right": ["tray"], - "strip": [] + "strip": [], + "controls": [] }, "dashboard": { "enabled": true, diff --git a/quickshell/controlcenter/ControlCenter.qml b/quickshell/controlcenter/ControlCenter.qml index cf5c9c4..cb966c3 100644 --- a/quickshell/controlcenter/ControlCenter.qml +++ b/quickshell/controlcenter/ControlCenter.qml @@ -55,7 +55,10 @@ PanelWindow { readonly property int cellHeight: 68 readonly property real gridWidth: panel.targetWidth - 28 readonly property real cellWidth: (gridWidth - 3 * gap) / Grid.COLS - readonly property var entries: ConfigService.ready ? ConfigService.data.controlCenter.modules : [] + // The notch's cog edits the notch's own tile layout here. + readonly property bool notchLayout: ShellState.controlCenterTarget === "notch" + readonly property string layoutPath: notchLayout ? "notch.controls" : "controlCenter.modules" + readonly property var entries: !ConfigService.ready ? [] : notchLayout ? ControlRegistry.notchModules : ConfigService.data.controlCenter.modules readonly property var tiles: entries.filter(m => m.enabled && !!ControlRegistry.entry(m.id) && !ControlRegistry.entry(m.id).section) readonly property bool notifications: entries.some(m => m.id === "notifications" && m.enabled) readonly property var addable: ControlRegistry.ids.filter(id => !entries.some(m => m.id === id && m.enabled)) @@ -92,7 +95,7 @@ PanelWindow { // Writes every tile's cell (and changed sizes) back, so nothing repacks // and gaps stay. function save(plan, patch) { - ConfigService.setValue("controlCenter.modules", entries.map(m => { + ConfigService.setValue(root.layoutPath, entries.map(m => { const i = plan.items.find(t => t.id === m.id); let next = Object.assign({}, m); if (i) { @@ -140,10 +143,11 @@ PanelWindow { x: spot.col, y: spot.row } : {}); - ConfigService.setValue("controlCenter.modules", known ? entries.map(m => m.id === id ? added : m) : entries.concat([added])); + ConfigService.setValue(root.layoutPath, known ? entries.map(m => m.id === id ? added : m) : entries.concat([added])); } function reset() { - ConfigService.setValue("controlCenter.modules", ConfigService.defaults.controlCenter.modules); + // The notch resets to following the Control Center again. + ConfigService.setValue(root.layoutPath, notchLayout ? [] : ConfigService.defaults.controlCenter.modules); } Connections { target: ShellState @@ -309,7 +313,7 @@ PanelWindow { Layout.leftMargin: 4 spacing: 2 Text { - text: root.editing ? "Edit Controls" : "Control Center" + text: root.notchLayout ? (root.editing ? "Edit Notch Controls" : "Notch Controls") : root.editing ? "Edit Controls" : "Control Center" color: Theme.text font.pixelSize: 14 font.weight: Font.DemiBold diff --git a/quickshell/controlcenter/ControlRegistry.qml b/quickshell/controlcenter/ControlRegistry.qml index 709eb8a..79aeed4 100644 --- a/quickshell/controlcenter/ControlRegistry.qml +++ b/quickshell/controlcenter/ControlRegistry.qml @@ -23,6 +23,16 @@ Singleton { } return Object.prototype.hasOwnProperty.call(modules, id) ? modules[id] : null; } + // The notch's own tile layout. Until it is edited it starts as a copy of + // the Control Center's, without Now Playing (the notch shows media itself). + readonly property var notchModules: { + if (!ConfigService.ready) + return []; + const own = ConfigService.data.notch.controls; + return own.length ? own : ConfigService.data.controlCenter.modules.map(m => m.id === "media" ? Object.assign({}, m, { + enabled: false + }) : m); + } // Configured size, else the module's default. function size(module) { if (!module) diff --git a/quickshell/core/ShellState.qml b/quickshell/core/ShellState.qml index 4a39831..e3ca802 100644 --- a/quickshell/core/ShellState.qml +++ b/quickshell/core/ShellState.qml @@ -104,6 +104,8 @@ Singleton { // 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 + // "notch" while the Control Center edits the notch's own tile layout. + property string controlCenterTarget: "main" property bool notchReturn: false function editControlCenter() { notchReturn = notchMode; @@ -115,12 +117,18 @@ Singleton { settingsOpen = false; controlCenterScreen = notchScreen || activeScreen(); controlCenterEditRequested = true; + controlCenterTarget = notchMode ? "notch" : "main"; controlCenterOpen = true; } - onControlCenterOpenChanged: if (!controlCenterOpen && notchReturn) { - notchReturn = false; - if (notchMode) - Qt.callLater(openNotch); + onControlCenterOpenChanged: { + if (controlCenterOpen) + return; + controlCenterTarget = "main"; + if (notchReturn) { + notchReturn = false; + if (notchMode) + Qt.callLater(openNotch); + } } // Workspace overview (SUPER+Tab): a drawer of live workspace thumbnails. property bool overviewOpen: false diff --git a/quickshell/notch/Notch.qml b/quickshell/notch/Notch.qml index 088ba4d..283285e 100644 --- a/quickshell/notch/Notch.qml +++ b/quickshell/notch/Notch.qml @@ -196,6 +196,34 @@ PanelWindow { anchors.verticalCenter: parent.verticalCenter } } + // Empty strip: a shortcut to pick its modules. + Rectangle { + objectName: "notchStripAdd" + x: main.x + y: (root.band - height) / 2 + width: addLabel.implicitWidth + 24 + height: 28 + radius: 14 + visible: body.headerShown && stripRow.modules.length === 0 + opacity: root.contentOpacity + color: addArea.containsMouse ? Theme.hover : Theme.fill + border.width: 1 + border.color: Theme.hairline + Text { + id: addLabel + anchors.centerIn: parent + text: "+ Add bar modules" + color: Theme.textSecondary + font.pixelSize: 12 + } + MouseArea { + id: addArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: ShellState.revealSetting("notch", "Notch strip") + } + } MouseArea { anchors.fill: strip visible: strip.visible @@ -500,10 +528,19 @@ PanelWindow { readonly property int gap: 10 readonly property int cellHeight: 68 readonly property real cellWidth: (width - 3 * gap) / Grid.COLS - readonly property var tiles: (ConfigService.ready ? ConfigService.data.controlCenter.modules : []).filter(m => m.enabled && m.id !== "media" && !!ControlRegistry.entry(m.id) && !ControlRegistry.entry(m.id).section).slice().sort((a, b) => ((Number.isInteger(a.y) ? a.y : 99) - (Number.isInteger(b.y) ? b.y : 99)) || ((Number.isInteger(a.x) ? a.x : 0) - (Number.isInteger(b.x) ? b.x : 0))) + // The notch's own layout keeps its edited cells; until edited it + // follows the Control Center's order, packed, without Now Playing. + readonly property bool ownLayout: ConfigService.ready && ConfigService.data.notch.controls.length > 0 + readonly property var tiles: ControlRegistry.notchModules.filter(m => m.enabled && m.id !== "media" && !!ControlRegistry.entry(m.id) && !ControlRegistry.entry(m.id).section).slice().sort((a, b) => ((Number.isInteger(a.y) ? a.y : 99) - (Number.isInteger(b.y) ? b.y : 99)) || ((Number.isInteger(a.x) ? a.x : 0) - (Number.isInteger(b.x) ? b.x : 0))) readonly property var plan: Grid.layout(tiles.map(m => { const size = ControlRegistry.size(m); - return { + return middle.ownLayout ? { + id: m.id, + w: size.w, + h: size.h, + x: m.x, + y: m.y + } : { id: m.id, w: size.w, h: size.h diff --git a/quickshell/services/ConfigLogic.js b/quickshell/services/ConfigLogic.js index 954eb5c..a54a81d 100644 --- a/quickshell/services/ConfigLogic.js +++ b/quickshell/services/ConfigLogic.js @@ -86,6 +86,7 @@ function validate(c) { 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(!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(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/services/SystemService.qml b/quickshell/services/SystemService.qml index 84ac1b8..de3b9e5 100644 --- a/quickshell/services/SystemService.qml +++ b/quickshell/services/SystemService.qml @@ -17,7 +17,7 @@ Singleton { if (!ConfigService.ready) return []; if (ShellState.controlCenterOpen || ShellState.notchOpen) - return ConfigService.data.controlCenter.modules.filter(m => m.enabled && ["brightness", "nightLight", "dnd", "profiles", "power"].includes(m.id)).map(m => m.id); + return ((ShellState.notchOpen || ShellState.controlCenterTarget === "notch") && ConfigService.data.notch.controls.length ? ConfigService.data.notch.controls : ConfigService.data.controlCenter.modules).filter(m => m.enabled && ["brightness", "nightLight", "dnd", "profiles", "power"].includes(m.id)).map(m => m.id); if (ShellState.dashboardOpen) return ["power"]; if (!ShellState.settingsOpen) diff --git a/quickshell/settings/pages/Notch.qml b/quickshell/settings/pages/Notch.qml index 76dd0bf..5c64b9e 100644 --- a/quickshell/settings/pages/Notch.qml +++ b/quickshell/settings/pages/Notch.qml @@ -96,6 +96,12 @@ SettingsPage { 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: "Notch strip" + description: "Left of the clock in the open notch, e.g. AI usage or the screen recorder" + icon: "󰹑" + key: "strip" + } ModulePicker { title: "Left island" icon: "󰁍" @@ -106,13 +112,8 @@ SettingsPage { icon: "󰁔" key: "right" } - ModulePicker { - title: "Notch strip" - icon: "󰹑" - key: "strip" - } } SettingNote { - 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." + text: "Super+N switches between notch mode and the full bar. The middle column uses your Control Center tiles; the cog in the open notch edits the notch's own layout, separate from the Control Center. Reset there to follow the Control Center again." } }