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
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user