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:
1 parent
e71ce9c0a4
commit
2e80ef1181
10 files changed
+49
-79
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user