remove scuffed popup handling
This commit is contained in:
parent
0405dc3414
commit
fdcaa77581
2 changed files with 54 additions and 69 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import qs.services
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Widgets
|
||||
|
||||
PopupWindow {
|
||||
|
|
@ -16,64 +16,60 @@ PopupWindow {
|
|||
color: "transparent"
|
||||
|
||||
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
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation {
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
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 {
|
||||
id: background
|
||||
|
||||
opacity: 0
|
||||
focus: true
|
||||
onFocusChanged: {
|
||||
if (!focus) {
|
||||
grab.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: root.animationDuration
|
||||
}
|
||||
}
|
||||
|
||||
states: State {
|
||||
state: "closed"
|
||||
states: [
|
||||
State {
|
||||
name: "closed"
|
||||
PropertyChanges {
|
||||
background {
|
||||
opacity: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "opened"
|
||||
when: root.opened
|
||||
PropertyChanges {
|
||||
background {
|
||||
opacity: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
transitions: [
|
||||
Transition {
|
||||
from: ""
|
||||
from: "closed"
|
||||
to: "opened"
|
||||
ScriptAction {
|
||||
script: root.visible = true
|
||||
|
|
@ -81,7 +77,7 @@ PopupWindow {
|
|||
},
|
||||
Transition {
|
||||
from: "opened"
|
||||
to: ""
|
||||
to: "closed"
|
||||
SequentialAnimation {
|
||||
PauseAnimation {
|
||||
duration: root.animationDuration
|
||||
|
|
@ -98,5 +94,4 @@ PopupWindow {
|
|||
sourceComponent: root.content
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
pragma Singleton
|
||||
|
||||
import qs.components
|
||||
import Quickshell
|
||||
|
||||
Singleton {
|
||||
|
|
@ -9,15 +8,6 @@ Singleton {
|
|||
property alias pomodoro: properties.pomodoro
|
||||
property alias powermenu: properties.powermenu
|
||||
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 {
|
||||
id: properties
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue