Files
omarchy/plugins/omaplug/BarWidget.qml
T
asepharyana 1cdb82a76f Sync config from arch
- hypr/apps.lua
- hypr/autostart.lua
- hypr/envs.lua
- hypr/hyprland.lua
- hypr/hyprsunset.conf
- hypr/input.lua
- hypr/looknfeel.lua
- hypr/omasettings.lua
- hypr/xdph.conf
- omarchy/branding/about.txt
- omarchy/branding/screensaver.txt
- omarchy/extensions/omarchy-menu.jsonc
- omarchy/hooks/battery-low.d/play-warning-sound.sample
- omarchy/hooks/font-set.d/show-font-notification.sample
- omarchy/hooks/post-boot.d/weather.sample
- omarchy/hooks/post-update.d/install-voxtype.hook
- omarchy/hooks/post-update.d/setup-agent.hook
- omarchy/hooks/post-update.d/setup-fingerprint.hook
- omarchy/hooks/post-update.d/show-update-notification.sample
- omarchy/hooks/pre-refresh-pacman.d/add-custom-repo.sample
- omarchy/hooks/theme-set.d/show-theme-notification.sample
- omarchy/shell.json
- omarchy/shell.toml
- omarchy/theme.name
- omarchy/themes/azure-glow/README.md
- omarchy/themes/azure-glow/alacritty.toml
- omarchy/themes/azure-glow/btop.theme
- omarchy/themes/azure-glow/hyprland.conf
- omarchy/themes/azure-glow/hyprlock.conf
- omarchy/themes/azure-glow/icons.theme
- … 269 more
2026-09-23 15:19:12 +07:00

107 lines
3.6 KiB
QML

import QtQuick
import Quickshell.Io
import qs.Commons
import qs.Ui
BarWidget {
id: root
moduleName: "omaplug"
// The bar's findPanelWidget (Bar.qml) requires open/close/opened on the
// bar-widget root, and the popout coordinator compares against
// slot.activeItem — so the widget, not the nested panel, is the identity.
readonly property bool opened: panelItem ? panelItem.opened === true : false
readonly property int pendingUpdateCount: panelItem ? (panelItem.pendingUpdateCount || 0) : 0
function open() { if (panelItem) panelItem.open() }
function close() { if (panelItem) panelItem.close() }
function togglePanel() { if (panelItem) panelItem.toggle() }
// Forwarded so this widget can stand in for the panel as the bar's popout
// identity: Bar.requestPopout prefers closeForPopoutSwitch over close, and
// KeyboardPanel reads popoutSwitchClosing back off its owner.
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: "omaplug"
function refresh(): void { root.broadcast("refresh") }
function open(): void { root.open() }
function close(): void { root.close() }
function show(): void { root.open() }
function hide(): void { root.close() }
function toggle(): void { root.togglePanel() }
}
BarIconButton {
id: button
anchors.fill: parent
bar: root.bar
text: root.opened ? "\udb85\udcd3" : "\udb85\udcd9"
tooltipText: root.opened ? "Close Plugin Manager" : "Plugin Manager"
onPressed: function(b) {
if (b === Qt.LeftButton) root.togglePanel()
}
}
// Small pending-update indicator, independent of the manager's own
// open/close state so it stays visible whether or not the panel is open.
Rectangle {
id: updateBadge
visible: root.pendingUpdateCount > 0
anchors.top: button.top
anchors.right: button.right
z: 10
readonly property string countText: root.pendingUpdateCount > 9 ? "9+" : String(root.pendingUpdateCount)
implicitWidth: Math.max(Style.space(14), badgeLabel.implicitWidth + Style.space(6))
implicitHeight: Style.space(14)
radius: height / 2
color: Color.accent
border.width: 1
border.color: root.bar ? root.bar.background : "transparent"
Text {
id: badgeLabel
anchors.centerIn: parent
text: updateBadge.countText
color: "white"
font.family: root.bar ? root.bar.fontFamily : Style.font.family
font.pixelSize: Style.font.caption * 0.85
font.bold: true
}
}
}