Open wallpaper picker from launcher, apply on click, move media bar options to module cog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-10-13 15:30:17 +02:00
1 parent e71ce9c0a4
commit 2e80ef1181
10 files changed
+49 -79

No files matched your search

+2 -2
View File
@@ -6,7 +6,7 @@ import "../../services"
import "../../theme"
// Cava audio visualizer in the bar. Click opens the dashboard's Media tab,
// right-click the Media settings. Cava only runs while something plays.
// right-click the Bar settings (its options sit on the module cog). Cava only runs while something plays.
GlassPill {
id: root
objectName: "cavaPill"
@@ -76,7 +76,7 @@ GlassPill {
}
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: ShellState.openSettings("media")
onTapped: ShellState.openSettings("bar")
}
HoverHandler {
cursorShape: Qt.PointingHandCursor
+15 -2
View File
@@ -47,12 +47,25 @@ Singleton {
{ key: "preview", label: "Hover preview", choices: ["on", "off"], fallback: "on" }
]
})
// Cog options stored outside the module entry: a config path shared by every
// layout (`setting`), or another module's enabled flag (`module`).
readonly property var sharedOptions: ({
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: "cavaBars", setting: "bar.cava.bars", label: "Visualizer bars", type: "integer", min: 4, max: 24 },
{ key: "cavaStyle", setting: "bar.cava.style", label: "Visualizer style", type: "choice", choices: ["bars", "mirror"] },
{ key: "cavaHide", setting: "bar.cava.hideWhenIdle", label: "Hide while paused", type: "boolean" }
],
cava: [
{ key: "cavaBars", setting: "bar.cava.bars", label: "Bars", type: "integer", min: 4, max: 24 },
{ key: "cavaStyle", setting: "bar.cava.style", label: "Style", type: "choice", choices: ["bars", "mirror"] },
{ 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.
readonly property var settingsLinks: ({
clock: { page: "bar", setting: "Show date" },
workspaces: { page: "bar", setting: "Workspace style" },
cava: { page: "media", setting: "Visualizer bars" },
nowPlaying: { page: "media", setting: "Now playing" },
tray: { page: "tray", setting: "" },
volume: { page: "osd", setting: "Step" },
system: { page: "controlcenter", setting: "" },
+3 -1
View File
@@ -39,6 +39,8 @@ Singleton {
id: "wallpaper",
title: "Wallpaper",
command: "wallpaper",
// The launcher command opens the picker itself; the page stays reachable from its cog.
launcherAction: "openWallpaperPicker",
description: "Wallpaper picker and palette generation",
phase: 5,
available: true,
@@ -154,7 +156,7 @@ Singleton {
available: true,
group: "shell",
icon: "󰝚",
keywords: ["Now playing", "Visualizer", "Cava", "Visualizer bars", "Visualizer style", "Hide while paused", "Album artwork", "Track progress", "Album name", "Visualizer in cards", "Preferred player"]
keywords: ["Album artwork", "Track progress", "Album name", "Visualizer in cards", "Preferred player"]
},
{
id: "metrics",
+2 -1
View File
@@ -11,7 +11,8 @@ Singleton {
title: page.title,
description: page.description,
page: page.id,
available: page.available
available: page.available,
run: page.launcherAction ? () => ShellState[page.launcherAction]() : undefined
})).concat(extensions)
// Extensions are registered by trusted QML code, never interpreted from search text.
function registerCommand(command) {
+18 -1
View File
@@ -23,18 +23,35 @@ Item {
// manifest schema (boolean / integer / number / string / choices).
function fieldsFor(id) {
if (!ModuleRegistry.isPlugin(id))
return (ModuleRegistry.optionSchemas[id] || []).map(f => Object.assign({type:"choice"}, f));
return (ModuleRegistry.optionSchemas[id] || []).map(f => Object.assign({type:"choice"}, f)).concat(ModuleRegistry.sharedOptions[id] || []);
return PluginService.schema(String(id).slice(7)).filter(f => f && f.key).map(f => {
const choices = Array.isArray(f.choices) ? f.choices : Array.isArray(f.options) ? f.options.map(o => typeof o === "object" ? o.value : o) : null;
return Object.assign({}, f, {label: f.label || f.key, type: choices ? "choice" : (f.type || "string"), choices: choices || []});
});
}
function valueOf(entry, field) {
if (field.setting)
return ConfigService.value(field.setting);
if (field.module)
return root.modules.some(m => m.id === field.module && m.enabled);
if (!ModuleRegistry.isPlugin(entry.id))
return ModuleRegistry.option(entry, field.key);
return PluginService.widgetSettings(String(entry.id).slice(7), entry.options)[field.key];
}
function setOption(entry, key, value) {
const field = root.fieldsFor(entry.id).find(f => f.key === key) || {};
if (field.setting)
return ConfigService.setValue(field.setting, value);
if (field.module) {
// Toggle the companion module, adding it right after this one the first time.
if (root.modules.some(m => m.id === field.module))
return root.save(Logic.editModule(root.modules, field.module, "enabled", value));
if (!value)
return;
const list = root.modules.slice();
list.splice(list.findIndex(m => m.id === entry.id) + 1, 0, {id: field.module, position: entry.position, enabled: true});
return root.save(list);
}
root.save(Logic.editModule(root.modules, entry.id, "options", Object.assign({}, entry.options || {}, {[key]: value})));
}
readonly property var modules: BarLayout.modulesFor(screenName)
-65
View File
@@ -4,27 +4,9 @@ import "../controls"
import "../../components"
import "../../services"
import "../../media"
import "../../services/SettingsLogic.js" as Logic
SettingsPage {
id: root
function moduleOn(id) {
return ConfigService.data.bar.modules.some(m => m.id === id && m.enabled);
}
// Adds the module to the centre lane the first time, then just toggles it.
function setModule(id, on) {
const modules = ConfigService.data.bar.modules;
if (modules.some(m => m.id === id))
ConfigService.setValue("bar.modules", Logic.editModule(modules, id, "enabled", on));
else if (on)
ConfigService.setValue("bar.modules", modules.concat([
{
id: id,
position: "center",
enabled: true
}
]));
}
SettingsSection {
description: "Shared playback controls for all compatible MPRIS players."
padded: true
@@ -33,53 +15,6 @@ SettingsPage {
Layout.fillWidth: true
}
}
SettingsSection {
title: "Bar"
description: "Playback and an audio visualizer in the bar. Cava shows system audio, not only the selected player, and only runs while something plays."
SettingRow {
title: "Now playing"
description: "Play/pause and the current track"
icon: "󰎈"
GlassToggle {
objectName: "mediaBarNowPlaying"
checked: root.moduleOn("nowPlaying")
onToggled: root.setModule("nowPlaying", checked)
}
}
SettingRow {
title: "Visualizer"
description: CavaService.error ? "Cava: " + CavaService.error : "Cava bars; click opens the dashboard's Media tab"
icon: "󰺢"
GlassToggle {
objectName: "mediaBarCava"
checked: root.moduleOn("cava")
onToggled: root.setModule("cava", checked)
}
}
PreferenceSlider {
label: "Visualizer bars"
icon: "󰐕"
setting: "bar.cava.bars"
from: 4
to: 24
step: 1
enabled: root.moduleOn("cava")
}
PreferenceChoice {
label: "Visualizer style"
icon: "󰺢"
setting: "bar.cava.style"
choices: ["bars", "mirror"]
enabled: root.moduleOn("cava")
}
PreferenceToggle {
label: "Hide while paused"
description: "Collapse the visualizer when nothing is playing"
icon: "󰏤"
setting: "bar.cava.hideWhenIdle"
enabled: root.moduleOn("cava")
}
}
SettingsSection {
title: "Media cards"
description: "The player in the Control Center, dashboard and this page"
+1
View File
@@ -120,6 +120,7 @@ ShellRoot {
settingsOpen: ShellState.settingsOpen,
settingsPage: ShellState.settingsPage,
launcherOpen: ShellState.launcherOpen,
wallpaperPickerOpen: ShellState.wallpaperPickerOpen,
accentSource: ConfigService.ready ? ConfigService.data.appearance.accentSource : "loading"
});
}
+1 -1
View File
@@ -119,7 +119,7 @@ Item {
const view=input.findChild(ShellState.wallpaperWindow.contentItem,"wallpaperCarousel");
view.positionViewAtIndex(index,ListView.Contain);input.wait(50);
const item=view.itemAtIndex(index);if(!item)return false;
input.mouseClick(item,item.width/2,item.height/2);input.keyClick(Qt.Key_Return);return true;
input.mouseClick(item,item.width/2,item.height/2);return true;
}
function pickerScreenshot(path: string): bool {return input.findChild(ShellState.wallpaperWindow.contentItem,"wallpaperPickerSurface").grabToImage(result=>result.saveToFile(path));}
function geometry(name: string): string {
+2 -5
View File
@@ -103,14 +103,11 @@ PanelWindow {
Rectangle {anchors.bottom:parent.bottom;anchors.left:parent.left;anchors.right:parent.right;anchors.margins:6;height:42;color:Qt.alpha(Theme.surface,0.85)
Text {anchors.fill:parent;anchors.margins:10;text:(WallpaperService.currentPath===tile.modelData.path?"✓ ":"")+tile.modelData.name;color:Theme.text;elide:Text.ElideMiddle}
}
MouseArea {anchors.fill:parent;onClicked:{view.currentIndex=tile.index;view.forceActiveFocus();}onDoubleClicked:WallpaperService.apply(tile.modelData.path)}
MouseArea {anchors.fill:parent;onClicked:{view.currentIndex=tile.index;view.forceActiveFocus();WallpaperService.apply(tile.modelData.path);}}
}
}
Text {visible:!root.results.length;text:WallpaperService.scanning ? "Loading wallpapers…" : "No wallpapers here. Choose a folder in Wallpaper settings.";color:Theme.textSecondary;Layout.fillWidth:true;wrapMode:Text.Wrap}
RowLayout {
Text {text:WallpaperService.error || (WallpaperService.busy?"Applying wallpaper…":"← → Browse · Enter or double-click to apply · Esc Close");color:WallpaperService.error?Theme.urgent:Theme.textSecondary;Layout.fillWidth:true;wrapMode:Text.Wrap}
GlassButton {objectName:"pickerApply";text:"Apply wallpaper";accented:true;enabled:root.results.length>0 && !WallpaperService.busy;onClicked:root.applyCurrent()}
}
Text {text:WallpaperService.error || (WallpaperService.busy?"Applying wallpaper…":"Click or ← → and Enter to apply · Esc Close");color:WallpaperService.error?Theme.urgent:Theme.textSecondary;Layout.fillWidth:true;wrapMode:Text.Wrap}
}
}
}