From ffcaad73b835afe7128463b84a38d7bec3343a8b Mon Sep 17 00:00:00 2001 From: purian23 Date: Mon, 12 Oct 2026 03:22:59 -0400 Subject: [PATCH] desktop menu: slight design tweak --- dank-qml-common | 2 +- flake.lock | 6 +- quickshell/Modules/DesktopContextMenu.qml | 106 ++++------------------ 3 files changed, 22 insertions(+), 92 deletions(-) diff --git a/dank-qml-common b/dank-qml-common index bd90e4b6f..bd17e052f 160000 --- a/dank-qml-common +++ b/dank-qml-common @@ -1 +1 @@ -Subproject commit bd90e4b6f2ec36035fc2cb560acdc0e418f669ac +Subproject commit bd17e052f8b180461815c0336362a9669c643e17 diff --git a/flake.lock b/flake.lock index a9ef36504..b550f938d 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "dank-qml-common": { "flake": false, "locked": { - "lastModified": 1791733765, - "narHash": "sha256-X5Nq0FON2n5z404z7SbqBOXh2OzVXnCMvonHbyMVWXY=", + "lastModified": 1791789382, + "narHash": "sha256-TIhRpTeVVM7ccaOQ0P1J9WyidIj2MnywSYqAZX0Dngs=", "owner": "AvengeMedia", "repo": "dank-qml-common", - "rev": "bd90e4b6f2ec36035fc2cb560acdc0e418f669ac", + "rev": "bd17e052f8b180461815c0336362a9669c643e17", "type": "github" }, "original": { diff --git a/quickshell/Modules/DesktopContextMenu.qml b/quickshell/Modules/DesktopContextMenu.qml index 8bfba9e12..a633db958 100644 --- a/quickshell/Modules/DesktopContextMenu.qml +++ b/quickshell/Modules/DesktopContextMenu.qml @@ -2,12 +2,10 @@ pragma ComponentBehavior: Bound import Qt.labs.folderlistmodel import QtQuick -import Quickshell.Widgets import qs.Common import qs.Services import qs.DCommon.Widgets import qs.Widgets -import "../DCommon/Common/WheelInput.js" as WheelInput DContextMenu { id: root @@ -36,15 +34,15 @@ DContextMenu { const items = [ { type: "item", - icon: "add", + icon: "dashboard_customize", text: I18n.tr("Add widget"), action: () => DesktopWidgetRegistry.startEditing(root.targetScreen, true) }, { type: "item", - icon: "edit", - text: I18n.tr("Edit widgets"), - action: () => DesktopWidgetRegistry.startEditing(root.targetScreen, false) + icon: "extension", + text: I18n.tr("Plugins"), + action: () => PopoutService.openSettingsWithTab("plugins") }, { type: "item", @@ -59,10 +57,9 @@ DContextMenu { component: wallpaperStrip, height: stripUnit * 2 + Theme.spacingS }); - return items.concat([settingsEntry, allSettingsEntry, desktopWidgetsEntry, displaysEntry, pluginsEntry]); + return items.concat([settingsEntry, allSettingsEntry, desktopWidgetsEntry, displaysEntry]); } - // Stable objects so expanding Settings doesn't rebuild every row. component MenuEntry: QtObject { property string type: "item" property string icon @@ -106,14 +103,6 @@ DContextMenu { action: () => PopoutService.openSettingsWithTab("displays") } - MenuEntry { - id: pluginsEntry - icon: "extension" - text: I18n.tr("Plugins") - hidden: !root.settingsExpanded - action: () => PopoutService.openSettingsWithTab("plugins") - } - onBackdropRightClicked: (x, y) => open(targetScreen, x, y, false) onRenderActiveChanged: { if (renderActive) @@ -134,7 +123,6 @@ DContextMenu { SessionData.saveSettings(); } - // Current wallpaper leads; the order is fixed per open so a pick moves the check, not the list. function loadStrip(model) { const paths = []; for (let i = 0; i < model.count; i++) @@ -166,67 +154,29 @@ DContextMenu { id: wallpaperStrip Item { - // Not a Dank* wrapper: DListView only scrolls vertically. - ListView { - id: strip - - readonly property real unit: (width - spacing * (root.stripCount - 1)) / (root.stripCount + 1) - function scrollBy(wheel) { - const delta = WheelInput.isTouchpad(wheel) ? WheelInput.dominantDelta(wheel.pixelDelta) : WheelInput.dominantDelta(wheel.angleDelta) / 120 * (unit + spacing); - const maxX = originX + Math.max(0, contentWidth - width); - contentX = Math.max(originX, Math.min(maxX, contentX - delta)); - } - - anchors.fill: parent - orientation: ListView.Horizontal - spacing: Theme.spacingS - clip: true - boundsBehavior: Flickable.StopAtBounds + DCarousel { + y: Theme.spacingXS + width: parent.width + height: root.stripUnit * 2 + preferredItemWidth: width / 2 model: root.stripPaths - delegate: Item { + delegate: DCarouselItem { id: thumb required property string modelData readonly property bool current: thumb.modelData === root.currentWallpaper - y: Theme.spacingXS - width: strip.unit * (thumb.current ? 2 : 1) - height: root.stripUnit * 2 - - Behavior on width { - NumberAnimation { - duration: SettingsData.reduceMotion ? 0 : Theme.expressiveDurations.expressiveDefaultSpatial - easing.type: Easing.BezierSpline - easing.bezierCurve: Theme.expressiveCurves.expressiveDefaultSpatial - } + onClicked: { + if (!thumb.current) + root.setWallpaper(thumb.modelData); } - ClippingRectangle { - id: thumbClip + CachingImage { anchors.fill: parent - radius: thumb.current ? Theme.cornerRadiusXL : Math.min(Theme.cornerRadiusFull, width / 2) - color: Theme.surfaceContainerHigh - - Behavior on radius { - NumberAnimation { - duration: SettingsData.reduceMotion ? 0 : Theme.expressiveDurations.expressiveDefaultSpatial - easing.type: Easing.BezierSpline - easing.bezierCurve: Theme.expressiveCurves.expressiveDefaultSpatial - } - } - - CachingImage { - anchors.fill: parent - imagePath: thumb.modelData - maxCacheSize: 256 - animate: false - } - - Rectangle { - anchors.fill: parent - color: Theme.withAlpha(Theme.onSurface, thumbMouse.pressed ? Theme.stateLayerPressed : thumbMouse.containsMouse ? Theme.stateLayerHover : 0) - } + imagePath: thumb.modelData + maxCacheSize: 256 + animate: false } Rectangle { @@ -253,26 +203,6 @@ DContextMenu { color: Theme.onPrimaryContainer } } - - MouseArea { - id: thumbMouse - anchors.fill: parent - hoverEnabled: true - cursorShape: Qt.PointingHandCursor - onClicked: { - if (!thumb.current) - root.setWallpaper(thumb.modelData); - } - } - } - } - - MouseArea { - anchors.fill: parent - acceptedButtons: Qt.NoButton - onWheel: wheel => { - strip.scrollBy(wheel); - wheel.accepted = true; } } }