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 property alias settings: jsonAdapter
FileView { FileView {
// todo change to Quickshell.dataPath("quickshell/settings.json")
path: `${Quickshell.env("XDG_DATA_HOME")}/quickshell/settings.json` path: `${Quickshell.env("XDG_DATA_HOME")}/quickshell/settings.json`
watchChanges: true watchChanges: true
// onFileChanged: reload() // onFileChanged: reload()

View file

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