Give notch mode its own control layout and backgroundless islands
- 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 <noreply@anthropic.com>
This commit is contained in:
1 parent
74b6ad50ec
commit
73de4b06a8
9 files changed
+89
-19
No files matched your search
@@ -78,6 +78,10 @@ PanelWindow {
|
|||||||
// Notch mode -------------------------------------------------------------
|
// Notch mode -------------------------------------------------------------
|
||||||
GlassPanel {
|
GlassPanel {
|
||||||
id: leftIsland
|
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
|
visible: root.notch && ConfigService.ready && ConfigService.data.notch.left.length > 0
|
||||||
x: root.outerMargin
|
x: root.outerMargin
|
||||||
y: root.outerMargin
|
y: root.outerMargin
|
||||||
@@ -88,6 +92,10 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
GlassPanel {
|
GlassPanel {
|
||||||
id: rightIsland
|
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
|
visible: root.notch && ConfigService.ready && ConfigService.data.notch.right.length > 0
|
||||||
x: root.width - root.outerMargin - width
|
x: root.width - root.outerMargin - width
|
||||||
y: root.outerMargin
|
y: root.outerMargin
|
||||||
|
|||||||
@@ -267,7 +267,8 @@
|
|||||||
"mediaFirst": true,
|
"mediaFirst": true,
|
||||||
"left": ["workspaces"],
|
"left": ["workspaces"],
|
||||||
"right": ["tray"],
|
"right": ["tray"],
|
||||||
"strip": []
|
"strip": [],
|
||||||
|
"controls": []
|
||||||
},
|
},
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
|
|||||||
@@ -55,7 +55,10 @@ PanelWindow {
|
|||||||
readonly property int cellHeight: 68
|
readonly property int cellHeight: 68
|
||||||
readonly property real gridWidth: panel.targetWidth - 28
|
readonly property real gridWidth: panel.targetWidth - 28
|
||||||
readonly property real cellWidth: (gridWidth - 3 * gap) / Grid.COLS
|
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 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 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))
|
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
|
// Writes every tile's cell (and changed sizes) back, so nothing repacks
|
||||||
// and gaps stay.
|
// and gaps stay.
|
||||||
function save(plan, patch) {
|
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);
|
const i = plan.items.find(t => t.id === m.id);
|
||||||
let next = Object.assign({}, m);
|
let next = Object.assign({}, m);
|
||||||
if (i) {
|
if (i) {
|
||||||
@@ -140,10 +143,11 @@ PanelWindow {
|
|||||||
x: spot.col,
|
x: spot.col,
|
||||||
y: spot.row
|
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() {
|
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 {
|
Connections {
|
||||||
target: ShellState
|
target: ShellState
|
||||||
@@ -309,7 +313,7 @@ PanelWindow {
|
|||||||
Layout.leftMargin: 4
|
Layout.leftMargin: 4
|
||||||
spacing: 2
|
spacing: 2
|
||||||
Text {
|
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
|
color: Theme.text
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
font.weight: Font.DemiBold
|
font.weight: Font.DemiBold
|
||||||
|
|||||||
@@ -23,6 +23,16 @@ Singleton {
|
|||||||
}
|
}
|
||||||
return Object.prototype.hasOwnProperty.call(modules, id) ? modules[id] : null;
|
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.
|
// Configured size, else the module's default.
|
||||||
function size(module) {
|
function size(module) {
|
||||||
if (!module)
|
if (!module)
|
||||||
|
|||||||
@@ -104,6 +104,8 @@ Singleton {
|
|||||||
// The notch's cog edits its tiles in the Control Center editor, then the
|
// The notch's cog edits its tiles in the Control Center editor, then the
|
||||||
// notch comes back once the Control Center closes.
|
// notch comes back once the Control Center closes.
|
||||||
property bool controlCenterEditRequested: false
|
property bool controlCenterEditRequested: false
|
||||||
|
// "notch" while the Control Center edits the notch's own tile layout.
|
||||||
|
property string controlCenterTarget: "main"
|
||||||
property bool notchReturn: false
|
property bool notchReturn: false
|
||||||
function editControlCenter() {
|
function editControlCenter() {
|
||||||
notchReturn = notchMode;
|
notchReturn = notchMode;
|
||||||
@@ -115,12 +117,18 @@ Singleton {
|
|||||||
settingsOpen = false;
|
settingsOpen = false;
|
||||||
controlCenterScreen = notchScreen || activeScreen();
|
controlCenterScreen = notchScreen || activeScreen();
|
||||||
controlCenterEditRequested = true;
|
controlCenterEditRequested = true;
|
||||||
|
controlCenterTarget = notchMode ? "notch" : "main";
|
||||||
controlCenterOpen = true;
|
controlCenterOpen = true;
|
||||||
}
|
}
|
||||||
onControlCenterOpenChanged: if (!controlCenterOpen && notchReturn) {
|
onControlCenterOpenChanged: {
|
||||||
notchReturn = false;
|
if (controlCenterOpen)
|
||||||
if (notchMode)
|
return;
|
||||||
Qt.callLater(openNotch);
|
controlCenterTarget = "main";
|
||||||
|
if (notchReturn) {
|
||||||
|
notchReturn = false;
|
||||||
|
if (notchMode)
|
||||||
|
Qt.callLater(openNotch);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Workspace overview (SUPER+Tab): a drawer of live workspace thumbnails.
|
// Workspace overview (SUPER+Tab): a drawer of live workspace thumbnails.
|
||||||
property bool overviewOpen: false
|
property bool overviewOpen: false
|
||||||
|
|||||||
@@ -196,6 +196,34 @@ PanelWindow {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
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 {
|
MouseArea {
|
||||||
anchors.fill: strip
|
anchors.fill: strip
|
||||||
visible: strip.visible
|
visible: strip.visible
|
||||||
@@ -500,10 +528,19 @@ PanelWindow {
|
|||||||
readonly property int gap: 10
|
readonly property int gap: 10
|
||||||
readonly property int cellHeight: 68
|
readonly property int cellHeight: 68
|
||||||
readonly property real cellWidth: (width - 3 * gap) / Grid.COLS
|
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 => {
|
readonly property var plan: Grid.layout(tiles.map(m => {
|
||||||
const size = ControlRegistry.size(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,
|
id: m.id,
|
||||||
w: size.w,
|
w: size.w,
|
||||||
h: size.h
|
h: size.h
|
||||||
|
|||||||
@@ -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); }
|
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");
|
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");
|
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");
|
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;
|
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");
|
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");
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Singleton {
|
|||||||
if (!ConfigService.ready)
|
if (!ConfigService.ready)
|
||||||
return [];
|
return [];
|
||||||
if (ShellState.controlCenterOpen || ShellState.notchOpen)
|
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)
|
if (ShellState.dashboardOpen)
|
||||||
return ["power"];
|
return ["power"];
|
||||||
if (!ShellState.settingsOpen)
|
if (!ShellState.settingsOpen)
|
||||||
|
|||||||
@@ -96,6 +96,12 @@ SettingsPage {
|
|||||||
title: "Modules"
|
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."
|
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
|
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 {
|
ModulePicker {
|
||||||
title: "Left island"
|
title: "Left island"
|
||||||
icon: ""
|
icon: ""
|
||||||
@@ -106,13 +112,8 @@ SettingsPage {
|
|||||||
icon: ""
|
icon: ""
|
||||||
key: "right"
|
key: "right"
|
||||||
}
|
}
|
||||||
ModulePicker {
|
|
||||||
title: "Notch strip"
|
|
||||||
icon: ""
|
|
||||||
key: "strip"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
SettingNote {
|
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."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user