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" import "../../theme"
// Cava audio visualizer in the bar. Click opens the dashboard's Media tab, // 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 { GlassPill {
id: root id: root
objectName: "cavaPill" objectName: "cavaPill"
@@ -76,7 +76,7 @@ GlassPill {
} }
TapHandler { TapHandler {
acceptedButtons: Qt.RightButton acceptedButtons: Qt.RightButton
onTapped: ShellState.openSettings("media") onTapped: ShellState.openSettings("bar")
} }
HoverHandler { HoverHandler {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
+15 -2
View File
@@ -47,12 +47,25 @@ Singleton {
{ key: "preview", label: "Hover preview", choices: ["on", "off"], fallback: "on" } { 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. // Modules whose options already live on a settings page: the cog jumps there.
readonly property var settingsLinks: ({ readonly property var settingsLinks: ({
clock: { page: "bar", setting: "Show date" }, clock: { page: "bar", setting: "Show date" },
workspaces: { page: "bar", setting: "Workspace style" }, workspaces: { page: "bar", setting: "Workspace style" },
cava: { page: "media", setting: "Visualizer bars" },
nowPlaying: { page: "media", setting: "Now playing" },
tray: { page: "tray", setting: "" }, tray: { page: "tray", setting: "" },
volume: { page: "osd", setting: "Step" }, volume: { page: "osd", setting: "Step" },
system: { page: "controlcenter", setting: "" }, system: { page: "controlcenter", setting: "" },
+3 -1
View File
@@ -39,6 +39,8 @@ Singleton {
id: "wallpaper", id: "wallpaper",
title: "Wallpaper", title: "Wallpaper",
command: "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", description: "Wallpaper picker and palette generation",
phase: 5, phase: 5,
available: true, available: true,
@@ -154,7 +156,7 @@ Singleton {
available: true, available: true,
group: "shell", group: "shell",
icon: "󰝚", 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", id: "metrics",
+2 -1
View File
@@ -11,7 +11,8 @@ Singleton {
title: page.title, title: page.title,
description: page.description, description: page.description,
page: page.id, page: page.id,
available: page.available available: page.available,
run: page.launcherAction ? () => ShellState[page.launcherAction]() : undefined
})).concat(extensions) })).concat(extensions)
// Extensions are registered by trusted QML code, never interpreted from search text. // Extensions are registered by trusted QML code, never interpreted from search text.
function registerCommand(command) { function registerCommand(command) {
+18 -1
View File
@@ -23,18 +23,35 @@ Item {
// manifest schema (boolean / integer / number / string / choices). // manifest schema (boolean / integer / number / string / choices).
function fieldsFor(id) { function fieldsFor(id) {
if (!ModuleRegistry.isPlugin(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 => { 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; 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 || []}); return Object.assign({}, f, {label: f.label || f.key, type: choices ? "choice" : (f.type || "string"), choices: choices || []});
}); });
} }
function valueOf(entry, field) { 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)) if (!ModuleRegistry.isPlugin(entry.id))
return ModuleRegistry.option(entry, field.key); return ModuleRegistry.option(entry, field.key);
return PluginService.widgetSettings(String(entry.id).slice(7), entry.options)[field.key]; return PluginService.widgetSettings(String(entry.id).slice(7), entry.options)[field.key];
} }
function setOption(entry, key, value) { 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}))); root.save(Logic.editModule(root.modules, entry.id, "options", Object.assign({}, entry.options || {}, {[key]: value})));
} }
readonly property var modules: BarLayout.modulesFor(screenName) readonly property var modules: BarLayout.modulesFor(screenName)
-65
View File
@@ -4,27 +4,9 @@ import "../controls"
import "../../components" import "../../components"
import "../../services" import "../../services"
import "../../media" import "../../media"
import "../../services/SettingsLogic.js" as Logic
SettingsPage { SettingsPage {
id: root 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 { SettingsSection {
description: "Shared playback controls for all compatible MPRIS players." description: "Shared playback controls for all compatible MPRIS players."
padded: true padded: true
@@ -33,53 +15,6 @@ SettingsPage {
Layout.fillWidth: true 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 { SettingsSection {
title: "Media cards" title: "Media cards"
description: "The player in the Control Center, dashboard and this page" description: "The player in the Control Center, dashboard and this page"
+1
View File
@@ -120,6 +120,7 @@ ShellRoot {
settingsOpen: ShellState.settingsOpen, settingsOpen: ShellState.settingsOpen,
settingsPage: ShellState.settingsPage, settingsPage: ShellState.settingsPage,
launcherOpen: ShellState.launcherOpen, launcherOpen: ShellState.launcherOpen,
wallpaperPickerOpen: ShellState.wallpaperPickerOpen,
accentSource: ConfigService.ready ? ConfigService.data.appearance.accentSource : "loading" 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"); const view=input.findChild(ShellState.wallpaperWindow.contentItem,"wallpaperCarousel");
view.positionViewAtIndex(index,ListView.Contain);input.wait(50); view.positionViewAtIndex(index,ListView.Contain);input.wait(50);
const item=view.itemAtIndex(index);if(!item)return false; 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 pickerScreenshot(path: string): bool {return input.findChild(ShellState.wallpaperWindow.contentItem,"wallpaperPickerSurface").grabToImage(result=>result.saveToFile(path));}
function geometry(name: string): string { 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) 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} 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} 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…":"Click or ← → and Enter to apply · Esc Close");color:WallpaperService.error?Theme.urgent:Theme.textSecondary;Layout.fillWidth:true;wrapMode:Text.Wrap}
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()}
}
} }
} }
} }
+5 -1
View File
@@ -114,13 +114,17 @@ Terminal={'true' if suffix=='Terminal' else 'false'}
open_launcher();query('>') open_launcher();query('>')
eventually(lambda:{r['id'] for r in snapshot()['results']}=={'about','appearance','audio','bar','tray','bluetooth','controlcenter','display','dock','launcher','media','metrics','network','notifications','power','wallpaper','widgets','osd','lock','dashboard','plugins'},'all commands registered') eventually(lambda:{r['id'] for r in snapshot()['results']}=={'about','appearance','audio','bar','tray','bluetooth','controlcenter','display','dock','launcher','media','metrics','network','notifications','power','wallpaper','widgets','osd','lock','dashboard','plugins'},'all commands registered')
time.sleep(.3);assert ipc('launcherTest','screenshot',str(ROOT/'.cache/launcher-preview.png')) time.sleep(.3);assert ipc('launcherTest','screenshot',str(ROOT/'.cache/launcher-preview.png'))
for text,page in [('>metrics','metrics'),('>wall','wallpaper'),('>dock','dock'),('>media','media'),('>tray','tray'),('>display','displays'),('>launcher','launcher'),('>appearance','appearance'),('>bar','bar'),('>network','network'),('>bluetooth','bluetooth'),('>audio','audio'),('>controlcenter','controlcenter'),('>notifications','notifications'),('>power','power'),('>about','about')]: for text,page in [('>metrics','metrics'),('>dock','dock'),('>media','media'),('>tray','tray'),('>display','displays'),('>launcher','launcher'),('>appearance','appearance'),('>bar','bar'),('>network','network'),('>bluetooth','bluetooth'),('>audio','audio'),('>controlcenter','controlcenter'),('>notifications','notifications'),('>power','power'),('>about','about')]:
query(text) query(text)
ipc('launcherTest','key',ENTER) ipc('launcherTest','key',ENTER)
eventually(lambda:ipc('shell','status')['settingsOpen'] and ipc('shell','status')['settingsPage']==page,'command destination '+page) eventually(lambda:ipc('shell','status')['settingsOpen'] and ipc('shell','status')['settingsPage']==page,'command destination '+page)
assert not snapshot()['opened'] assert not snapshot()['opened']
open_launcher() open_launcher()
assert not ipc('shell','status')['settingsOpen'] assert not ipc('shell','status')['settingsOpen']
# >wallpaper opens the picker, not its settings page.
query('>wall');ipc('launcherTest','key',ENTER)
eventually(lambda:ipc('shell','status')['wallpaperPickerOpen'] and not ipc('shell','status')['settingsOpen'],'wallpaper command opens picker')
ipc('shell','close');open_launcher()
query('>command-that-does-not-exist') query('>command-that-does-not-exist')
assert not snapshot()['results'] assert not snapshot()['results']
ipc('launcherTest','key',ENTER);assert snapshot()['opened'] ipc('launcherTest','key',ENTER);assert snapshot()['opened']