popouts: better tray menu focus handling
Don't hide on hover lost, use a focus grab instead
This commit is contained in:
parent
b09b262f72
commit
e104428b28
4 changed files with 15 additions and 24 deletions
|
|
@ -1,6 +1,5 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import qs.services
|
||||
import qs.config
|
||||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
|
|
@ -10,10 +9,6 @@ Item {
|
|||
id: root
|
||||
|
||||
required property Item wrapper
|
||||
required property ShellScreen screen
|
||||
required property string currentName
|
||||
required property real currentCenter
|
||||
required property bool hasCurrent
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
|
|
@ -63,10 +58,10 @@ Item {
|
|||
sourceComponent: trayMenuComp
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
target: root.wrapper
|
||||
|
||||
function onHasCurrentChanged(): void {
|
||||
if (root.hasCurrent && trayMenu.shouldBeActive) {
|
||||
if (root.wrapper.hasCurrent && trayMenu.shouldBeActive) {
|
||||
trayMenu.sourceComponent = null;
|
||||
trayMenu.sourceComponent = trayMenuComp;
|
||||
}
|
||||
|
|
@ -77,7 +72,7 @@ Item {
|
|||
id: trayMenuComp
|
||||
|
||||
TrayMenu {
|
||||
popouts: root
|
||||
popouts: root.wrapper
|
||||
trayItem: trayMenu.modelData.menu
|
||||
}
|
||||
}
|
||||
|
|
@ -89,7 +84,7 @@ Item {
|
|||
id: popout
|
||||
|
||||
required property string name
|
||||
property bool shouldBeActive: root.currentName === name
|
||||
property bool shouldBeActive: root.wrapper.currentName === name
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import qs.services
|
|||
import qs.config
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
|
|
@ -26,6 +27,12 @@ StackView {
|
|||
popEnter: Anim {}
|
||||
popExit: Anim {}
|
||||
|
||||
HyprlandFocusGrab {
|
||||
active: true
|
||||
windows: [QsWindow.window]
|
||||
onCleared: root.popouts.hasCurrent = false
|
||||
}
|
||||
|
||||
component Anim: Transition {
|
||||
NumberAnimation {
|
||||
duration: 0
|
||||
|
|
|
|||
|
|
@ -72,10 +72,6 @@ Item {
|
|||
|
||||
sourceComponent: Content {
|
||||
wrapper: root
|
||||
screen: root.screen
|
||||
currentName: root.currentName
|
||||
currentCenter: root.currentCenter
|
||||
hasCurrent: root.hasCurrent
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ MouseArea {
|
|||
if (!utilitiesShortcutActive)
|
||||
visibilities.utilities = false;
|
||||
|
||||
if (!popouts.currentName.startsWith("traymenu"))
|
||||
popouts.hasCurrent = false;
|
||||
|
||||
if (Config.bar.showOnHover)
|
||||
|
|
@ -138,16 +139,8 @@ MouseArea {
|
|||
}
|
||||
|
||||
// Show popouts on hover
|
||||
const popout = panels.popouts;
|
||||
if (x < bar.implicitWidth + popout.width) {
|
||||
if (x < bar.implicitWidth)
|
||||
// Handle like part of bar
|
||||
bar.checkPopout(y);
|
||||
else
|
||||
// Keep on hover
|
||||
popouts.hasCurrent = withinPanelHeight(popout, x, y);
|
||||
} else
|
||||
popouts.hasCurrent = false;
|
||||
}
|
||||
|
||||
// Monitor individual visibility changes
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue