diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/AppButton.qml b/dots/.config/quickshell/ii/modules/waffle/bar/AppButton.qml index a35e12a2e..dbb430b6d 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/AppButton.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/AppButton.qml @@ -45,9 +45,7 @@ BarButton { anchors.fill: parent anchors.rightMargin: 5 active: root.multiple - sourceComponent: BackgroundAcrylicRectangle { - - } + sourceComponent: BackgroundAcrylicRectangle {} } } diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/BarButton.qml b/dots/.config/quickshell/ii/modules/waffle/bar/BarButton.qml index ce1a4cdc7..65ef521c4 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/BarButton.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/BarButton.qml @@ -8,8 +8,8 @@ import qs.modules.waffle.looks Button { id: root - signal altAction() - signal middleClickAction() + property var altAction: () => {} + property var middleClickAction: () => {} property color colBackground property color colBackgroundBorder diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/BarMenu.qml b/dots/.config/quickshell/ii/modules/waffle/bar/BarMenu.qml new file mode 100644 index 000000000..2dbda095d --- /dev/null +++ b/dots/.config/quickshell/ii/modules/waffle/bar/BarMenu.qml @@ -0,0 +1,111 @@ +import QtQuick +import QtQuick.Controls +import Quickshell +import Quickshell.Hyprland +import qs.modules.common +import qs.modules.common.functions +import qs.modules.waffle.looks + +Loader { + id: root + + property Item anchorItem: parent + property real visualMargin: 12 + readonly property bool barAtBottom: Config.options.waffles.bar.bottom + property real ambientShadowWidth: 1 + + active: false + visible: active + sourceComponent: PopupWindow { + id: popupWindow + visible: true + Component.onCompleted: { + openAnim.start(); + } + + anchor { + adjustment: PopupAdjustment.Slide + item: root.anchorItem + gravity: root.barAtBottom ? Edges.Top : Edges.Bottom + edges: root.barAtBottom ? Edges.Top : Edges.Bottom + } + + HyprlandFocusGrab { + id: focusGrab + active: true + windows: [popupWindow] + onCleared: { + closeAnim.start(); + } + } + + implicitWidth: realContent.implicitWidth + (ambientShadow.border.width * 2) + (root.visualMargin * 2) + implicitHeight: realContent.implicitHeight + (ambientShadow.border.width * 2) + (root.visualMargin * 2) + + property real sourceEdgeMargin: -implicitHeight + PropertyAnimation { + id: openAnim + target: popupWindow + property: "sourceEdgeMargin" + to: (root.ambientShadowWidth + root.visualMargin) + duration: 200 + easing.type: Easing.BezierSpline + easing.bezierCurve: Looks.transition.easing.bezierCurve.easeIn + } + SequentialAnimation { + id: closeAnim + PropertyAnimation { + target: popupWindow + property: "sourceEdgeMargin" + to: -implicitHeight + duration: 150 + easing.type: Easing.BezierSpline + easing.bezierCurve: Looks.transition.easing.bezierCurve.easeOut + } + ScriptAction { + script: { + root.active = false; + } + } + } + + color: "transparent" + Rectangle { + id: ambientShadow + z: 0 + anchors { + fill: realContent + margins: -border.width + } + border.color: ColorUtils.transparentize(Looks.colors.bg0Border, Looks.shadowTransparency) + border.width: root.ambientShadowWidth + color: "transparent" + radius: realContent.radius + border.width + } + + Rectangle { + id: realContent + z: 1 + anchors { + left: parent.left + right: parent.right + top: root.barAtBottom ? undefined : parent.top + bottom: root.barAtBottom ? parent.bottom : undefined + margins: root.ambientShadowWidth + root.visualMargin + // Opening anim + bottomMargin: root.barAtBottom ? popupWindow.sourceEdgeMargin : (root.ambientShadowWidth + root.visualMargin) + topMargin: root.barAtBottom ? (root.ambientShadowWidth + root.visualMargin) : popupWindow.sourceEdgeMargin + } + color: Looks.colors.bg1 + radius: Looks.radius.large + + // test + implicitWidth: 300 + implicitHeight: 400 + + Menu { + id: menu + } + } + } +} diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/StartButton.qml b/dots/.config/quickshell/ii/modules/waffle/bar/StartButton.qml index 4595802ee..a7911d181 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/StartButton.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/StartButton.qml @@ -1,4 +1,5 @@ import QtQuick +import QtQuick.Controls import QtQuick.Layouts import org.kde.kirigami as Kirigami import qs @@ -21,4 +22,12 @@ AppButton { text: Translation.tr("Start") extraVisibleCondition: root.shouldShowTooltip } + + altAction: () => { + contextMenu.active = !contextMenu.active; + } + + BarMenu { + id: contextMenu + } } diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/SystemButton.qml b/dots/.config/quickshell/ii/modules/waffle/bar/SystemButton.qml index 1de9654d5..2a74ca171 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/SystemButton.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/SystemButton.qml @@ -90,6 +90,6 @@ BarButton { } BarToolTip { extraVisibleCondition: root.shouldShowTooltip && batteryHoverArea.containsMouse - text: Translation.tr("Battery: %1").arg(`${Math.round(Battery.percentage * 100) || 0}%`) + text: Translation.tr("Battery: %1%2").arg(`${Math.round(Battery.percentage * 100) || 0}%`).arg(Battery.isPluggedIn ? (" " + Translation.tr("(Plugged in)")) : "") } } diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/WidgetsButton.qml b/dots/.config/quickshell/ii/modules/waffle/bar/WidgetsButton.qml index 1c6c11859..51a3175bc 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/WidgetsButton.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/WidgetsButton.qml @@ -18,6 +18,11 @@ AppButton { onClicked: { GlobalStates.sidebarLeftOpen = !GlobalStates.sidebarLeftOpen } + onDownChanged: { + scaleAnim.duration = root.down ? 150 : 200 + scaleAnim.easing.bezierCurve = root.down ? Looks.transition.easing.bezierCurve.easeIn : Looks.transition.easing.bezierCurve.easeOut + iconWidget.scale = root.down ? 5/6 : 1 // If/When we do dragging, the scale is 1.25 + } contentItem: Item { anchors { @@ -41,6 +46,13 @@ AppButton { id: iconWidget anchors.verticalCenter: parent.verticalCenter iconName: root.iconName + + Behavior on scale { + NumberAnimation { + id: scaleAnim + easing.type: Easing.BezierSpline + } + } } Column { diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml index 53b68b82c..ce7349a97 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskAppButton.qml @@ -37,7 +37,7 @@ AppButton { } } - onMiddleClickAction: { + middleClickAction: () => { if (root.desktopEntry) { desktopEntry.execute() } diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskPreview.qml b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskPreview.qml index 6d8aeba1a..777dfb3e7 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskPreview.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/TaskPreview.qml @@ -16,7 +16,7 @@ PopupWindow { property Item anchorItem //////////////////// Functions //////////////////// - function close() { + function close() { // Closing doesn't animate, not sure if they're just lazy or it's intentional marginBehavior.enabled = false; root.visible = false; } diff --git a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/Tasks.qml b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/Tasks.qml index 895b1353f..260c1c37f 100644 --- a/dots/.config/quickshell/ii/modules/waffle/bar/tasks/Tasks.qml +++ b/dots/.config/quickshell/ii/modules/waffle/bar/tasks/Tasks.qml @@ -17,6 +17,10 @@ MouseArea { previewPopup.show(appEntry, button); } + function showContextMenu(appEntry, button) { + // TODO + } + // Apps row RowLayout { id: row @@ -36,6 +40,10 @@ MouseArea { onHoverPreviewRequested: { root.showPreviewPopup(appEntry, this) } + + altAction: () => { + root.showContextMenu(appEntry, this) + } } } } @@ -46,4 +54,6 @@ MouseArea { tasksHovered: root.containsMouse anchor.window: root.QsWindow.window } + + }