simplify things by moving popups into a new layer

This commit is contained in:
lucy 2026-08-28 17:45:45 +02:00
commit 4410d41fb3
10 changed files with 223 additions and 199 deletions

View 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 = "";
}
}

View file

@ -5,50 +5,22 @@ import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import QtQuick import QtQuick
import qs.widgets import qs.widgets
import qs
import qs.modules.Services import qs.modules.Services
import QtQuick.Layouts import QtQuick.Layouts
import QtQuick.Controls import QtQuick.Controls
WlrLayershell { Rectangle {
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
}
implicitWidth: audioLayout.implicitWidth + 20
implicitHeight: audioLayout.implicitHeight + 20
onVisibleChanged: {
if (visible)
root.forceActiveFocus();
}
Rectangle {
id: root id: root
anchors.fill: parent
focus: true focus: true
color: Colors.barBg color: Colors.barBg
radius: Config.cfg.appearance.rounding radius: Config.cfg.appearance.rounding
Keys.onEscapePressed: event => { Keys.onEscapePressed: event => {
win.visible = false; win.visible = false;
event.accepted = true; event.accepted = true;
} }
implicitWidth: audioLayout.implicitWidth + 10
implicitHeight: audioLayout.implicitHeight + 10
ColumnLayout { ColumnLayout {
id: audioLayout id: audioLayout
@ -63,7 +35,7 @@ WlrLayershell {
id: audioDelContainer id: audioDelContainer
Layout.fillWidth: true Layout.fillWidth: true
color: Colors.moduleBg color: Colors.moduleBg
radius: Config.cfg.appearance.rounding radius: Config.cfg.appearance.rounding / 1.5
required property var modelData required property var modelData
implicitHeight: audioRow.implicitHeight + 8 implicitHeight: audioRow.implicitHeight + 8
implicitWidth: audioRow.implicitWidth implicitWidth: audioRow.implicitWidth
@ -120,5 +92,4 @@ WlrLayershell {
} }
} }
} }
}
} }

View file

@ -1,58 +1,17 @@
pragma ComponentBehavior: Bound pragma ComponentBehavior: Bound
import Quickshell
import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
import QtQuick import QtQuick
import Qt.labs.folderlistmodel 2.11 import Qt.labs.folderlistmodel 2.11
import qs import qs
import qs.settings import qs.settings
import qs.widgets
BarComponent { Rectangle {
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 id: wallPicker
visible: false color: "transparent"
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 { Rectangle {
id: container id: container
focus: true focus: true
Keys.onEscapePressed: {
wallPicker.visible = false;
}
anchors.fill: parent anchors.fill: parent
color: Colors.base02 color: Colors.base02
radius: Config.cfg.appearance.rounding radius: Config.cfg.appearance.rounding
@ -103,5 +62,4 @@ BarComponent {
nameFilters: ["*.png"] nameFilters: ["*.png"]
} }
} }
}
} }

View file

@ -46,11 +46,11 @@ Variants {
Mpris {} Mpris {}
Bat {} Bat {}
Tray {} Tray {}
WallPicker { WallPickerButton {barScreen: root.modelData}
screenHeight: root.screen.height
}
Pw {barScreen: root.modelData} Pw {
barScreen: root.modelData
}
Netstatus {} Netstatus {}
} }
} }

View file

@ -30,10 +30,7 @@ BarComponent {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
anchors.fill: root anchors.fill: root
onClicked: volPopup.visible = !volPopup.visible onClicked: WidgetTracker.toggle("volume", root.barScreen)
}
VolPopup {
barScreen: root.barScreen
id: volPopup
} }
} }

View 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
View 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()
}
}
}
}

View file

@ -12,6 +12,6 @@
}, },
"wallpaper": { "wallpaper": {
"wallDir": "/home/lucy/.walls/", "wallDir": "/home/lucy/.walls/",
"wallpaper": "/home/lucy/.walls/frierensuff.png" "wallpaper": "/home/lucy/.walls/walkingcastle.png"
} }
} }

View file

@ -2,12 +2,13 @@
//@ pragma IconTheme Papirus-Dark //@ pragma IconTheme Papirus-Dark
import Quickshell import Quickshell
import qs.modules.bar import qs.modules.bar
import qs.modules.wallpaper
import qs.modules.notifications import qs.modules.notifications
import qs.modules.overlays
import qs.modules.Services import qs.modules.Services
ShellRoot { ShellRoot {
Bar {} Bar {}
Wallpaper {}
NotiPopup {} NotiPopup {}
Bottom {}
Top {}
} }