bar/popops: change anims a little and add dropshadow

This commit is contained in:
kossLAN 2025-06-07 17:32:41 -04:00
parent 95cc1b4c44
commit 5162d0125d
Signed by: kossLAN
SSH key fingerprint: SHA256:bdV0x+wdQHGJ6LgmstH3KV8OpWY+OOFmJcPcB0wQPV8
2 changed files with 17 additions and 5 deletions

View file

@ -8,7 +8,6 @@ Singleton {
property alias settings: jsonAdapter
FileView {
// todo change to Quickshell.dataPath("quickshell/settings.json")
path: `${Quickshell.env("XDG_DATA_HOME")}/quickshell/settings.json`
watchChanges: true
// onFileChanged: reload()

View file

@ -1,6 +1,7 @@
import Quickshell
import Quickshell.Widgets
import QtQuick
import QtQuick.Effects
import "../.."
PopupWindow {
@ -28,7 +29,7 @@ PopupWindow {
property var content
function set(item, content) {
isOpen = false;
// isOpen = false;
root.item = item;
root.content = content;
popupContent.data = content;
@ -86,6 +87,15 @@ PopupWindow {
}
}
RectangularShadow {
radius: popupContainer.radius
anchors.fill: popupContainer
opacity: popupContainer.opacity
visible: popupContainer.visible
blur: 10
spread: 2
}
WrapperRectangle {
id: popupContainer
@ -95,6 +105,7 @@ PopupWindow {
clip: true
opacity: 0
visible: opacity > 0
x: root.bar.width
// spooky, likely to cause problems lol
width: implicitWidth
@ -102,7 +113,8 @@ PopupWindow {
// needed to handle occurences where items are resized while open
onImplicitWidthChanged: {
if (root.isOpen) {
if (root.isOpen && popupContent.data !== []) {
console.log("repositioning popup");
let itemPos = root.item.mapToItem(root.bar.contentItem, 0, root.bar.height, root.item.width, 0).x;
root.position(itemPos);
}
@ -110,7 +122,7 @@ PopupWindow {
Item {
id: popupContent
implicitWidth: Math.max(childrenRect.width, 120)
implicitWidth: Math.max(root.content?.width, 120)
implicitHeight: Math.max(childrenRect.height, 60)
Behavior on opacity {
@ -141,6 +153,7 @@ PopupWindow {
}
Behavior on width {
enabled: root.isOpen
SmoothedAnimation {
duration: 200
easing.type: Easing.Linear
@ -155,7 +168,7 @@ PopupWindow {
}
Behavior on x {
enabled: root.visible
enabled: root.isOpen
SmoothedAnimation {
duration: 200
easing.type: Easing.OutQuad