Files
glassMxrph/quickshell/controlcenter/ControlRegistry.qml
T
mxandClaude Opus 5.5 73de4b06a8 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>
2026-11-12 17:08:46 +01:00

156 lines
4.9 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
pragma Singleton
import QtQuick
import Quickshell
import "../services"
// Control Center modules. Grid tiles have a default size in cells (w × h,
// each 1–4) that the user can change in edit mode; Notifications is a section
// under the grid instead. Enabled plugins with a Control Center widget add
// "plugin:<id>" tiles.
Singleton {
readonly property var ids: Object.keys(modules).concat(PluginService.controlModules)
function entry(id) {
if (String(id).startsWith("plugin:")) {
const plugin = String(id).slice("plugin:".length);
return PluginService.controlModules.includes(id) ? {
title: PluginService.title(plugin),
glyph: "󰏗",
w: 1,
h: 1,
plugin: plugin,
source: Qt.resolvedUrl("modules/Plugin.qml")
} : 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.
function size(module) {
if (!module)
return {
w: 1,
h: 1
};
const e = entry(module.id);
return {
w: module.w || (e ? e.w : 1),
h: module.h || (e ? e.h : 1)
};
}
readonly property var modules: ({
wifi: {
title: "Wi-Fi",
glyph: "󰖩",
w: 2,
h: 1,
source: Qt.resolvedUrl("modules/Wifi.qml")
},
bluetooth: {
title: "Bluetooth",
glyph: "󰂯",
w: 1,
h: 1,
source: Qt.resolvedUrl("modules/Bluetooth.qml")
},
network: {
title: "Network",
glyph: "󰛳",
w: 2,
h: 1,
source: Qt.resolvedUrl("modules/Network.qml")
},
output: {
title: "Sound",
glyph: "󰕾",
w: 4,
h: 1,
source: Qt.resolvedUrl("modules/Output.qml")
},
input: {
title: "Microphone",
glyph: "󰍬",
w: 4,
h: 1,
source: Qt.resolvedUrl("modules/Input.qml")
},
brightness: {
title: "Display",
glyph: "󰃠",
w: 4,
h: 1,
source: Qt.resolvedUrl("modules/Brightness.qml")
},
nightLight: {
title: "Night Light",
glyph: "󰖔",
w: 1,
h: 1,
source: Qt.resolvedUrl("modules/NightLight.qml")
},
dnd: {
title: "Do Not Disturb",
glyph: "󰽥",
w: 1,
h: 1,
source: Qt.resolvedUrl("modules/Dnd.qml")
},
caffeine: {
title: "Caffeine",
glyph: "󰅶",
w: 1,
h: 1,
source: Qt.resolvedUrl("modules/Caffeine.qml")
},
gameMode: {
title: "Game Mode",
glyph: "󰊴",
w: 2,
h: 1,
source: Qt.resolvedUrl("modules/GameMode.qml")
},
profiles: {
title: "Power profile",
glyph: "󰾅",
w: 2,
h: 1,
source: Qt.resolvedUrl("modules/Profiles.qml")
},
media: {
title: "Now Playing",
glyph: "󰝚",
w: 2,
h: 2,
source: Qt.resolvedUrl("modules/NowPlaying.qml")
},
power: {
title: "Power",
glyph: "󰐥",
w: 4,
h: 1,
source: Qt.resolvedUrl("modules/Power.qml")
},
metrics: {
title: "System Metrics",
glyph: "󰍛",
w: 4,
h: 1,
source: Qt.resolvedUrl("modules/Metrics.qml")
},
notifications: {
title: "Notifications",
glyph: "󰂚",
section: true,
source: Qt.resolvedUrl("modules/Notifications.qml")
}
})
}