Show Omarchy plugin settings on the Plugins page
Omarchy plugins with a manifest schema get a Settings button like Noctalia ones: a full form (label, description, control) that edits the same bar.modules options as the bar cog and applies as you go. A plugin not in the bar keeps its options on a switched-off entry, which Add to bar turns on. `plugins settings <id>` over IPC opens it, scrolled into view. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
660fa69be6
commit
3f0e31b116
3 files changed
+198
-7
No files matched your search
@@ -21,6 +21,23 @@ SettingsPage {
|
||||
onTabChanged: if (tab === "browse" && PluginService.market.items.length === 0)
|
||||
PluginService.browse(false)
|
||||
Component.onCompleted: PluginService.refresh()
|
||||
// Scroll a plugin row to the top once the page has laid out.
|
||||
function reveal(item) {
|
||||
revealTimer.item = item;
|
||||
revealTimer.restart();
|
||||
}
|
||||
Timer {
|
||||
id: revealTimer
|
||||
property Item item: null
|
||||
interval: 120
|
||||
onTriggered: {
|
||||
const flick = root.contentItem;
|
||||
if (!item || !flick || flick.contentY === undefined)
|
||||
return;
|
||||
const y = item.mapToItem(flick.contentItem, 0, 0).y;
|
||||
flick.contentY = Math.max(0, Math.min(y - 12, flick.contentHeight - flick.height));
|
||||
}
|
||||
}
|
||||
readonly property var capabilityLabels: ({
|
||||
"privilege": "Uses sudo",
|
||||
"package-manager": "Installs packages",
|
||||
@@ -111,7 +128,7 @@ SettingsPage {
|
||||
SettingsSection {
|
||||
visible: root.tab === "installed"
|
||||
title: "Installed"
|
||||
description: PluginService.plugins.length ? "Turn a plugin on to load it. Bar widgets then appear under Bar → Modules (and can go on a single screen); their options are on the module's cog." : ""
|
||||
description: PluginService.plugins.length ? "Turn a plugin on to load it. Bar widgets then appear under Bar → Modules (and can go on a single screen); their options are under Settings here and on the module's cog." : ""
|
||||
Text {
|
||||
visible: PluginService.loaded && PluginService.plugins.length === 0
|
||||
Layout.fillWidth: true
|
||||
@@ -127,7 +144,9 @@ SettingsPage {
|
||||
required property var modelData
|
||||
readonly property var manifest: modelData.manifest || {}
|
||||
readonly property bool enabledNow: PluginService.isEnabled(modelData.id)
|
||||
readonly property bool inBar: ConfigService.data.bar.modules.some(m => m.id === "plugin:" + modelData.id)
|
||||
readonly property bool inBar: ConfigService.data.bar.modules.some(m => m.id === "plugin:" + modelData.id && m.enabled !== false)
|
||||
// Omarchy plugins: a form from their manifest schema (Noctalia ones bring Settings.qml).
|
||||
readonly property bool schemaSettings: modelData.ecosystem !== "noctalia" && PluginService.schema(modelData.id).length > 0
|
||||
objectName: "plugin-" + modelData.id
|
||||
title: manifest.name || modelData.id
|
||||
description: [manifest.description || "", [manifest.version ? "v" + manifest.version : "", manifest.author || ""].filter(x => x).join(" · ")].filter(x => x).join("\n")
|
||||
@@ -140,7 +159,7 @@ SettingsPage {
|
||||
}
|
||||
GlassButton {
|
||||
objectName: "plugin-settings-" + row.modelData.id
|
||||
visible: row.enabledNow && (row.modelData.kinds || []).includes("settings")
|
||||
visible: row.enabledNow && ((row.modelData.kinds || []).includes("settings") || row.schemaSettings)
|
||||
text: root.openSettings === row.modelData.id ? "Close settings" : "Settings"
|
||||
accented: root.openSettings === row.modelData.id
|
||||
onClicked: root.openSettings = root.openSettings === row.modelData.id ? "" : row.modelData.id
|
||||
@@ -233,11 +252,17 @@ SettingsPage {
|
||||
}
|
||||
}
|
||||
// The plugin's own settings screen (Noctalia Settings.qml), with
|
||||
// its pluginApi; Save calls the plugin's saveSettings().
|
||||
// its pluginApi; Save calls the plugin's saveSettings(). Omarchy
|
||||
// plugins get a form from their schema that applies as you edit.
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
visible: root.openSettings === row.modelData.id
|
||||
implicitHeight: visible ? settingsColumn.implicitHeight + 24 : 0
|
||||
// Bring the plugin and its settings into view once laid out.
|
||||
onVisibleChanged: if (visible)
|
||||
root.reveal(row)
|
||||
Component.onCompleted: if (visible)
|
||||
root.reveal(row)
|
||||
radius: 12
|
||||
color: Theme.fill
|
||||
border.width: 1
|
||||
@@ -249,10 +274,15 @@ SettingsPage {
|
||||
anchors.top: parent.top
|
||||
anchors.margins: 12
|
||||
spacing: 10
|
||||
PluginOptions {
|
||||
Layout.fillWidth: true
|
||||
visible: row.schemaSettings
|
||||
pluginId: row.modelData.id
|
||||
}
|
||||
Loader {
|
||||
id: pluginSettings
|
||||
Layout.fillWidth: true
|
||||
active: root.openSettings === row.modelData.id
|
||||
active: !row.schemaSettings && root.openSettings === row.modelData.id
|
||||
onActiveChanged: if (active)
|
||||
setSource(row.modelData.entryUrls.settings, {
|
||||
pluginApi: PluginService.noctaliaApi(row.modelData.id)
|
||||
@@ -264,10 +294,18 @@ SettingsPage {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
GlassButton {
|
||||
visible: row.schemaSettings
|
||||
text: "Done"
|
||||
accented: true
|
||||
onClicked: root.openSettings = ""
|
||||
}
|
||||
GlassButton {
|
||||
visible: !row.schemaSettings
|
||||
text: "Cancel"
|
||||
onClicked: root.openSettings = ""
|
||||
}
|
||||
GlassButton {
|
||||
visible: !row.schemaSettings
|
||||
objectName: "plugin-settings-save-" + row.modelData.id
|
||||
text: "Save"
|
||||
accented: true
|
||||
|
||||
Reference in new issue
Block a user