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,87 +16,82 @@ 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 { WrapperRectangle {
id: timer id: background
interval: 750
onTriggered: { focus: true
if (!root.visible) { onFocusChanged: {
return; if (!focus) {
grab.active = false;
} }
root.toggle();
} }
}
WrapperMouseArea { Behavior on opacity {
hoverEnabled: true NumberAnimation {
onExited: { duration: root.animationDuration
timer.start(); }
} }
onEntered: {
timer.stop();
}
WrapperRectangle {
id: background
opacity: 0 state: "closed"
Behavior on opacity { states: [
NumberAnimation { State {
duration: root.animationDuration name: "closed"
PropertyChanges {
background {
opacity: 0
}
} }
} },
State {
states: 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
}
},
Transition {
from: "opened"
to: "closed"
SequentialAnimation {
PauseAnimation {
duration: root.animationDuration
} }
}, ScriptAction {
Transition { script: root.visible = false
from: "opened"
to: ""
SequentialAnimation {
PauseAnimation {
duration: root.animationDuration
}
ScriptAction {
script: root.visible = false
}
} }
} }
]
Loader {
active: root.visible
sourceComponent: root.content
} }
]
Loader {
active: root.visible
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