Files
omarchy-sc/integrations/omarchy/BarWidget.qml
T
2026-08-31 18:46:57 +02:00

70 lines
1.5 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import QtQuick
import Quickshell
import qs.Ui
BarWidget {
id: root
moduleName: "local.omarchy-citizen"
readonly property bool opened: panelLoader.item
? panelLoader.item.opened === true
: false
readonly property bool popoutSwitchClosing: panelLoader.item
? panelLoader.item.popoutSwitchClosing === true
: false
function open() {
if (panelLoader.item) panelLoader.item.open()
}
function close() {
if (panelLoader.item) panelLoader.item.close()
}
function toggle() {
if (panelLoader.item) panelLoader.item.toggle()
}
function closeForPopoutSwitch() {
if (panelLoader.item) panelLoader.item.closeForPopoutSwitch()
}
function injectPanel() {
if (!panelLoader.item) return
panelLoader.item.bar = root.bar
panelLoader.item.anchorItem = button
panelLoader.item.hostWidget = root
}
implicitWidth: button.implicitWidth
implicitHeight: button.implicitHeight
onBarChanged: injectPanel()
Loader {
id: panelLoader
active: true
source: Qt.resolvedUrl("Panel.qml")
visible: false
onLoaded: {
root.injectPanel()
Qt.callLater(root.injectPanel)
}
}
WidgetButton {
id: button
anchors.fill: parent
bar: root.bar
text: "✦SC"
tooltipText: "Omarchy Citizen – Plug & Play Star Citizen"
onPressed: function(buttonCode) {
if (buttonCode === Qt.LeftButton) root.toggle()
else if (buttonCode === Qt.RightButton && root.bar)
root.bar.run("xdg-open https://wiki.starcitizen-lug.org")
}
}
}