Files
glassMxrph/quickshell/core/BarLayout.qml
T
mxandClaude Opus 5.5 99e64a7713 Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher,
settings, Control Center, dashboard, OSD, lock screen, desktop widgets,
plugin host with the vendored Noctalia/Omarchy compatibility layer,
helpers, packaging, tests and phase documentation.

Includes the optimization work so far: usage widgets and dashboard
gauges no longer animate continuously, desktop widgets pause while
covered, system controls stop flickering on background polls, dock app
matching uses an indexed catalog, and workspace ghosts are created only
for occupied slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:36:17 +02:00

43 lines
1.6 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
import "../services"
// Bar module layouts. Screens listed in `bar.screens` have their own module
// list (e.g. a narrow vertical monitor); every other screen uses `bar.modules`.
Singleton {
id: root
readonly property var screens: ConfigService.ready ? (ConfigService.data.bar.screens || ({})) : ({})
function hasOwn(screenName) {
return !!screenName && !!screens[screenName] && Array.isArray(screens[screenName].modules);
}
function modulesFor(screenName) {
if (!ConfigService.ready)
return [];
return hasOwn(screenName) ? screens[screenName].modules : ConfigService.data.bar.modules;
}
// Saves to the screen's own layout when it has one, else the shared layout.
function save(screenName, modules) {
if (!hasOwn(screenName))
return ConfigService.setValue("bar.modules", modules);
const next = Object.assign({}, screens);
next[screenName] = Object.assign({}, next[screenName], {
modules: modules
});
return ConfigService.setValue("bar.screens", next);
}
// A new screen layout starts as a copy of the shared one.
function setOwn(screenName, own) {
if (!screenName || own === hasOwn(screenName))
return false;
const next = Object.assign({}, screens);
if (own)
next[screenName] = {
modules: ConfigService.data.bar.modules.map(m => Object.assign({}, m))
};
else
delete next[screenName];
return ConfigService.setValue("bar.screens", next);
}
}