import QtQuick import Quickshell import Quickshell.Io import qs.Commons import qs.Ui BarWidget { id: root moduleName: "deomarchy.plugin-manager" readonly property bool opened: panelItem ? panelItem.opened === true : false function open() { if (panelItem) panelItem.open() } function close() { if (panelItem) panelItem.close() } function togglePanel() { if (panelItem) panelItem.toggle() } readonly property bool popoutSwitchClosing: panelItem ? panelItem.popoutSwitchClosing === true : false function closeForPopoutSwitch() { if (panelItem) panelItem.closeForPopoutSwitch() } property var panelItem: null function injectPanel() { var target = panelLoader.item if (!target) return panelItem = target if ("bar" in target) target.bar = root.bar if ("settings" in target) target.settings = root.settings if ("anchorItem" in target) target.anchorItem = button if ("hostWidget" in target) target.hostWidget = root } implicitWidth: button.implicitWidth implicitHeight: button.implicitHeight onBarChanged: injectPanel() onSettingsChanged: injectPanel() Loader { id: panelLoader active: true source: Qt.resolvedUrl("Panel.qml") visible: false onLoaded: { root.injectPanel() Qt.callLater(root.injectPanel) } } IpcHandler { target: "deomarchy.plugin-manager" function open(): void { root.open() } function close(): void { root.close() } function toggle(): void { root.togglePanel() } } BarIconButton { id: button anchors.fill: parent bar: root.bar // md-puzzle from JetBrainsMono Nerd Font — the family the bar already // renders with — so this matches the other monochrome widget icons. text: String.fromCodePoint(0xF0327) tooltipText: root.opened ? "Close Plugin Manager" : "Plugin Manager" onPressed: function(b) { if (b === Qt.LeftButton) root.togglePanel() } } }