forked from Shinonome/dots-hyprland
hefty: bar: add system tray
This commit is contained in:
@@ -9,7 +9,7 @@ import qs.modules.common
|
||||
import qs.modules.common.widgets
|
||||
import qs.modules.common.functions
|
||||
|
||||
MouseArea {
|
||||
ButtonMouseArea {
|
||||
id: root
|
||||
required property SystemTrayItem item
|
||||
property bool targetMenuOpen: false
|
||||
@@ -19,8 +19,10 @@ MouseArea {
|
||||
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
implicitWidth: 20
|
||||
implicitHeight: 20
|
||||
property real iconSize: 20
|
||||
property real backgroundSize: 26
|
||||
implicitWidth: iconSize
|
||||
implicitHeight: iconSize
|
||||
onPressed: (event) => {
|
||||
switch (event.button) {
|
||||
case Qt.LeftButton:
|
||||
@@ -40,6 +42,16 @@ MouseArea {
|
||||
tooltip.text = TrayService.getTooltipForItem(root.item);
|
||||
}
|
||||
|
||||
StateOverlay {
|
||||
id: hoverOverlay
|
||||
anchors.centerIn: parent
|
||||
width: root.backgroundSize
|
||||
height: root.backgroundSize
|
||||
radius: root.backgroundSize / 2
|
||||
hover: root.containsMouse
|
||||
press: root.containsPress
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: menu
|
||||
function open() {
|
||||
@@ -73,8 +85,8 @@ MouseArea {
|
||||
visible: !Config.options.tray.monochromeIcons
|
||||
source: root.item.icon
|
||||
anchors.centerIn: parent
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
width: root.iconSize
|
||||
height: root.iconSize
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
||||
@@ -187,7 +187,10 @@ PopupWindow {
|
||||
Layout.fillWidth: true
|
||||
|
||||
visible: root.trayItemId !== undefined && root.trayItemId.length > 0 && stackView.depth === 1
|
||||
releaseAction: () => TrayService.togglePin(root.trayItemId);
|
||||
releaseAction: () => {
|
||||
GlobalFocusGrab.dismiss();
|
||||
TrayService.togglePin(root.trayItemId);
|
||||
}
|
||||
|
||||
contentItem: RowLayout {
|
||||
anchors {
|
||||
|
||||
Reference in New Issue
Block a user