remove scuffed popup handling

This commit is contained in:
Benjamin Palko 2025-09-07 09:23:51 -04:00
parent 0405dc3414
commit fdcaa77581
2 changed files with 54 additions and 69 deletions

View file

@ -1,6 +1,6 @@
import qs.services
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Hyprland
import Quickshell.Widgets import Quickshell.Widgets
PopupWindow { PopupWindow {
@ -16,64 +16,60 @@ PopupWindow {
color: "transparent" color: "transparent"
function toggle() { function toggle() {
Visibility.togglePopup(this); root.state = root.state == "opened" ? "closed" : "opened";
}
HyprlandFocusGrab {
id: grab
active: root.visible
windows: [root]
onCleared: {
root.state = "closed";
}
} }
implicitWidth: background.width implicitWidth: background.width
Behavior on implicitWidth {
NumberAnimation {
duration: 100
}
}
implicitHeight: background.height implicitHeight: background.height
Behavior on implicitHeight {
NumberAnimation {
duration: 100
}
}
Timer {
id: timer
interval: 750
onTriggered: {
if (!root.visible) {
return;
}
root.toggle();
}
}
WrapperMouseArea {
hoverEnabled: true
onExited: {
timer.start();
}
onEntered: {
timer.stop();
}
WrapperRectangle { WrapperRectangle {
id: background id: background
opacity: 0 focus: true
onFocusChanged: {
if (!focus) {
grab.active = false;
}
}
Behavior on opacity { Behavior on opacity {
NumberAnimation { NumberAnimation {
duration: root.animationDuration duration: root.animationDuration
} }
} }
states: State { state: "closed"
states: [
State {
name: "closed"
PropertyChanges {
background {
opacity: 0
}
}
},
State {
name: "opened" name: "opened"
when: root.opened
PropertyChanges { PropertyChanges {
background { background {
opacity: 1 opacity: 1
} }
} }
} }
]
transitions: [ transitions: [
Transition { Transition {
from: "" from: "closed"
to: "opened" to: "opened"
ScriptAction { ScriptAction {
script: root.visible = true script: root.visible = true
@ -81,7 +77,7 @@ PopupWindow {
}, },
Transition { Transition {
from: "opened" from: "opened"
to: "" to: "closed"
SequentialAnimation { SequentialAnimation {
PauseAnimation { PauseAnimation {
duration: root.animationDuration duration: root.animationDuration
@ -98,5 +94,4 @@ PopupWindow {
sourceComponent: root.content sourceComponent: root.content
} }
} }
}
} }

View file

@ -1,6 +1,5 @@
pragma Singleton pragma Singleton
import qs.components
import Quickshell import Quickshell
Singleton { Singleton {
@ -9,15 +8,6 @@ Singleton {
property alias pomodoro: properties.pomodoro property alias pomodoro: properties.pomodoro
property alias powermenu: properties.powermenu property alias powermenu: properties.powermenu
property alias storybook: properties.storybook property alias storybook: properties.storybook
property StyledPopupWindow activePopup
function togglePopup(popup: StyledPopupWindow) {
if (activePopup && popup != activePopup) {
activePopup.state = "";
}
popup.state = popup.state == "opened" ? "" : "opened";
activePopup = popup;
}
PersistentProperties { PersistentProperties {
id: properties id: properties