desktop menu: slight design tweak

This commit is contained in:
purian23
2026-10-12 03:22:59 -04:00
parent 0fb2297c15
commit ffcaad73b8
3 changed files with 22 additions and 92 deletions
Generated
+3 -3
View File
@@ -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": {
+18 -88
View File
@@ -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;
}
}
}