test popouts

This commit is contained in:
2026-04-16 03:10:20 +02:00
parent 0df32b9e95
commit 55b497f132
10 changed files with 84 additions and 105 deletions
+1
View File
@@ -16,6 +16,7 @@ RowLayout {
id: root
required property Wrapper popouts
required property ClipWrapper popoutsWrapper
required property ShellScreen screen
readonly property int vPadding: 6
required property PersistentProperties visibilities
+2
View File
@@ -20,6 +20,7 @@ Item {
property bool isHovered
readonly property int padding: Math.max(Appearance.padding.smaller, Config.barConfig.border)
required property Wrapper popouts
required property ClipWrapper popoutsWrapper
required property ShellScreen screen
readonly property bool shouldBeVisible: (!Config.barConfig.autoHide || visibilities.bar || isHovered)
readonly property int vPadding: 6
@@ -76,6 +77,7 @@ Item {
sourceComponent: Bar {
height: root.contentHeight
popouts: root.popouts
popoutsWrapper: root.popoutsWrapper
screen: root.screen
visibilities: root.visibilities
}
+13 -6
View File
@@ -9,13 +9,20 @@ Item {
id: root
readonly property alias content: content
property real offsetScale: x > 0 || content.hasCurrent ? 0 : 1
property real offsetScale: y > 0 || content.hasCurrent ? 0 : 1
required property ShellScreen screen
clip: true
implicitHeight: content.implicitHeight
implicitWidth: content.implicitWidth * (1 - offsetScale)
implicitHeight: content.implicitHeight * (1 - offsetScale)
implicitWidth: content.implicitWidth
visible: width > 0 && height > 0
x: {
const off = content.currentCenter - content.nonAnimWidth / 2;
const diff = parent.width - Math.floor(off + content.nonAnimWidth);
if (diff < 0)
return off + diff;
return Math.floor(Math.max(off, 0));
}
Behavior on offsetScale {
Anim {
@@ -41,9 +48,9 @@ Item {
Wrapper {
id: content
anchors.left: parent.left
anchors.leftMargin: (-implicitWidth - 5) * root.offsetScale
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: (-implicitHeight - 5) * root.offsetScale
offsetScale: root.offsetScale
screen: root.screen
}
+8 -17
View File
@@ -15,7 +15,7 @@ Item {
readonly property Item current: currentPopout?.item ?? null
readonly property Popout currentPopout: content.children.find(c => c.shouldBeActive) ?? null
required property Item wrapper
required property PopoutState popouts
implicitHeight: (currentPopout?.implicitHeight ?? 0) + 5 * 2
implicitWidth: (currentPopout?.implicitWidth ?? 0) + 5 * 2
@@ -49,40 +49,31 @@ Item {
Connections {
function onHasCurrentChanged(): void {
if (root.wrapper.hasCurrent && trayMenu.shouldBeActive) {
if (root.popouts.hasCurrent && trayMenu.shouldBeActive) {
trayMenu.sourceComponent = null;
trayMenu.sourceComponent = trayMenuComponent;
}
}
target: root.wrapper
target: root.popouts
}
Component {
id: trayMenuComponent
TrayMenuPopout {
popouts: root.wrapper
popouts: root.popouts
trayItem: trayMenu.modelData.menu
}
}
}
}
Popout {
name: "overview"
sourceComponent: OverviewPopout {
screen: root.wrapper.screen
wrapper: root.wrapper
}
}
Popout {
name: "upower"
sourceComponent: UPowerPopout {
wrapper: root.wrapper
wrapper: root.popouts
}
}
@@ -90,7 +81,7 @@ Item {
name: "network"
sourceComponent: NetworkPopout {
wrapper: root.wrapper
wrapper: root.popouts
}
}
@@ -98,7 +89,7 @@ Item {
name: "updates"
sourceComponent: UpdatesPopout {
wrapper: root.wrapper
wrapper: root.popouts
}
}
}
@@ -107,7 +98,7 @@ Item {
id: popout
required property string name
readonly property bool shouldBeActive: root.wrapper.currentName === name
readonly property bool shouldBeActive: root.popouts.currentName === name
active: false
anchors.centerIn: parent
+8
View File
@@ -0,0 +1,8 @@
import QtQuick
QtObject {
property string currentName
property bool hasCurrent
signal detachRequested(mode: string)
}
+4 -3
View File
@@ -1,18 +1,19 @@
pragma ComponentBehavior: Bound
import qs.Components
import qs.Config
import Quickshell
import Quickshell.Widgets
import QtQuick
import QtQuick.Controls
import QtQuick.Effects
import qs.Components
import qs.Modules
import qs.Config
StackView {
id: root
property int biggestWidth: 0
required property Item popouts
required property PopoutState popouts
property int rootWidth: 0
required property QsMenuHandle trayItem
+26 -64
View File
@@ -11,19 +11,16 @@ Item {
property list<real> animCurve: Appearance.anim.curves.expressiveDefaultSpatial
property int animLength: Appearance.anim.durations.expressiveDefaultSpatial
readonly property alias content: content
readonly property alias controlCenter: controlCenter
readonly property Item current: (content.item as Content)?.current ?? null
property real currentCenter
property alias currentName: popoutState.currentName
property string detachedMode
property alias hasCurrent: popoutState.hasCurrent
readonly property bool isDetached: detachedMode.length > 0
readonly property real nonAnimHeight: children.find(c => c.shouldBeActive)?.implicitHeight ?? content.implicitHeight
readonly property real nonAnimWidth: children.find(c => c.shouldBeActive)?.implicitWidth ?? content.implicitWidth
required property real offsetScale
property string queuedMode
required property ShellScreen screen
readonly property alias winfo: winfo
function close(): void {
hasCurrent = false;
@@ -67,49 +64,14 @@ Item {
}
}
Keys.onEscapePressed: {
// Forward escape to password popout if active, otherwise close
if (currentName === "wirelesspassword" && content.item) {
const passwordPopout = (content.item as Content)?.children.find(c => c.name === "wirelesspassword");
if (passwordPopout && passwordPopout.item) {
passwordPopout.item.closeDialog();
return;
}
}
close();
}
Keys.onPressed: event => {
// Don't intercept keys when password popout is active - let it handle them
if (currentName === "wirelesspassword") {
event.accepted = false;
}
}
PopoutState {
id: popoutState
onDetachRequested: mode => root.detach(mode)
}
HyprlandFocusGrab {
active: root.isDetached
windows: [QsWindow.window]
onCleared: root.close()
}
Binding {
property: "WlrLayershell.keyboardFocus"
target: QsWindow.window
value: WlrKeyboardFocus.OnDemand
when: root.isDetached || (root.hasCurrent && root.currentName === "wirelesspassword")
}
Comp {
id: content
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.centerIn: parent
shouldBeActive: root.hasCurrent && !root.detachedMode
sourceComponent: Content {
@@ -117,31 +79,31 @@ Item {
}
}
Comp {
id: winfo
anchors.centerIn: parent
shouldBeActive: root.detachedMode === "winfo"
sourceComponent: WindowInfo {
client: Hypr.activeToplevel
screen: root.screen
}
}
Comp {
id: controlCenter
anchors.centerIn: parent
shouldBeActive: root.detachedMode === "any"
sourceComponent: ControlCenter {
active: root.queuedMode
screen: root.screen
onClose: root.close()
}
}
// Comp {
// id: winfo
//
// anchors.centerIn: parent
// shouldBeActive: root.detachedMode === "winfo"
//
// sourceComponent: WindowInfo {
// client: Hypr.activeToplevel
// screen: root.screen
// }
// }
//
// Comp {
// id: controlCenter
//
// anchors.centerIn: parent
// shouldBeActive: root.detachedMode === "any"
//
// sourceComponent: ControlCenter {
// active: root.queuedMode
// screen: root.screen
//
// onClose: root.close()
// }
// }
component Comp: Loader {
id: comp