Edit the notch's tiles in place instead of in the Control Center

The notch's cog now switches its middle column into edit mode (drag to
move, corner to resize, badge to remove, chips to add), saving only to
notch.controls. "Follow Control Center" clears it to mirror the Control
Center again. The Control Center is back to editing only its own layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-12 17:30:15 +01:00
1 parent efaace0f15
commit de0295e18e
5 files changed
+346 -60

No files matched your search

+5 -13
View File
@@ -55,10 +55,7 @@ PanelWindow {
readonly property int cellHeight: 68
readonly property real gridWidth: panel.targetWidth - 28
readonly property real cellWidth: (gridWidth - 3 * gap) / Grid.COLS
// 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 entries: ConfigService.ready ? 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))
@@ -95,7 +92,7 @@ PanelWindow {
// Writes every tile's cell (and changed sizes) back, so nothing repacks
// and gaps stay.
function save(plan, patch) {
ConfigService.setValue(root.layoutPath, entries.map(m => {
ConfigService.setValue("controlCenter.modules", entries.map(m => {
const i = plan.items.find(t => t.id === m.id);
let next = Object.assign({}, m);
if (i) {
@@ -143,21 +140,16 @@ PanelWindow {
x: spot.col,
y: spot.row
} : {});
ConfigService.setValue(root.layoutPath, known ? entries.map(m => m.id === id ? added : m) : entries.concat([added]));
ConfigService.setValue("controlCenter.modules", known ? entries.map(m => m.id === id ? added : m) : entries.concat([added]));
}
function reset() {
// The notch resets to following the Control Center again.
ConfigService.setValue(root.layoutPath, notchLayout ? [] : ConfigService.defaults.controlCenter.modules);
ConfigService.setValue("controlCenter.modules", ConfigService.defaults.controlCenter.modules);
}
Connections {
target: ShellState
function onControlCenterOpenChanged() {
if (!ShellState.controlCenterOpen)
root.editing = false;
else if (ShellState.controlCenterEditRequested) {
ShellState.controlCenterEditRequested = false;
root.editing = true;
}
}
}
@@ -313,7 +305,7 @@ PanelWindow {
Layout.leftMargin: 4
spacing: 2
Text {
text: root.notchLayout ? (root.editing ? "Edit Notch Controls" : "Notch Controls") : root.editing ? "Edit Controls" : "Control Center"
text: root.editing ? "Edit Controls" : "Control Center"
color: Theme.text
font.pixelSize: 14
font.weight: Font.DemiBold
-29
View File
@@ -101,35 +101,6 @@ Singleton {
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
// "notch" while the Control Center edits the notch's own tile layout.
property string controlCenterTarget: "main"
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;
controlCenterTarget = notchMode ? "notch" : "main";
controlCenterOpen = true;
}
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
property var overviewScreen: null
+339 -16
View File
@@ -99,6 +99,37 @@ PanelWindow {
Component.onCompleted: ShellState.notchWindow = root
Component.onDestruction: ShellState.notchWindow = null
// Pill button for the tile editor.
component Pill: Rectangle {
id: pill
property string text
property bool strong: false
signal clicked
implicitWidth: pillLabel.implicitWidth + 28
implicitHeight: 30
radius: 15
color: strong ? (pillArea.containsMouse ? Theme.accentHover : Theme.accent) : pillArea.containsMouse ? Theme.hover : Theme.fill
border.width: strong ? 0 : 1
border.color: Theme.hairline
Accessible.role: Accessible.Button
Accessible.name: text
Text {
id: pillLabel
anchors.centerIn: parent
text: pill.text
color: pill.strong ? Theme.accentText : Theme.text
font.pixelSize: 12
font.weight: Font.Medium
}
MouseArea {
id: pillArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: pill.clicked()
}
}
// Opening with audio playing always lands on Media.
Connections {
target: ShellState
@@ -154,7 +185,9 @@ PanelWindow {
clip: true
focus: ShellState.notchOpen
Keys.onEscapePressed: {
if (root.computer)
if (middle.editing)
middle.editing = false;
else if (root.computer)
ShellState.notchView = "main";
else
ShellState.notchOpen = false;
@@ -263,7 +296,7 @@ PanelWindow {
radius: 15
visible: body.headerShown
opacity: root.contentOpacity
color: cogArea.containsMouse ? Theme.hover : Theme.transparent
color: middle.editing ? Theme.accent : cogArea.containsMouse ? Theme.hover : Theme.transparent
Accessible.role: Accessible.Button
Accessible.name: "Edit controls"
Text {
@@ -271,14 +304,14 @@ PanelWindow {
text: Icons.available ? "󰒓" : "⚙"
font.family: Icons.available ? Icons.family : ""
font.pixelSize: 16
color: Theme.textSecondary
color: middle.editing ? Theme.accentText : Theme.textSecondary
}
MouseArea {
id: cogArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: ShellState.editControlCenter()
onClicked: middle.editing = !middle.editing
}
}
Rectangle {
@@ -532,16 +565,20 @@ PanelWindow {
color: Theme.hairline
}
// Middle: Control Center tiles (minus Now Playing, which is on the
// left) packed in their saved order, then the weather.
// Middle: the notch's own Control Center tiles, then the weather.
// The header cog edits them in place (notch.controls); until first
// edited they follow the Control Center's order, packed, without
// Now Playing (the left column shows media).
Flickable {
id: middle
objectName: "notchControls"
x: root.sideWidth + root.columnGap
width: root.middleWidth
height: parent.height
contentWidth: width
contentHeight: middleColumn.implicitHeight
clip: true
interactive: !editing
boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
@@ -549,11 +586,10 @@ PanelWindow {
readonly property int gap: 10
readonly property int cellHeight: 68
readonly property real cellWidth: (width - 3 * gap) / Grid.COLS
// 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 entries: ControlRegistry.notchModules
readonly property var tiles: entries.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 savedPlan: Grid.layout(tiles.map(m => {
const size = ControlRegistry.size(m);
return middle.ownLayout ? {
id: m.id,
@@ -567,6 +603,17 @@ PanelWindow {
h: size.h
};
}))
// Edit mode, as in the Control Center: drag to move, corner to
// resize (tiles in the way are pushed down), badge to remove.
property bool editing: false
property var preview: null
property string dragId: ""
property point dragPoint
property point grabOffset
property string resizeId: ""
readonly property var plan: preview || savedPlan
readonly property int shownRows: plan.rows + (editing ? 1 : 0)
readonly property var addable: ControlRegistry.ids.filter(id => id !== "media" && id !== "notifications" && !tiles.some(m => m.id === id))
property var extras: ({})
function setExtra(id, value) {
if ((extras[id] || 0) === value)
@@ -575,7 +622,71 @@ PanelWindow {
next[id] = value;
extras = next;
}
readonly property var geometry: Grid.geometry(plan, cellWidth, cellHeight, gap, extras)
readonly property var geometry: Grid.geometry(plan, cellWidth, cellHeight, gap, editing ? {} : extras)
// Writes every tile's cell back to the notch's own layout.
function save(plan, patch) {
const list = entries.map(m => Object.assign({}, m));
for (const i of plan.items)
if (!list.some(m => m.id === i.id))
list.push({
id: i.id,
enabled: true
});
ConfigService.setValue("notch.controls", list.map(m => {
const i = plan.items.find(t => t.id === m.id);
let next = m;
if (i) {
next.x = i.col;
next.y = i.row;
next.w = i.w;
next.h = i.h;
}
if (patch && patch[m.id])
next = patch[m.id](next);
return next;
}));
}
function setEnabled(id, on) {
if (!on) {
save(savedPlan, {
[id]: m => {
const next = Object.assign({}, m, {
enabled: false
});
delete next.x;
delete next.y;
return next;
}
});
return;
}
const known = entries.find(m => m.id === id);
const size = ControlRegistry.size(known || {
id: id
});
const spot = Grid.freeSpot(savedPlan, size.w, size.h);
save(savedPlan, {
[id]: m => Object.assign({}, m, {
enabled: true,
x: spot.col,
y: spot.row
})
});
if (!known)
ConfigService.setValue("notch.controls", ConfigService.data.notch.controls.concat([{
id: id,
enabled: true,
x: spot.col,
y: spot.row
}]));
}
Connections {
target: ShellState
function onNotchOpenChanged() {
if (!ShellState.notchOpen)
middle.editing = false;
}
}
readonly property var weatherOptions: {
const items = ConfigService.ready ? ConfigService.data.desktopWidgets.items : [];
const w = items.find(i => i.type === "weather");
@@ -588,7 +699,36 @@ PanelWindow {
Item {
id: tileGrid
width: parent.width
height: middle.geometry.height
height: middle.geometry.height + (middle.editing ? middle.cellHeight + middle.gap : 0)
// Edit mode: faint empty cells, and where a dragged tile lands.
Repeater {
model: middle.editing ? Array.from({
length: Grid.COLS * middle.shownRows
}, (_, i) => i).filter(i => !middle.plan.items.some(t => i % Grid.COLS >= t.col && i % Grid.COLS < t.col + t.w && Math.floor(i / Grid.COLS) >= t.row && Math.floor(i / Grid.COLS) < t.row + t.h)) : []
Rectangle {
required property int modelData
x: (modelData % Grid.COLS) * (middle.cellWidth + middle.gap)
y: Math.floor(modelData / Grid.COLS) * (middle.cellHeight + middle.gap)
width: middle.cellWidth
height: middle.cellHeight
radius: 16
color: Qt.alpha(Theme.text, 0.03)
border.width: 1
border.color: Qt.alpha(Theme.text, 0.07)
}
}
Rectangle {
readonly property var target: middle.dragId ? middle.geometry.tiles[middle.dragId] : null
visible: !!target
x: target ? target.x : 0
y: target ? target.y : 0
width: target ? target.w : 0
height: target ? target.h : 0
radius: Math.min(30, height / 2, width / 2)
color: Qt.alpha(Theme.accent, 0.12)
border.width: 2
border.color: Qt.alpha(Theme.accent, 0.6)
}
Repeater {
model: ScriptModel {
values: middle.tiles.map(m => m.id)
@@ -598,16 +738,28 @@ PanelWindow {
required property string modelData
readonly property var cell: middle.plan.items.find(i => i.id === modelData) || null
readonly property var rect: middle.geometry.tiles[modelData] || null
readonly property bool dragging: middle.dragId === modelData
readonly property real extra: loader.item ? loader.item.extraHeight : 0
readonly property var shape: loader.item ? loader.item.background : null
readonly property bool circle: !!loader.item && loader.item.circle
objectName: "notchTile-" + modelData
visible: !!rect
x: rect ? rect.x : 0
y: rect ? rect.y : 0
x: dragging ? middle.dragPoint.x - middle.grabOffset.x : rect ? rect.x : 0
y: dragging ? middle.dragPoint.y - middle.grabOffset.y : rect ? rect.y : 0
width: rect ? rect.w : 0
height: rect ? rect.h : 0
z: dragging ? 10 : 0
scale: dragging ? 1.04 : 1
onExtraChanged: middle.setExtra(modelData, extra)
Behavior on x {
enabled: root.settled && !slot.dragging
NumberAnimation {
duration: Theme.notchDuration
easing.type: Easing.OutCubic
}
}
Behavior on y {
enabled: root.settled
enabled: root.settled && !slot.dragging
NumberAnimation {
duration: Theme.notchDuration
easing.type: Easing.OutCubic
@@ -618,6 +770,7 @@ PanelWindow {
anchors.fill: parent
active: ShellState.notchOpen
source: ControlRegistry.entry(slot.modelData).source
opacity: middle.editing ? 0.85 : 1
}
Binding {
target: loader.item
@@ -643,10 +796,180 @@ PanelWindow {
property: "baseHeight"
value: slot.cell ? slot.cell.h * middle.cellHeight + (slot.cell.h - 1) * middle.gap : 0
}
Connections {
target: middle
function onEditingChanged() {
if (middle.editing && loader.item && loader.item.expanded)
loader.item.expanded = false;
}
}
Rectangle {
visible: middle.editing
x: slot.shape ? slot.shape.x : 0
y: slot.shape ? slot.shape.y : 0
width: slot.shape ? slot.shape.width : parent.width
height: slot.shape ? slot.shape.height : parent.height
radius: slot.shape ? slot.shape.radius : 12
color: move.containsMouse || slot.dragging ? Qt.alpha(Theme.text, 0.06) : Theme.transparent
border.width: slot.dragging || middle.resizeId === slot.modelData ? 2 : 1
border.color: slot.dragging || middle.resizeId === slot.modelData ? Theme.accent : Qt.alpha(Theme.text, 0.3)
}
MouseArea {
id: move
objectName: "notchMove-" + slot.modelData
visible: middle.editing
anchors.fill: parent
hoverEnabled: true
preventStealing: true
cursorShape: pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor
property var lastCell: null
onPressed: mouse => {
const p = mapToItem(tileGrid, mouse.x, mouse.y);
middle.grabOffset = Qt.point(p.x - slot.x, p.y - slot.y);
middle.dragPoint = p;
lastCell = null;
}
onPositionChanged: mouse => {
if (!pressed)
return;
const p = mapToItem(tileGrid, mouse.x, mouse.y);
if (!middle.dragId) {
if (Math.hypot(p.x - middle.dragPoint.x, p.y - middle.dragPoint.y) < 6)
return;
middle.dragId = slot.modelData;
}
middle.dragPoint = p;
const c = Grid.cellAt(p.x - middle.grabOffset.x, p.y - middle.grabOffset.y, middle.cellWidth, middle.cellHeight, middle.gap);
c.row = Math.min(c.row, middle.savedPlan.rows);
if (lastCell && c.col === lastCell.col && c.row === lastCell.row)
return;
lastCell = c;
middle.preview = Grid.moveTo(middle.savedPlan, slot.modelData, c);
}
onReleased: {
const plan = middle.preview;
middle.dragId = "";
middle.preview = null;
if (plan)
middle.save(plan);
}
onCanceled: {
middle.dragId = "";
middle.preview = null;
}
}
Rectangle {
objectName: "notchRemove-" + slot.modelData
visible: middle.editing && !slot.dragging
x: slot.circle && slot.shape ? slot.shape.x + slot.shape.width * 0.146 - width / 2 : 0
y: slot.circle && slot.shape ? slot.shape.y + slot.shape.height * 0.146 - height / 2 : 0
width: 22
height: 22
radius: 11
color: removeArea.containsMouse ? Theme.accent : Theme.surface
border.width: 1
border.color: Qt.alpha(Theme.text, 0.35)
Accessible.role: Accessible.Button
Accessible.name: "Remove " + ControlRegistry.entry(slot.modelData).title
Text {
anchors.centerIn: parent
text: "−"
color: removeArea.containsMouse ? Theme.accentText : Theme.text
font.pixelSize: 15
font.weight: Font.DemiBold
}
MouseArea {
id: removeArea
anchors.fill: parent
anchors.margins: -3
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: middle.setEnabled(slot.modelData, false)
}
}
Rectangle {
visible: middle.editing && !slot.dragging
x: slot.circle && slot.shape ? slot.shape.x + slot.shape.width * 0.854 - width / 2 : parent.width - width - 2
y: slot.circle && slot.shape ? slot.shape.y + slot.shape.height * 0.854 - height / 2 : parent.height - height - 2
width: 14
height: 14
radius: 7
color: Theme.text
border.width: 2
border.color: Theme.accent
MouseArea {
objectName: "notchResize-" + slot.modelData
anchors.fill: parent
anchors.margins: -5
preventStealing: true
cursorShape: Qt.SizeFDiagCursor
property point start
property var startSize
onPressed: mouse => {
start = mapToItem(tileGrid, mouse.x, mouse.y);
startSize = {
w: slot.cell.w,
h: slot.cell.h
};
middle.resizeId = slot.modelData;
}
onPositionChanged: mouse => {
if (!pressed)
return;
const p = mapToItem(tileGrid, mouse.x, mouse.y);
const next = Grid.resize(startSize, p.x - start.x, p.y - start.y, middle.cellWidth, middle.cellHeight, middle.gap);
if (next.w !== slot.cell.w || next.h !== slot.cell.h)
middle.preview = Grid.moveTo(middle.savedPlan, slot.modelData, next);
}
onReleased: {
const plan = middle.preview;
middle.resizeId = "";
middle.preview = null;
if (plan)
middle.save(plan);
}
onCanceled: {
middle.resizeId = "";
middle.preview = null;
}
}
}
}
}
}
// Edit mode: add tiles, reset, done.
Flow {
visible: middle.editing && middle.addable.length > 0
width: parent.width
spacing: 8
Repeater {
model: middle.editing ? middle.addable : []
Pill {
required property string modelData
objectName: "notchAdd-" + modelData
text: "+ " + (Icons.available ? ControlRegistry.entry(modelData).glyph + " " : "") + ControlRegistry.entry(modelData).title
onClicked: middle.setEnabled(modelData, true)
}
}
}
Row {
visible: middle.editing
anchors.horizontalCenter: parent.horizontalCenter
spacing: 8
Pill {
objectName: "notchReset"
text: "Follow Control Center"
onClicked: ConfigService.setValue("notch.controls", [])
}
Pill {
objectName: "notchDone"
text: "Done"
strong: true
onClicked: middle.editing = false
}
}
Rectangle {
visible: !middle.editing
width: parent.width
height: 92
radius: Math.min(30, height / 2)
@@ -753,7 +1076,7 @@ PanelWindow {
pager.go(index);
}
function editControls(): void {
ShellState.editControlCenter();
middle.editing = !middle.editing;
}
function toggleMode(): bool {
return ShellState.toggleNotchMode();
+1 -1
View File
@@ -17,7 +17,7 @@ Singleton {
if (!ConfigService.ready)
return [];
if (ShellState.controlCenterOpen || ShellState.notchOpen)
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);
return (ShellState.notchOpen && 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)
+1 -1
View File
@@ -191,6 +191,6 @@ SettingsPage {
}
}
SettingNote {
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."
text: "Super+N switches between notch mode and the full bar. The cog in the open notch edits its tiles in place, separately from the Control Center. Follow Control Center (in that editor) mirrors the Control Center again."
}
}