Compare commits
2 commits
96d8ab6534
...
112ed0d6de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
112ed0d6de | ||
|
|
fdcaa77581 |
5 changed files with 58 additions and 91 deletions
|
|
@ -1,79 +1,70 @@
|
|||
import qs.services
|
||||
import qs.config
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Hyprland
|
||||
|
||||
PopupWindow {
|
||||
id: root
|
||||
property bool opened: false
|
||||
property int animationDuration: 200
|
||||
property alias margins: background.margin
|
||||
property alias backgroundColor: background.color
|
||||
property alias radius: background.radius
|
||||
property alias state: background.state
|
||||
|
||||
required property Component content
|
||||
|
||||
implicitWidth: background.width
|
||||
implicitHeight: background.height
|
||||
color: "transparent"
|
||||
|
||||
HyprlandFocusGrab {
|
||||
id: grab
|
||||
active: root.visible
|
||||
windows: [root]
|
||||
onCleared: {
|
||||
background.state = "closed";
|
||||
}
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
Visibility.togglePopup(this);
|
||||
background.state = background.state == "opened" ? "closed" : "opened";
|
||||
}
|
||||
|
||||
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 {
|
||||
StyledWrapperRectangle {
|
||||
id: background
|
||||
|
||||
opacity: 0
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: root.animationDuration
|
||||
margin: 16
|
||||
focus: true
|
||||
onFocusChanged: {
|
||||
if (!focus) {
|
||||
grab.active = false;
|
||||
}
|
||||
}
|
||||
|
||||
states: State {
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: Styling.animations.speed.normal
|
||||
}
|
||||
}
|
||||
|
||||
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 +72,7 @@ PopupWindow {
|
|||
},
|
||||
Transition {
|
||||
from: "opened"
|
||||
to: ""
|
||||
to: "closed"
|
||||
SequentialAnimation {
|
||||
PauseAnimation {
|
||||
duration: root.animationDuration
|
||||
|
|
@ -99,4 +90,3 @@ PopupWindow {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import qs.components
|
||||
import qs.config
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
|
|
@ -10,10 +9,6 @@ import Quickshell.Bluetooth
|
|||
StyledPopupWindow {
|
||||
id: root
|
||||
|
||||
backgroundColor: Styling.theme.base300
|
||||
margins: 16
|
||||
radius: 8
|
||||
|
||||
content: ColumnLayout {
|
||||
spacing: 8
|
||||
StyledWrapperRectangle {
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@ import QtQuick.Layouts
|
|||
StyledPopupWindow {
|
||||
id: root
|
||||
|
||||
backgroundColor: Styling.theme.base300
|
||||
margins: 16
|
||||
radius: 8
|
||||
|
||||
content: GridLayout {
|
||||
|
||||
columns: 2
|
||||
|
|
|
|||
|
|
@ -9,10 +9,6 @@ import Quickshell
|
|||
StyledPopupWindow {
|
||||
id: window
|
||||
|
||||
backgroundColor: Styling.theme.base300
|
||||
margins: 14
|
||||
radius: 8
|
||||
|
||||
property QsMenuOpener menuOpener
|
||||
|
||||
content: ColumnLayout {
|
||||
|
|
|
|||
|
|
@ -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