Open every bar module cog inline

The cog on Clock, Workspaces, Tray, Volume and the metrics modules used
to jump to another settings page while the rest opened in the card. Now
every cog opens its options in the card, editing the same shared
settings as the pages. Modules with more on a page (Volume → OSD,
metrics → Metrics) end with an "All … settings →" link. System has no
options of its own, so it has no cog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-29 14:52:31 +01:00
1 parent f756d37f6d
commit 629287f7f3
2 files changed
+69 -23

No files matched your search

+47 -15
View File
@@ -48,8 +48,43 @@ Singleton {
] ]
}) })
// Cog options stored outside the module entry: a config path shared by every // Cog options stored outside the module entry: a config path shared by every
// layout (`setting`), or another module's enabled flag (`module`). // layout (`setting`), or another module's enabled flag (`module`). Every cog
// opens inline; these mirror the controls on the module's settings page.
readonly property var metricsOptions: [
{ key: "interval", setting: "metrics.interval", label: "Sampling interval", type: "integer", min: 1, max: 30, description: "Seconds between samples, shared by every metric" }
]
readonly property var gpuOption: ({ key: "gpu", setting: "metrics.gpu", label: "GPU", type: "choice",
choices: ["auto"].concat(MetricsService.gpus.map(g => g.id)),
choiceLabels: ["Automatic"].concat(MetricsService.gpus.map(g => g.name)) })
readonly property var sharedOptions: ({ readonly property var sharedOptions: ({
clock: [
{ key: "showDate", setting: "bar.clock.showDate", label: "Show date", type: "boolean" },
{ key: "use24Hour", setting: "bar.clock.use24Hour", label: "24-hour time", type: "boolean" },
{ key: "showSeconds", setting: "bar.clock.showSeconds", label: "Show seconds", type: "boolean" }
],
workspaces: [
{ key: "style", setting: "bar.workspaces.style", label: "Style", type: "choice", choices: ["numbers", "roman", "kanji", "dots", "pacman"] },
{ key: "preview", setting: "bar.workspaces.preview", label: "Preview on hover", type: "boolean" },
{ key: "count", setting: "bar.workspaces.count", label: "Count", type: "integer", min: 1, max: 20 }
],
tray: [
{ key: "background", setting: "tray.background", label: "Background", type: "choice", choices: ["pill", "transparent", "icons"] },
{ key: "hoverMenus", setting: "tray.hoverMenus", label: "Hover menus", type: "boolean", description: "Open application menus on hover" },
{ key: "iconSize", setting: "tray.iconSize", label: "Icon size", type: "integer", min: 16, max: 32 },
{ key: "spacing", setting: "tray.spacing", label: "Spacing", type: "integer", min: 0, max: 24 }
],
volume: [
{ key: "step", setting: "osd.step", label: "Step", type: "integer", min: 1, max: 20, description: "Percent per scroll or key press" }
],
cpu: metricsOptions,
cpuTemperature: metricsOptions,
ram: metricsOptions,
storage: metricsOptions,
gpu: metricsOptions.concat([gpuOption]),
gpuTemperature: metricsOptions.concat([gpuOption]),
networkThroughput: metricsOptions.concat([{ key: "networkInterface", setting: "metrics.networkInterface", label: "Interface", type: "choice",
description: "Auto totals physical interfaces to avoid counting VPN/bridge traffic twice",
choices: Array.from(new Set(["auto", ConfigService.ready ? ConfigService.data.metrics.networkInterface : "auto"].concat((MetricsService.network.interfaces || []).map(i => i.name)))) }]),
nowPlaying: [ nowPlaying: [
{ key: "visualizer", module: "cava", label: "Visualizer", type: "boolean", description: "Cava bars beside the track; shows system audio and only runs while something plays" }, { key: "visualizer", module: "cava", label: "Visualizer", type: "boolean", description: "Cava bars beside the track; shows system audio and only runs while something plays" },
{ key: "cavaBars", setting: "bar.cava.bars", label: "Visualizer bars", type: "integer", min: 4, max: 24 }, { key: "cavaBars", setting: "bar.cava.bars", label: "Visualizer bars", type: "integer", min: 4, max: 24 },
@@ -62,20 +97,17 @@ Singleton {
{ key: "cavaHide", setting: "bar.cava.hideWhenIdle", label: "Hide while paused", type: "boolean" } { key: "cavaHide", setting: "bar.cava.hideWhenIdle", label: "Hide while paused", type: "boolean" }
] ]
}) })
// Modules whose options already live on a settings page: the cog jumps there. // Modules with more on a settings page than fits the cog: the open cog
readonly property var settingsLinks: ({ // ends with a link there.
clock: { page: "bar", setting: "Show date" }, readonly property var moreSettings: ({
workspaces: { page: "bar", setting: "Workspace style" }, volume: { page: "osd", title: "OSD" },
tray: { page: "tray", setting: "" }, cpu: { page: "metrics", title: "Metrics" },
volume: { page: "osd", setting: "Step" }, cpuTemperature: { page: "metrics", title: "Metrics" },
system: { page: "controlcenter", setting: "" }, gpu: { page: "metrics", title: "Metrics" },
cpu: { page: "metrics", setting: "" }, gpuTemperature: { page: "metrics", title: "Metrics" },
cpuTemperature: { page: "metrics", setting: "" }, ram: { page: "metrics", title: "Metrics" },
gpu: { page: "metrics", setting: "" }, storage: { page: "metrics", title: "Metrics" },
gpuTemperature: { page: "metrics", setting: "" }, networkThroughput: { page: "metrics", title: "Metrics" }
ram: { page: "metrics", setting: "" },
storage: { page: "metrics", setting: "" },
networkThroughput: { page: "metrics", setting: "" }
}) })
function option(entry, key) { function option(entry, key) {
const schema = (optionSchemas[entry.id] || []).find(o => o.key === key); const schema = (optionSchemas[entry.id] || []).find(o => o.key === key);
+22 -8
View File
@@ -107,7 +107,7 @@ Item {
id:card id:card
required property var modelData required property var modelData
readonly property var schema:root.fieldsFor(modelData.id) readonly property var schema:root.fieldsFor(modelData.id)
readonly property var link:ModuleRegistry.settingsLinks[modelData.id] || null readonly property var link:ModuleRegistry.moreSettings[modelData.id] || null
readonly property bool expanded:root.expandedId===modelData.id && schema.length>0 readonly property bool expanded:root.expandedId===modelData.id && schema.length>0
Layout.fillWidth:true Layout.fillWidth:true
implicitHeight:52+(expanded ? optionsColumn.implicitHeight+4 : 0) implicitHeight:52+(expanded ? optionsColumn.implicitHeight+4 : 0)
@@ -153,10 +153,10 @@ Item {
} }
} }
Text {text:ModuleRegistry.title(card.modelData.id);color:Theme.text;Layout.fillWidth:true;elide:Text.ElideRight;font.pixelSize:12} Text {text:ModuleRegistry.title(card.modelData.id);color:Theme.text;Layout.fillWidth:true;elide:Text.ElideRight;font.pixelSize:12}
// Cog: module options inline, or the page that holds them. // Cog: the module's options, always inline.
Rectangle { Rectangle {
objectName:"bar-options-"+card.modelData.id objectName:"bar-options-"+card.modelData.id
visible:card.schema.length>0 || !!card.link visible:card.schema.length>0
implicitWidth:26;implicitHeight:26;radius:13 implicitWidth:26;implicitHeight:26;radius:13
color:card.expanded ? Qt.alpha(Theme.accent,0.3) : cogArea.containsMouse ? Theme.hover : Qt.alpha(Theme.text,0.06) color:card.expanded ? Qt.alpha(Theme.accent,0.3) : cogArea.containsMouse ? Theme.hover : Qt.alpha(Theme.text,0.06)
Accessible.name:"Options for "+card.modelData.id Accessible.name:"Options for "+card.modelData.id
@@ -167,10 +167,7 @@ Item {
anchors.fill:parent anchors.fill:parent
hoverEnabled:true hoverEnabled:true
cursorShape:Qt.PointingHandCursor cursorShape:Qt.PointingHandCursor
onClicked:{ onClicked:root.expandedId=card.expanded ? "" : card.modelData.id
if(card.schema.length>0)root.expandedId=card.expanded ? "" : card.modelData.id;
else if(card.link)ShellState.revealSetting(card.link.page,card.link.setting);
}
} }
} }
GlassToggle {objectName:"bar-enable-"+card.modelData.id;checked:card.modelData.enabled;onToggled:root.save(Logic.editModule(root.modules,card.modelData.id,"enabled",checked))} GlassToggle {objectName:"bar-enable-"+card.modelData.id;checked:card.modelData.enabled;onToggled:root.save(Logic.editModule(root.modules,card.modelData.id,"enabled",checked))}
@@ -218,7 +215,7 @@ Item {
visible:optionRow.modelData.type==="choice" visible:optionRow.modelData.type==="choice"
Layout.preferredWidth:110 Layout.preferredWidth:110
implicitHeight:30 implicitHeight:30
model:optionRow.modelData.choices.map(c=>({text:String(c).charAt(0).toUpperCase()+String(c).slice(1),value:c})) model:optionRow.modelData.choices.map((c,i)=>({text:optionRow.modelData.choiceLabels ? optionRow.modelData.choiceLabels[i] : String(c).charAt(0).toUpperCase()+String(c).slice(1),value:c}))
textRole:"text" textRole:"text"
valueRole:"value" valueRole:"value"
currentIndex:optionRow.modelData.choices.indexOf(optionRow.value) currentIndex:optionRow.modelData.choices.indexOf(optionRow.value)
@@ -254,6 +251,23 @@ Item {
} }
} }
} }
// The rest of the module's settings, on their page.
Text {
objectName:"bar-more-"+card.modelData.id
visible:!!card.link
text:card.link ? "All "+card.link.title+" settings →" : ""
color:moreArea.containsMouse ? Theme.text : Theme.accent
font.pixelSize:11
Layout.topMargin:2
Layout.bottomMargin:4
MouseArea {
id:moreArea
anchors.fill:parent
hoverEnabled:true
cursorShape:Qt.PointingHandCursor
onClicked:ShellState.revealSetting(card.link.page,"")
}
}
} }
} }
} }