Files
glassMxrph/quickshell/settings/pages/Plugins.qml
T
mxandClaude Opus 5.5 99e64a7713 Add glassMxrph shell sources
Initial commit of the Quickshell desktop suite: bar, dock, launcher,
settings, Control Center, dashboard, OSD, lock screen, desktop widgets,
plugin host with the vendored Noctalia/Omarchy compatibility layer,
helpers, packaging, tests and phase documentation.

Includes the optimization work so far: usage widgets and dashboard
gauges no longer animate continuously, desktop widgets pause while
covered, system controls stop flickering on background polls, dock app
matching uses an indexed catalog, and workspace ghosts are created only
for occupied slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:36:17 +02:00

561 lines
28 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import "../controls"
import "../../components"
import "../../services"
import "../../theme"
SettingsPage {
id: root
// Plugin awaiting removal confirmation.
property string confirmRemove: ""
// Marketplace listing awaiting install confirmation.
property string confirmInstall: ""
// Plugin whose own settings screen is open (Noctalia Settings.qml);
// "open plugin settings" from a plugin sets it.
property string openSettings: PluginService.focusedSettings
onOpenSettingsChanged: if (openSettings)
tab = "installed"
property string tab: "installed"
onTabChanged: if (tab === "browse" && PluginService.market.items.length === 0)
PluginService.browse(false)
Component.onCompleted: PluginService.refresh()
readonly property var capabilityLabels: ({
"privilege": "Uses sudo",
"package-manager": "Installs packages",
"service-management": "Manages services",
"installer": "Runs installers",
"network": "Uses the network",
"credentials": "Handles credentials",
"filesystem": "Writes files"
})
readonly property var accents: ({
"violet": "#8b5cf6",
"purple": "#a855f7",
"blue": "#3b82f6",
"sky": "#0ea5e9",
"cyan": "#06b6d4",
"teal": "#14b8a6",
"green": "#22c55e",
"lime": "#84cc16",
"yellow": "#eab308",
"amber": "#f59e0b",
"orange": "#f97316",
"red": "#ef4444",
"rose": "#f43f5e",
"pink": "#ec4899",
"slate": "#64748b"
})
SettingsSection {
title: "Plugins"
description: "Shell plugins from Omarchy (plugins.omarchy.org) and Noctalia v4. Their bar widgets sit in the bar like built-in modules and their panels open as bar drawers, styled by glassMxrph."
GlassSegmented {
objectName: "pluginTabs"
Layout.leftMargin: 14
Layout.bottomMargin: 4
model: ["installed", "browse"]
currentIndex: model.indexOf(root.tab)
onActivated: (index, value) => root.tab = value
}
SettingNote {
Layout.leftMargin: 0
text: "Plugins run inside the shell with your user's permissions, the same as in Omarchy and Noctalia: a plugin can read your files and run commands. Only install plugins from authors you trust, and use View source to check what one does."
}
}
SettingsSection {
visible: root.tab === "installed"
title: "Add a plugin"
description: "A git URL or a local folder holding an Omarchy or Noctalia v4 plugin. Repositories with several plugins install them all."
SettingRow {
title: "Source"
icon: "󰊢"
GlassTextField {
id: sourceField
objectName: "pluginSource"
Layout.preferredWidth: 300
placeholderText: "https://github.com/user/plugin"
onAccepted: installButton.clicked()
}
GlassButton {
id: installButton
objectName: "pluginInstall"
text: PluginService.busy ? "Installing…" : "Install"
accented: true
enabled: !PluginService.busy && sourceField.text.trim() !== ""
onClicked: PluginService.install(sourceField.text, "")
}
}
Text {
Layout.fillWidth: true
Layout.leftMargin: 14
Layout.bottomMargin: 8
visible: text !== ""
wrapMode: Text.Wrap
font.pixelSize: 12
color: PluginService.error ? Theme.urgent : Theme.textSecondary
text: {
if (PluginService.error)
return PluginService.error;
const r = PluginService.lastResult || {};
const parts = [];
if (r.installed && r.installed.length)
parts.push("Installed " + r.installed.join(", ") + ". Turn it on below.");
if (r.rejected && r.rejected.length)
parts.push("Skipped " + r.rejected.map(x => x.dir + " (" + x.problems.join("; ") + ")").join(", "));
return parts.join(" ");
}
}
}
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." : ""
Text {
visible: PluginService.loaded && PluginService.plugins.length === 0
Layout.fillWidth: true
Layout.margins: 14
text: "No plugins installed yet."
color: Theme.textSecondary
font.pixelSize: 12
}
Repeater {
model: PluginService.plugins
SettingRow {
id: row
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)
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")
icon: "󰐱"
GlassButton {
objectName: "plugin-add-" + row.modelData.id
visible: row.enabledNow && (row.manifest.kinds || []).includes("bar-widget") && !row.inBar
text: "Add to bar"
onClicked: PluginService.addToBar(row.modelData.id)
}
GlassButton {
objectName: "plugin-settings-" + row.modelData.id
visible: row.enabledNow && (row.modelData.kinds || []).includes("settings")
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
}
GlassButton {
objectName: "plugin-source-" + row.modelData.id
text: "View source"
onClicked: Qt.openUrlExternally(/^https?:\/\//.test(row.modelData.source) ? row.modelData.source : "file://" + row.modelData.dir)
}
GlassButton {
objectName: "plugin-remove-" + row.modelData.id
text: root.confirmRemove === row.modelData.id ? "Confirm remove" : "Remove"
accented: root.confirmRemove === row.modelData.id
onClicked: {
if (root.confirmRemove === row.modelData.id) {
root.confirmRemove = "";
PluginService.remove(row.modelData.id);
} else
root.confirmRemove = row.modelData.id;
}
}
GlassToggle {
objectName: "plugin-enable-" + row.modelData.id
checked: row.enabledNow
enabled: row.modelData.problems.length === 0
onToggled: PluginService.setEnabled(row.modelData.id, checked)
}
below: ColumnLayout {
Layout.fillWidth: true
spacing: 10
Flow {
Layout.fillWidth: true
spacing: 6
Repeater {
model: [
{
text: row.modelData.ecosystem === "noctalia" ? "Noctalia" : "Omarchy",
tone: "plain"
}
].concat((row.modelData.kinds || []).map(k => ({
text: k,
tone: "plain"
}))).concat(row.modelData.problems.map(p => ({
text: p,
tone: "bad"
}))).concat(row.modelData.unsupportedImports.map(i => ({
text: "Needs " + i + " (not supported)",
tone: "bad"
}))).concat((row.modelData.missingCommands || []).map(c => ({
text: "Missing " + c,
tone: "warn"
}))).concat(row.modelData.customColors > 0 ? [
{
text: "Custom colors · " + row.modelData.customColors,
tone: "warn"
}
] : []).concat(row.modelData.commit ? [
{
text: "Pinned " + row.modelData.commit.slice(0, 8),
tone: "plain"
}
] : [])
Rectangle {
id: badge
required property var modelData
implicitWidth: badgeText.implicitWidth + 16
implicitHeight: 22
radius: 11
color: badge.modelData.tone === "bad" ? Qt.alpha(Theme.urgent, 0.2) : badge.modelData.tone === "warn" ? Qt.alpha(Theme.urgent, 0.12) : Theme.fill
border.width: 1
border.color: Theme.hairline
Text {
id: badgeText
anchors.centerIn: parent
text: badge.modelData.text
color: badge.modelData.tone === "plain" ? Theme.textSecondary : Theme.urgent
font.pixelSize: 11
}
}
}
Text {
visible: !!row.modelData.source
text: row.modelData.source
color: Theme.textSecondary
font.pixelSize: 11
elide: Text.ElideMiddle
width: Math.min(implicitWidth, 360)
height: 22
verticalAlignment: Text.AlignVCenter
}
}
// The plugin's own settings screen (Noctalia Settings.qml), with
// its pluginApi; Save calls the plugin's saveSettings().
Rectangle {
Layout.fillWidth: true
visible: root.openSettings === row.modelData.id
implicitHeight: visible ? settingsColumn.implicitHeight + 24 : 0
radius: 12
color: Theme.fill
border.width: 1
border.color: Theme.hairline
ColumnLayout {
id: settingsColumn
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 12
spacing: 10
Loader {
id: pluginSettings
Layout.fillWidth: true
active: root.openSettings === row.modelData.id
onActiveChanged: if (active)
setSource(row.modelData.entryUrls.settings, {
pluginApi: PluginService.noctaliaApi(row.modelData.id)
})
}
RowLayout {
Layout.fillWidth: true
Item {
Layout.fillWidth: true
}
GlassButton {
text: "Cancel"
onClicked: root.openSettings = ""
}
GlassButton {
objectName: "plugin-settings-save-" + row.modelData.id
text: "Save"
accented: true
onClicked: {
PluginService.callIfPresent(pluginSettings.item, "saveSettings");
root.openSettings = "";
}
}
}
}
}
}
}
}
}
SettingNote {
visible: root.tab === "installed"
text: "Custom colors: the plugin draws some of its own colors, so those parts keep the plugin's look instead of your theme. Everything drawn with the plugin toolkit (buttons, toggles, panels, tooltips) uses the glassMxrph style."
}
SettingsSection {
visible: root.tab === "browse"
title: PluginService.marketSource === "noctalia" ? "Noctalia plugins" : "plugins.omarchy.org"
description: !PluginService.market.total ? "Community plugins." : PluginService.marketSource === "noctalia" ? PluginService.market.total + " Noctalia v4 plugins, run through glassMxrph's compatibility layer: most bar widgets, panels and settings work; some plugins rely on Noctalia parts glassMxrph does not have (the Installed tab lists them)." : PluginService.market.total + " plugins. Installs use the commit the marketplace last validated. Verified means the marketplace's automated review passed at that commit."
GlassSegmented {
objectName: "marketSource"
Layout.leftMargin: 12
Layout.topMargin: 6
model: ["omarchy", "noctalia"]
currentIndex: model.indexOf(PluginService.marketSource)
onActivated: (index, value) => PluginService.marketSource = value
}
RowLayout {
Layout.fillWidth: true
Layout.margins: 12
spacing: 8
GlassTextField {
objectName: "marketSearch"
Layout.fillWidth: true
placeholderText: "Search plugins"
text: PluginService.marketQuery
onTextChanged: PluginService.marketQuery = text
}
GlassComboBox {
objectName: "marketCategory"
Layout.preferredWidth: 160
model: ["all"].concat(PluginService.market.categories || [])
displayText: currentText === "all" ? "All categories" : currentText
currentIndex: Math.max(0, model.indexOf(PluginService.marketCategory))
onActivated: PluginService.marketCategory = currentText
}
}
RowLayout {
Layout.fillWidth: true
Layout.leftMargin: 12
Layout.rightMargin: 12
Layout.bottomMargin: 10
spacing: 10
GlassSegmented {
objectName: "marketSort"
model: ["popular", "recent", "name"]
currentIndex: model.indexOf(PluginService.marketSort)
onActivated: (index, value) => PluginService.marketSort = value
}
Item {
Layout.fillWidth: true
}
Text {
text: "Verified only"
color: Theme.text
font.pixelSize: 12
}
GlassToggle {
objectName: "marketVerified"
checked: PluginService.marketVerifiedOnly
onToggled: PluginService.marketVerifiedOnly = checked
}
}
}
SettingsSection {
visible: root.tab === "browse"
Text {
Layout.fillWidth: true
Layout.margins: 14
visible: text !== ""
wrapMode: Text.Wrap
font.pixelSize: 12
color: PluginService.marketError || PluginService.error ? Theme.urgent : Theme.textSecondary
text: PluginService.error || PluginService.marketError || ((PluginService.lastResult.installed || []).length ? "Installed " + PluginService.lastResult.installed.join(", ") + ". Turn it on under Installed." : "") || (PluginService.marketBusy && PluginService.market.items.length === 0 ? "Loading the plugin catalog…" : PluginService.market.total === 0 && !PluginService.marketBusy ? "No plugins match." : "")
}
Repeater {
model: PluginService.market.items
Item {
id: listing
required property var modelData
readonly property bool installed: PluginService.isInstalled(modelData.id)
readonly property bool confirming: root.confirmInstall === modelData.id
readonly property bool usable: modelData.installable && modelData.support !== "unsupported"
objectName: "listing-" + modelData.id
Layout.fillWidth: true
implicitHeight: card.implicitHeight + 16
ColumnLayout {
id: card
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 12
spacing: 6
RowLayout {
Layout.fillWidth: true
spacing: 12
Rectangle {
Layout.alignment: Qt.AlignTop
implicitWidth: 40
implicitHeight: 40
radius: 12
color: Qt.alpha(root.accents[listing.modelData.accent] || Theme.accent, 0.35)
border.width: 1
border.color: Qt.alpha(root.accents[listing.modelData.accent] || Theme.accent, 0.6)
Text {
anchors.centerIn: parent
text: listing.modelData.initials || listing.modelData.name.slice(0, 2).toUpperCase()
color: Theme.text
font.pixelSize: 14
font.weight: Font.DemiBold
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: 2
Text {
Layout.fillWidth: true
text: listing.modelData.name
color: Theme.text
font.pixelSize: 14
font.weight: Font.DemiBold
elide: Text.ElideRight
}
Text {
Layout.fillWidth: true
text: [listing.modelData.author ? "by " + listing.modelData.author : "", listing.modelData.version ? "v" + listing.modelData.version : "", "★ " + listing.modelData.stars].filter(x => x).join(" · ")
color: Theme.textSecondary
font.pixelSize: 11
elide: Text.ElideRight
}
}
GlassButton {
objectName: "listing-page-" + listing.modelData.id
text: "Details"
onClicked: Qt.openUrlExternally(listing.modelData.page)
}
GlassButton {
objectName: "listing-install-" + listing.modelData.id
text: listing.installed ? "Installed" : !listing.usable ? "Not available" : listing.confirming ? "Cancel" : "Install"
enabled: !listing.installed && listing.usable && !PluginService.busy
onClicked: root.confirmInstall = listing.confirming ? "" : listing.modelData.id
}
}
Text {
Layout.fillWidth: true
visible: text !== ""
text: listing.modelData.description
color: Theme.text
opacity: 0.85
font.pixelSize: 12
wrapMode: Text.Wrap
maximumLineCount: 2
elide: Text.ElideRight
}
Flow {
Layout.fillWidth: true
spacing: 6
Repeater {
model: [
{
text: listing.modelData.kind,
tone: "plain"
},
{
text: listing.modelData.kind === "Noctalia v4" ? "Best effort" : listing.modelData.support === "supported" ? "Works in glassMxrph" : listing.modelData.support === "partial" ? "Partly supported" : "Not supported",
tone: listing.modelData.support === "supported" ? "good" : listing.modelData.support === "partial" ? "warn" : "bad"
},
{
text: listing.modelData.official ? "Official" : listing.modelData.kind === "Noctalia v4" ? "Community" : listing.modelData.verified ? "Verified" : "Unverified",
tone: listing.modelData.official || listing.modelData.verified ? "good" : listing.modelData.kind === "Noctalia v4" ? "plain" : "warn"
}
].concat((listing.modelData.capabilities || []).map(c => ({
text: root.capabilityLabels[c] || c,
tone: "warn"
}))).concat([
{
text: listing.modelData.category,
tone: "plain"
}
])
Rectangle {
id: tag
required property var modelData
implicitWidth: tagText.implicitWidth + 16
implicitHeight: 22
radius: 11
color: tag.modelData.tone === "good" ? Qt.alpha(Theme.accent, 0.22) : tag.modelData.tone === "bad" ? Qt.alpha(Theme.urgent, 0.2) : tag.modelData.tone === "warn" ? Qt.alpha(Theme.urgent, 0.12) : Theme.fill
border.width: 1
border.color: Theme.hairline
Text {
id: tagText
anchors.centerIn: parent
text: tag.modelData.text
color: tag.modelData.tone === "plain" ? Theme.textSecondary : tag.modelData.tone === "good" ? Theme.text : Theme.urgent
font.pixelSize: 11
}
}
}
}
// Install confirmation: exactly what will be cloned, and the trust warning.
Rectangle {
Layout.fillWidth: true
visible: listing.confirming
implicitHeight: confirmBody.implicitHeight + 20
radius: 12
color: Theme.fill
border.width: 1
border.color: Theme.hairline
ColumnLayout {
id: confirmBody
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: 10
spacing: 8
Text {
Layout.fillWidth: true
wrapMode: Text.Wrap
color: Theme.text
font.pixelSize: 12
text: "Install " + listing.modelData.name + " from " + listing.modelData.repo + (listing.modelData.commit ? " at commit " + listing.modelData.commit.slice(0, 10) : " (current version)") + "? It will run inside the shell with your permissions" + ((listing.modelData.capabilities || []).length ? " and its review flagged: " + listing.modelData.capabilities.map(c => (root.capabilityLabels[c] || c).toLowerCase()).join(", ") : "") + "."
}
RowLayout {
Layout.fillWidth: true
spacing: 8
Text {
Layout.fillWidth: true
visible: listing.modelData.support === "partial"
text: listing.modelData.kind === "Noctalia v4" ? "Noctalia plugins are best effort: check its badges under Installed." : "Overlay and menu plugins keep some of their own styling."
color: Theme.textSecondary
font.pixelSize: 11
wrapMode: Text.Wrap
}
Item {
Layout.fillWidth: listing.modelData.support !== "partial"
}
GlassButton {
text: "View source"
onClicked: Qt.openUrlExternally(listing.modelData.repo)
}
GlassButton {
objectName: "listing-confirm-" + listing.modelData.id
text: PluginService.busy ? "Installing…" : "Install"
accented: true
enabled: !PluginService.busy
onClicked: {
root.confirmInstall = "";
PluginService.installListing(listing.modelData);
}
}
}
}
}
}
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 12
anchors.rightMargin: 12
height: 1
color: Theme.hairline
}
}
}
GlassButton {
objectName: "marketMore"
Layout.alignment: Qt.AlignHCenter
Layout.margins: 10
visible: PluginService.market.items.length < PluginService.market.total
text: PluginService.marketBusy ? "Loading…" : "Show more (" + (PluginService.market.total - PluginService.market.items.length) + ")"
enabled: !PluginService.marketBusy
onClicked: PluginService.browse(true)
}
}
}