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.settings
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
import qs.widgets
|
||||
import qs.modules.Services
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
PopupWindow {
|
||||
implicitWidth: audioLayout.implicitWidth + 2 * audioLayout.anchors.margins
|
||||
implicitHeight: audioLayout.implicitHeight + 24
|
||||
anchor.edges: Edges.Top | Edges.Right
|
||||
anchor.gravity: Edges.Bottom | Edges.Left
|
||||
anchor.margins.top: 40
|
||||
WlrLayershell {
|
||||
id: win
|
||||
|
||||
required property ShellScreen barScreen
|
||||
screen: barScreen
|
||||
|
||||
visible: false
|
||||
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 {
|
||||
id: root
|
||||
Keys.onEscapePressed: {
|
||||
parent.visible = false;
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if (parent.visible)
|
||||
forceActiveFocus();
|
||||
}
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
focus: true
|
||||
color: Colors.barBg
|
||||
radius: Config.cfg.appearance.rounding
|
||||
|
||||
Keys.onEscapePressed: event => {
|
||||
win.visible = false;
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: audioLayout
|
||||
anchors.centerIn: parent
|
||||
anchors.margins: 10
|
||||
spacing: 8
|
||||
|
||||
Repeater {
|
||||
id: audioRep
|
||||
model: Audio.sinks
|
||||
|
|
@ -50,8 +70,6 @@ PopupWindow {
|
|||
|
||||
RowLayout {
|
||||
id: audioRow
|
||||
anchors.left: parent.left
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.fill: parent
|
||||
|
||||
StyledText {
|
||||
|
|
@ -89,6 +107,8 @@ PopupWindow {
|
|||
}
|
||||
Slider {
|
||||
Layout.rightMargin: 10
|
||||
|
||||
focusPolicy: Qt.NoFocus
|
||||
value: audioDelContainer.modelData.audio.volume
|
||||
from: 0
|
||||
to: 1
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ import qs.settings
|
|||
import qs.widgets
|
||||
|
||||
BarComponent {
|
||||
id: main
|
||||
implicitWidth: implicitHeight
|
||||
required property int screenHeight
|
||||
id: main
|
||||
StyledIcon {
|
||||
iconName: "preferences-desktop-wallpaper-symbolic"
|
||||
anchors.centerIn: parent
|
||||
iconName: "preferences-desktop-wallpaper-symbolic"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
|
|
@ -30,7 +30,7 @@ BarComponent {
|
|||
id: wallPicker
|
||||
visible: false
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
keyboardFocus: WlrKeyboardFocus.OnDemand
|
||||
keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||
implicitHeight: main.screenHeight / 8
|
||||
color: 'transparent'
|
||||
anchors {
|
||||
|
|
@ -92,7 +92,7 @@ BarComponent {
|
|||
hoverEnabled: true
|
||||
onClicked: {
|
||||
Config.cfg.wallpaper.wallpaper = wallTile.modelData.filePath;
|
||||
Config.save()
|
||||
Config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue