fixup focusing and key handling in volpopup by moving it to a wlrlayershell
This commit is contained in:
parent
50a9a62a2d
commit
6f2bc1a107
4 changed files with 47 additions and 25 deletions
|
|
@ -2,39 +2,59 @@ pragma ComponentBehavior: Bound
|
||||||
import qs
|
import qs
|
||||||
import qs.settings
|
import qs.settings
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Wayland
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import qs.widgets
|
import qs.widgets
|
||||||
import qs.modules.Services
|
import qs.modules.Services
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
|
|
||||||
PopupWindow {
|
WlrLayershell {
|
||||||
implicitWidth: audioLayout.implicitWidth + 2 * audioLayout.anchors.margins
|
id: win
|
||||||
implicitHeight: audioLayout.implicitHeight + 24
|
|
||||||
anchor.edges: Edges.Top | Edges.Right
|
required property ShellScreen barScreen
|
||||||
anchor.gravity: Edges.Bottom | Edges.Left
|
screen: barScreen
|
||||||
anchor.margins.top: 40
|
|
||||||
|
visible: false
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
grabFocus: true
|
layer: WlrLayer.Overlay
|
||||||
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
|
keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||||
|
|
||||||
|
anchors {
|
||||||
|
top: true
|
||||||
|
right: true
|
||||||
|
}
|
||||||
|
margins {
|
||||||
|
top: Config.cfg.bar.height + (Config.cfg.bar.floating ? 20 : 10)
|
||||||
|
right: Config.cfg.bar.floating ? 10 : 0
|
||||||
|
}
|
||||||
|
|
||||||
|
implicitWidth: audioLayout.implicitWidth + 20
|
||||||
|
implicitHeight: audioLayout.implicitHeight + 20
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible)
|
||||||
|
root.forceActiveFocus();
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: root
|
id: root
|
||||||
Keys.onEscapePressed: {
|
|
||||||
parent.visible = false;
|
|
||||||
}
|
|
||||||
onVisibleChanged: {
|
|
||||||
if (parent.visible)
|
|
||||||
forceActiveFocus();
|
|
||||||
}
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.centerIn: parent
|
focus: true
|
||||||
color: Colors.barBg
|
color: Colors.barBg
|
||||||
radius: Config.cfg.appearance.rounding
|
radius: Config.cfg.appearance.rounding
|
||||||
|
|
||||||
|
Keys.onEscapePressed: event => {
|
||||||
|
win.visible = false;
|
||||||
|
event.accepted = true;
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: audioLayout
|
id: audioLayout
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
anchors.margins: 10
|
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: audioRep
|
id: audioRep
|
||||||
model: Audio.sinks
|
model: Audio.sinks
|
||||||
|
|
@ -50,8 +70,6 @@ PopupWindow {
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: audioRow
|
id: audioRow
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
@ -89,6 +107,8 @@ PopupWindow {
|
||||||
}
|
}
|
||||||
Slider {
|
Slider {
|
||||||
Layout.rightMargin: 10
|
Layout.rightMargin: 10
|
||||||
|
|
||||||
|
focusPolicy: Qt.NoFocus
|
||||||
value: audioDelContainer.modelData.audio.volume
|
value: audioDelContainer.modelData.audio.volume
|
||||||
from: 0
|
from: 0
|
||||||
to: 1
|
to: 1
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,12 @@ import qs.settings
|
||||||
import qs.widgets
|
import qs.widgets
|
||||||
|
|
||||||
BarComponent {
|
BarComponent {
|
||||||
|
id: main
|
||||||
implicitWidth: implicitHeight
|
implicitWidth: implicitHeight
|
||||||
required property int screenHeight
|
required property int screenHeight
|
||||||
id: main
|
|
||||||
StyledIcon {
|
StyledIcon {
|
||||||
iconName: "preferences-desktop-wallpaper-symbolic"
|
iconName: "preferences-desktop-wallpaper-symbolic"
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: clickHandler
|
id: clickHandler
|
||||||
|
|
@ -30,7 +30,7 @@ BarComponent {
|
||||||
id: wallPicker
|
id: wallPicker
|
||||||
visible: false
|
visible: false
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
keyboardFocus: WlrKeyboardFocus.OnDemand
|
keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||||
implicitHeight: main.screenHeight / 8
|
implicitHeight: main.screenHeight / 8
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
anchors {
|
anchors {
|
||||||
|
|
@ -92,7 +92,7 @@ BarComponent {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Config.cfg.wallpaper.wallpaper = wallTile.modelData.filePath;
|
Config.cfg.wallpaper.wallpaper = wallTile.modelData.filePath;
|
||||||
Config.save()
|
Config.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ Variants {
|
||||||
left: true
|
left: true
|
||||||
right: true
|
right: true
|
||||||
}
|
}
|
||||||
|
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
implicitHeight: Config.cfg.bar.height
|
implicitHeight: Config.cfg.bar.height
|
||||||
margins.top: Config.cfg.bar.floating ? 10 : 0
|
margins.top: Config.cfg.bar.floating ? 10 : 0
|
||||||
|
|
@ -49,7 +50,7 @@ Variants {
|
||||||
screenHeight: root.screen.height
|
screenHeight: root.screen.height
|
||||||
}
|
}
|
||||||
|
|
||||||
Pw {}
|
Pw {barScreen: root.modelData}
|
||||||
Netstatus {}
|
Netstatus {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import qs.settings
|
||||||
import qs.modules.Services
|
import qs.modules.Services
|
||||||
|
|
||||||
BarComponent {
|
BarComponent {
|
||||||
|
required property ShellScreen barScreen
|
||||||
id: root
|
id: root
|
||||||
active: clickHandler.containsMouse
|
active: clickHandler.containsMouse
|
||||||
implicitWidth: pwLayout.implicitWidth + 16
|
implicitWidth: pwLayout.implicitWidth + 16
|
||||||
|
|
@ -32,7 +33,7 @@ BarComponent {
|
||||||
onClicked: volPopup.visible = !volPopup.visible
|
onClicked: volPopup.visible = !volPopup.visible
|
||||||
}
|
}
|
||||||
VolPopup {
|
VolPopup {
|
||||||
|
barScreen: root.barScreen
|
||||||
id: volPopup
|
id: volPopup
|
||||||
anchor.item: root
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue