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
15
modules/Services/WidgetTracker.qml
Normal file
15
modules/Services/WidgetTracker.qml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
pragma Singleton
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
property string current: ""
|
||||
property ShellScreen screen: null
|
||||
function toggle(name, scr) {
|
||||
current = (current === name && screen === scr) ? "" : name;
|
||||
screen = scr;
|
||||
}
|
||||
function close() {
|
||||
current = "";
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,107 +1,65 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import Qt.labs.folderlistmodel 2.11
|
||||
|
||||
import qs
|
||||
import qs.settings
|
||||
import qs.widgets
|
||||
|
||||
BarComponent {
|
||||
id: main
|
||||
implicitWidth: implicitHeight
|
||||
required property int screenHeight
|
||||
StyledIcon {
|
||||
iconName: "preferences-desktop-wallpaper-symbolic"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
anchors.fill: main
|
||||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
wallPicker.visible = !wallPicker.visible;
|
||||
}
|
||||
}
|
||||
WlrLayershell {
|
||||
id: wallPicker
|
||||
visible: false
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||
implicitHeight: main.screenHeight / 8
|
||||
color: 'transparent'
|
||||
anchors {
|
||||
bottom: true
|
||||
left: true
|
||||
right: true
|
||||
}
|
||||
margins {
|
||||
bottom: 20
|
||||
left: 20
|
||||
right: 20
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if (wallPicker.visible)
|
||||
container.forceActiveFocus();
|
||||
}
|
||||
Rectangle {
|
||||
id: container
|
||||
focus: true
|
||||
Keys.onEscapePressed: {
|
||||
wallPicker.visible = false;
|
||||
}
|
||||
Rectangle {
|
||||
id: wallPicker
|
||||
color: "transparent"
|
||||
Rectangle {
|
||||
id: container
|
||||
focus: true
|
||||
anchors.fill: parent
|
||||
color: Colors.base02
|
||||
radius: Config.cfg.appearance.rounding
|
||||
GridView {
|
||||
id: wallpaperLayout
|
||||
clip: true
|
||||
snapMode: GridView.SnapOneRow
|
||||
flow: GridView.FlowTopToBottom
|
||||
cellHeight: container.height
|
||||
cellWidth: container.width / 8
|
||||
anchors.fill: parent
|
||||
color: Colors.base02
|
||||
radius: Config.cfg.appearance.rounding
|
||||
GridView {
|
||||
id: wallpaperLayout
|
||||
anchors.centerIn: parent
|
||||
anchors.margins: 10
|
||||
model: wallpaperList
|
||||
delegate: ClippingRectangle {
|
||||
id: wallTile
|
||||
clip: true
|
||||
snapMode: GridView.SnapOneRow
|
||||
flow: GridView.FlowTopToBottom
|
||||
cellHeight: container.height
|
||||
cellWidth: container.width / 8
|
||||
anchors.fill: parent
|
||||
anchors.centerIn: parent
|
||||
anchors.margins: 10
|
||||
model: wallpaperList
|
||||
delegate: ClippingRectangle {
|
||||
id: wallTile
|
||||
clip: true
|
||||
required property var modelData
|
||||
radius: Config.cfg.appearance.rounding / 1.5
|
||||
color: 'transparent'
|
||||
implicitWidth: wallpaperLayout.cellWidth - 20
|
||||
implicitHeight: wallpaperLayout.cellHeight - 20
|
||||
Image {
|
||||
id: wallpaper
|
||||
anchors.fill: parent
|
||||
source: wallTile.modelData.filePath
|
||||
sourceSize.width: 16 * 30
|
||||
sourceSize.height: 9 * 30
|
||||
asynchronous: true
|
||||
cache: true
|
||||
}
|
||||
MouseArea {
|
||||
id: wpClickHandler
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
Config.cfg.wallpaper.wallpaper = wallTile.modelData.filePath;
|
||||
Config.save();
|
||||
}
|
||||
required property var modelData
|
||||
radius: Config.cfg.appearance.rounding / 1.5
|
||||
color: 'transparent'
|
||||
implicitWidth: wallpaperLayout.cellWidth - 20
|
||||
implicitHeight: wallpaperLayout.cellHeight - 20
|
||||
Image {
|
||||
id: wallpaper
|
||||
anchors.fill: parent
|
||||
source: wallTile.modelData.filePath
|
||||
sourceSize.width: 16 * 30
|
||||
sourceSize.height: 9 * 30
|
||||
asynchronous: true
|
||||
cache: true
|
||||
}
|
||||
MouseArea {
|
||||
id: wpClickHandler
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
Config.cfg.wallpaper.wallpaper = wallTile.modelData.filePath;
|
||||
Config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
FolderListModel {
|
||||
id: wallpaperList
|
||||
folder: Qt.resolvedUrl(Config.cfg.wallpaper.wallDir)
|
||||
nameFilters: ["*.png"]
|
||||
}
|
||||
}
|
||||
FolderListModel {
|
||||
id: wallpaperList
|
||||
folder: Qt.resolvedUrl(Config.cfg.wallpaper.wallDir)
|
||||
nameFilters: ["*.png"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Variants {
|
|||
left: true
|
||||
right: true
|
||||
}
|
||||
|
||||
|
||||
color: 'transparent'
|
||||
implicitHeight: Config.cfg.bar.height
|
||||
margins.top: Config.cfg.bar.floating ? 10 : 0
|
||||
|
|
@ -46,11 +46,11 @@ Variants {
|
|||
Mpris {}
|
||||
Bat {}
|
||||
Tray {}
|
||||
WallPicker {
|
||||
screenHeight: root.screen.height
|
||||
}
|
||||
WallPickerButton {barScreen: root.modelData}
|
||||
|
||||
Pw {barScreen: root.modelData}
|
||||
Pw {
|
||||
barScreen: root.modelData
|
||||
}
|
||||
Netstatus {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,10 +30,7 @@ BarComponent {
|
|||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: root
|
||||
onClicked: volPopup.visible = !volPopup.visible
|
||||
}
|
||||
VolPopup {
|
||||
barScreen: root.barScreen
|
||||
id: volPopup
|
||||
onClicked: WidgetTracker.toggle("volume", root.barScreen)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
24
modules/bar/WallPickerButton.qml
Normal file
24
modules/bar/WallPickerButton.qml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import QtQuick
|
||||
import qs.widgets
|
||||
import qs.modules.Services
|
||||
import Quickshell
|
||||
|
||||
|
||||
BarComponent {
|
||||
id: main
|
||||
implicitWidth: implicitHeight
|
||||
required property ShellScreen barScreen
|
||||
StyledIcon {
|
||||
iconName: "preferences-desktop-wallpaper-symbolic"
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
id: clickHandler
|
||||
anchors.fill: main
|
||||
acceptedButtons: Qt.LeftButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
WidgetTracker.toggle("wallpapers", main.barScreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
58
modules/overlays/Top.qml
Normal file
58
modules/overlays/Top.qml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.modules.Services
|
||||
import qs.modules.applets
|
||||
import qs.settings
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
delegate: PanelWindow {
|
||||
required property ShellScreen modelData
|
||||
aboveWindows: true
|
||||
screen: modelData
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
bottom: true
|
||||
right: true
|
||||
}
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
color: 'transparent'
|
||||
visible: WidgetTracker.current !== "" && WidgetTracker.screen === modelData
|
||||
WlrLayershell.keyboardFocus: visible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
focus: true
|
||||
Keys.onEscapePressed: event => {
|
||||
WidgetTracker.close();
|
||||
event.accepted = true;
|
||||
}
|
||||
VolPopup {
|
||||
z: 1
|
||||
visible: WidgetTracker.current === "volume"
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Config.cfg.bar.floating ? Config.cfg.bar.height + 20 : Config.cfg.bar.height
|
||||
anchors.rightMargin: 10
|
||||
|
||||
}
|
||||
WallPicker {
|
||||
z: 1
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: 20
|
||||
implicitWidth: 1000
|
||||
implicitHeight: 200
|
||||
visible: WidgetTracker.current === "wallpapers"
|
||||
}
|
||||
MouseArea {
|
||||
z: 0
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.LeftButton
|
||||
onClicked: WidgetTracker.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,6 +12,6 @@
|
|||
},
|
||||
"wallpaper": {
|
||||
"wallDir": "/home/lucy/.walls/",
|
||||
"wallpaper": "/home/lucy/.walls/frierensuff.png"
|
||||
"wallpaper": "/home/lucy/.walls/walkingcastle.png"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
//@ pragma IconTheme Papirus-Dark
|
||||
import Quickshell
|
||||
import qs.modules.bar
|
||||
import qs.modules.wallpaper
|
||||
import qs.modules.notifications
|
||||
import qs.modules.overlays
|
||||
import qs.modules.Services
|
||||
|
||||
ShellRoot {
|
||||
Bar {}
|
||||
Wallpaper {}
|
||||
NotiPopup {}
|
||||
Bottom {}
|
||||
Top {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue