simplify things by moving popups into a new layer
This commit is contained in:
parent
6f2bc1a107
commit
4410d41fb3
10 changed files with 223 additions and 199 deletions
|
|
@ -5,116 +5,87 @@ import Quickshell
|
|||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
import qs.widgets
|
||||
import qs
|
||||
import qs.modules.Services
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
WlrLayershell {
|
||||
id: win
|
||||
|
||||
required property ShellScreen barScreen
|
||||
screen: barScreen
|
||||
|
||||
visible: false
|
||||
color: 'transparent'
|
||||
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
|
||||
Rectangle {
|
||||
id: root
|
||||
focus: true
|
||||
color: Colors.barBg
|
||||
radius: Config.cfg.appearance.rounding
|
||||
Keys.onEscapePressed: event => {
|
||||
win.visible = false;
|
||||
event.accepted = true;
|
||||
}
|
||||
implicitWidth: audioLayout.implicitWidth + 10
|
||||
implicitHeight: audioLayout.implicitHeight + 10
|
||||
|
||||
implicitWidth: audioLayout.implicitWidth + 20
|
||||
implicitHeight: audioLayout.implicitHeight + 20
|
||||
onVisibleChanged: {
|
||||
if (visible)
|
||||
root.forceActiveFocus();
|
||||
}
|
||||
ColumnLayout {
|
||||
id: audioLayout
|
||||
anchors.centerIn: parent
|
||||
spacing: 8
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
color: Colors.barBg
|
||||
radius: Config.cfg.appearance.rounding
|
||||
Repeater {
|
||||
id: audioRep
|
||||
model: Audio.sinks
|
||||
|
||||
Keys.onEscapePressed: event => {
|
||||
win.visible = false;
|
||||
event.accepted = true;
|
||||
}
|
||||
delegate: Rectangle {
|
||||
id: audioDelContainer
|
||||
Layout.fillWidth: true
|
||||
color: Colors.moduleBg
|
||||
radius: Config.cfg.appearance.rounding / 1.5
|
||||
required property var modelData
|
||||
implicitHeight: audioRow.implicitHeight + 8
|
||||
implicitWidth: audioRow.implicitWidth
|
||||
|
||||
ColumnLayout {
|
||||
id: audioLayout
|
||||
anchors.centerIn: parent
|
||||
spacing: 8
|
||||
RowLayout {
|
||||
id: audioRow
|
||||
anchors.fill: parent
|
||||
|
||||
Repeater {
|
||||
id: audioRep
|
||||
model: Audio.sinks
|
||||
|
||||
delegate: Rectangle {
|
||||
id: audioDelContainer
|
||||
Layout.fillWidth: true
|
||||
color: Colors.moduleBg
|
||||
radius: Config.cfg.appearance.rounding
|
||||
required property var modelData
|
||||
implicitHeight: audioRow.implicitHeight + 8
|
||||
implicitWidth: audioRow.implicitWidth
|
||||
|
||||
RowLayout {
|
||||
id: audioRow
|
||||
anchors.fill: parent
|
||||
|
||||
StyledText {
|
||||
text: audioDelContainer.modelData.nickname
|
||||
Layout.leftMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: 200
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
StyledIcon {
|
||||
Layout.leftMargin: 10
|
||||
iconName: Audio.getVolumeIcon(audioDelContainer.modelData)
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
audioDelContainer.modelData.audio.muted = !audioDelContainer.modelData.audio.muted;
|
||||
}
|
||||
StyledText {
|
||||
text: audioDelContainer.modelData.nickname
|
||||
Layout.leftMargin: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.maximumWidth: 200
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
StyledIcon {
|
||||
Layout.leftMargin: 10
|
||||
iconName: Audio.getVolumeIcon(audioDelContainer.modelData)
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
audioDelContainer.modelData.audio.muted = !audioDelContainer.modelData.audio.muted;
|
||||
}
|
||||
}
|
||||
StyledIcon {
|
||||
readonly property bool isDefault: audioDelContainer.modelData === Audio.defaultAudio
|
||||
readonly property bool isPreferred: audioDelContainer.modelData === Audio.preferredAudio
|
||||
iconName: isDefault ? "radio-checked-symbolic" : "radio-symbolic"
|
||||
opacity: (isPreferred && !isDefault) ? 0.5 : 1.0
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
Audio.setDefaultSink(audioDelContainer.modelData);
|
||||
}
|
||||
}
|
||||
StyledIcon {
|
||||
readonly property bool isDefault: audioDelContainer.modelData === Audio.defaultAudio
|
||||
readonly property bool isPreferred: audioDelContainer.modelData === Audio.preferredAudio
|
||||
iconName: isDefault ? "radio-checked-symbolic" : "radio-symbolic"
|
||||
opacity: (isPreferred && !isDefault) ? 0.5 : 1.0
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: {
|
||||
Audio.setDefaultSink(audioDelContainer.modelData);
|
||||
}
|
||||
}
|
||||
Slider {
|
||||
Layout.rightMargin: 10
|
||||
}
|
||||
Slider {
|
||||
Layout.rightMargin: 10
|
||||
|
||||
focusPolicy: Qt.NoFocus
|
||||
value: audioDelContainer.modelData.audio.volume
|
||||
from: 0
|
||||
to: 1
|
||||
onMoved: {
|
||||
audioDelContainer.modelData.audio.volume = value;
|
||||
}
|
||||
focusPolicy: Qt.NoFocus
|
||||
value: audioDelContainer.modelData.audio.volume
|
||||
from: 0
|
||||
to: 1
|
||||
onMoved: {
|
||||
audioDelContainer.modelData.audio.volume = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue