root panel window handles focus
This commit is contained in:
parent
bd826c14ac
commit
f14cf072e9
5 changed files with 31 additions and 36 deletions
|
|
@ -1,15 +1,36 @@
|
|||
import qs.config
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
|
||||
PanelWindow {
|
||||
id: window
|
||||
|
||||
required property string name
|
||||
property alias background: background
|
||||
required property string name
|
||||
property bool canFocus: true
|
||||
property bool focused: false
|
||||
|
||||
WlrLayershell.namespace: `lux-${name}`
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.keyboardFocus: window.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!canFocus)
|
||||
return;
|
||||
focused = visible;
|
||||
}
|
||||
HyprlandFocusGrab {
|
||||
active: window.focused
|
||||
windows: [window]
|
||||
onCleared: {
|
||||
if (!window.canFocus)
|
||||
return;
|
||||
window.focused = false;
|
||||
}
|
||||
}
|
||||
|
||||
color: "transparent"
|
||||
|
||||
Rectangle {
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import qs.services
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
|
||||
StyledPanelWindow {
|
||||
id: window
|
||||
|
|
@ -17,15 +15,8 @@ StyledPanelWindow {
|
|||
implicitHeight: 400
|
||||
background.color: Styling.theme.base200
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.keyboardFocus: window.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
HyprlandFocusGrab {
|
||||
active: Visibility.configuration
|
||||
windows: [window]
|
||||
onCleared: {
|
||||
Visibility.configuration = false;
|
||||
}
|
||||
onFocusedChanged: {
|
||||
Visibility.configuration = focused;
|
||||
}
|
||||
|
||||
StyledTabBar {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ StyledPanelWindow {
|
|||
list.currentIndex = 0;
|
||||
search.clear();
|
||||
}
|
||||
Visibility.launcher = focused;
|
||||
}
|
||||
implicitWidth: rect.width
|
||||
implicitHeight: rect.height
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ pragma ComponentBehavior: Bound
|
|||
import qs.components
|
||||
import qs.config
|
||||
import qs.services
|
||||
import Quickshell.Hyprland
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
|
||||
StyledPanelWindow {
|
||||
|
|
@ -18,26 +16,19 @@ StyledPanelWindow {
|
|||
implicitWidth: rect.width
|
||||
implicitHeight: rect.height
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
Process {
|
||||
id: process
|
||||
}
|
||||
|
||||
onFocusedChanged: {
|
||||
Visibility.powermenu = focused;
|
||||
}
|
||||
|
||||
WrapperItem {
|
||||
id: rect
|
||||
|
||||
margin: 14
|
||||
|
||||
HyprlandFocusGrab {
|
||||
active: Visibility.powermenu
|
||||
windows: [root]
|
||||
onCleared: {
|
||||
Visibility.powermenu = false;
|
||||
}
|
||||
}
|
||||
|
||||
StyledListView {
|
||||
id: list
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import qs.config
|
|||
import qs.services
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
|
||||
StyledPanelWindow {
|
||||
id: root
|
||||
|
|
@ -18,15 +16,8 @@ StyledPanelWindow {
|
|||
|
||||
background.color: Styling.theme.base200
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Top
|
||||
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
|
||||
HyprlandFocusGrab {
|
||||
active: Visibility.storybook
|
||||
windows: [root]
|
||||
onCleared: {
|
||||
Visibility.storybook = false;
|
||||
}
|
||||
onFocusedChanged: {
|
||||
Visibility.storybook = focused;
|
||||
}
|
||||
|
||||
StyledTabBar {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue