1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-30 17:42:06 -04:00

dock: add trash CLI, refine implementation

This commit is contained in:
bbedward
2026-04-27 11:14:22 -04:00
parent c9b38023d5
commit 36a7692da7
18 changed files with 1855 additions and 977 deletions

View File

@@ -479,14 +479,33 @@ Item {
delegate: Item {
id: delegateItem
property var dockButton: itemData.type === "launcher" ? launcherButton : (itemData.type === "trash" ? trashButton : button)
property var dockButton: {
switch (itemData.type) {
case "launcher":
return launcherButton;
case "trash":
return trashButton;
default:
return button;
}
}
property var itemData: modelData
readonly property bool isOverflowToggle: itemData.type === "overflow-toggle"
readonly property bool isTrash: itemData.type === "trash"
readonly property bool isInOverflow: itemData.isInOverflow === true
readonly property bool isDragging: {
switch (itemData.type) {
case "launcher":
return launcherButton.dragging;
case "trash":
return false;
default:
return button.dragging;
}
}
clip: false
z: (itemData.type === "launcher" ? launcherButton.dragging : (itemData.type === "trash" ? false : button.dragging)) ? 100 : 0
z: isDragging ? 100 : 0
visible: !isInOverflow || root.overflowExpanded
opacity: (isInOverflow && !root.overflowExpanded) ? 0 : 1
scale: (isInOverflow && !root.overflowExpanded) ? 0.8 : 1

View File

@@ -1,585 +1,390 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Widgets
import qs.Common
import qs.Services
import qs.Widgets
PanelWindow {
DockContextMenuBase {
id: root
WindowBlur {
targetWindow: root
blurX: menuContainer.x
blurY: menuContainer.y
blurWidth: root.visible ? menuContainer.width : 0
blurHeight: root.visible ? menuContainer.height : 0
blurRadius: Theme.cornerRadius
}
WlrLayershell.namespace: "dms:dock-context-menu"
property var appData: null
property var anchorItem: null
property real dockVisibleHeight: 40
property int margin: 10
property bool hidePin: false
property var desktopEntry: null
property bool isDmsWindow: appData?.appId === "org.quickshell" || appData?.appId === "com.danklinux.dms"
property var dockApps: null
readonly property bool isDmsWindow: appData?.appId === "org.quickshell" || appData?.appId === "com.danklinux.dms"
layerNamespace: "dms:dock-context-menu"
function showForButton(button, data, dockHeight, hidePinOption, entry, dockScreen, parentDockApps) {
if (dockScreen) {
root.screen = dockScreen;
}
anchorItem = button;
appData = data;
dockVisibleHeight = dockHeight || 40;
hidePin = hidePinOption || false;
desktopEntry = entry || null;
dockApps = parentDockApps || null;
visible = true;
}
function close() {
visible = false;
show(button, dockHeight, dockScreen);
}
screen: null
visible: false
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
color: "transparent"
anchors {
top: true
left: true
right: true
bottom: true
}
Repeater {
model: {
if (!root.appData || root.appData.type !== "grouped")
return [];
property point anchorPos: Qt.point(screen.width / 2, screen.height - 100)
onAnchorItemChanged: updatePosition()
onVisibleChanged: {
if (visible) {
updatePosition();
}
}
function updatePosition() {
if (!anchorItem) {
anchorPos = Qt.point(screen.width / 2, screen.height - 100);
return;
}
const dockWindow = anchorItem.Window.window;
if (!dockWindow) {
anchorPos = Qt.point(screen.width / 2, screen.height - 100);
return;
}
const buttonPosInDock = anchorItem.mapToItem(dockWindow.contentItem, 0, 0);
let actualDockHeight = root.dockVisibleHeight;
function findDockBackground(item) {
if (item.objectName === "dockBackground") {
return item;
}
for (var i = 0; i < item.children.length; i++) {
const found = findDockBackground(item.children[i]);
if (found) {
return found;
const toplevels = [];
const allToplevels = ToplevelManager.toplevels.values;
for (let i = 0; i < allToplevels.length; i++) {
const toplevel = allToplevels[i];
if (toplevel.appId === root.appData.appId) {
toplevels.push(toplevel);
}
}
return null;
}
const dockBackground = findDockBackground(dockWindow.contentItem);
let actualDockWidth = dockWindow.width;
if (dockBackground) {
actualDockHeight = dockBackground.height;
actualDockWidth = dockBackground.width;
}
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
const dockMargin = SettingsData.dockMargin + 16;
let buttonScreenX, buttonScreenY;
if (isVertical) {
const dockContentHeight = dockWindow.height;
const screenHeight = root.screen.height;
const dockTopMargin = Math.round((screenHeight - dockContentHeight) / 2);
buttonScreenY = dockTopMargin + buttonPosInDock.y + anchorItem.height / 2;
if (SettingsData.dockPosition === SettingsData.Position.Right) {
buttonScreenX = root.screen.width - actualDockWidth - dockMargin - 20;
} else {
buttonScreenX = actualDockWidth + dockMargin + 20;
}
} else {
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
if (isDockAtBottom) {
buttonScreenY = root.screen.height - actualDockHeight - dockMargin - 20;
} else {
buttonScreenY = actualDockHeight + dockMargin + 20;
}
const dockContentWidth = dockWindow.width;
const screenWidth = root.screen.width;
const dockLeftMargin = Math.round((screenWidth - dockContentWidth) / 2);
buttonScreenX = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2;
}
anchorPos = Qt.point(buttonScreenX, buttonScreenY);
}
Rectangle {
id: menuContainer
x: {
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
if (isVertical) {
const isDockAtRight = SettingsData.dockPosition === SettingsData.Position.Right;
if (isDockAtRight) {
return Math.max(10, root.anchorPos.x - width + 30);
} else {
return Math.min(root.width - width - 10, root.anchorPos.x - 30);
}
} else {
const left = 10;
const right = root.width - width - 10;
const want = root.anchorPos.x - width / 2;
return Math.max(left, Math.min(right, want));
}
}
y: {
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
if (isVertical) {
const top = 10;
const bottom = root.height - height - 10;
const want = root.anchorPos.y - height / 2;
return Math.max(top, Math.min(bottom, want));
} else {
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
if (isDockAtBottom) {
return Math.max(10, root.anchorPos.y - height + 30);
} else {
return Math.min(root.height - height - 10, root.anchorPos.y - 30);
}
}
}
width: Math.min(400, Math.max(180, menuColumn.implicitWidth + Theme.spacingS * 2))
height: menuColumn.implicitHeight + Theme.spacingS * 2
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
radius: Theme.cornerRadius
border.color: BlurService.enabled ? BlurService.borderColor : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
border.width: BlurService.enabled ? BlurService.borderWidth : 1
opacity: root.visible ? 1 : 0
visible: opacity > 0
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing
}
return toplevels;
}
Rectangle {
anchors.fill: parent
anchors.topMargin: 4
anchors.leftMargin: 2
anchors.rightMargin: -2
anchors.bottomMargin: -4
radius: parent.radius
color: Qt.rgba(0, 0, 0, 0.15)
z: -1
}
width: parent.width
height: 28
radius: Theme.cornerRadius
color: windowArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Column {
id: menuColumn
width: parent.width - Theme.spacingS * 2
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Theme.spacingS
spacing: 1
// Window list for grouped apps
Repeater {
model: {
if (!root.appData || root.appData.type !== "grouped")
return [];
const toplevels = [];
const allToplevels = ToplevelManager.toplevels.values;
for (let i = 0; i < allToplevels.length; i++) {
const toplevel = allToplevels[i];
if (toplevel.appId === root.appData.appId) {
toplevels.push(toplevel);
}
}
return toplevels;
}
Rectangle {
width: parent.width
height: 28
radius: Theme.cornerRadius
color: windowArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
StyledText {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: closeButton.left
anchors.rightMargin: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
text: (modelData && modelData.title) ? modelData.title : I18n.tr("(Unnamed)")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
Rectangle {
id: closeButton
anchors.right: parent.right
anchors.rightMargin: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
width: 20
height: 20
radius: 10
color: closeMouseArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.2) : "transparent"
DankIcon {
anchors.centerIn: parent
name: "close"
size: 12
color: closeMouseArea.containsMouse ? Theme.error : Theme.surfaceText
}
MouseArea {
id: closeMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
if (modelData && modelData.close) {
modelData.close();
}
root.close();
}
}
}
DankRipple {
id: windowRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: windowArea
anchors.fill: parent
anchors.rightMargin: 24
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => windowRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (modelData && modelData.activate) {
modelData.activate();
}
root.close();
}
}
}
StyledText {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: closeButton.left
anchors.rightMargin: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
text: (modelData && modelData.title) ? modelData.title : I18n.tr("(Unnamed)")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
Rectangle {
visible: {
if (!root.appData)
return false;
if (root.appData.type !== "grouped")
return false;
return root.appData.windowCount > 0;
}
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
}
id: closeButton
anchors.right: parent.right
anchors.rightMargin: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter
width: 20
height: 20
radius: 10
color: closeMouseArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.2) : "transparent"
Repeater {
model: root.desktopEntry && root.desktopEntry.actions ? root.desktopEntry.actions : []
Rectangle {
width: parent.width
height: 28
radius: Theme.cornerRadius
color: actionArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
Item {
anchors.verticalCenter: parent.verticalCenter
width: 16
height: 16
visible: modelData.icon && modelData.icon !== ""
IconImage {
anchors.fill: parent
source: modelData.icon ? Paths.resolveIconPath(modelData.icon) : ""
smooth: true
asynchronous: true
visible: status === Image.Ready
}
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: modelData.name || ""
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: actionRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: actionArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => actionRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (modelData) {
SessionService.launchDesktopAction(root.desktopEntry, modelData);
}
root.close();
}
}
}
}
Rectangle {
visible: {
if (!root.desktopEntry?.actions || root.desktopEntry.actions.length === 0) {
return false;
}
return !root.hidePin || (!root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand);
}
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
}
Rectangle {
visible: !root.hidePin
width: parent.width
height: 28
radius: Theme.cornerRadius
color: pinArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: root.appData && root.appData.isPinned ? "keep_off" : "push_pin"
size: 14
color: Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: root.appData && root.appData.isPinned ? I18n.tr("Unpin from Dock") : I18n.tr("Pin to Dock")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: pinRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
DankIcon {
anchors.centerIn: parent
name: "close"
size: 12
color: closeMouseArea.containsMouse ? Theme.error : Theme.surfaceText
}
MouseArea {
id: pinArea
id: closeMouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (!root.appData)
return;
if (root.appData.isPinned) {
SessionData.removePinnedApp(root.appData.appId);
} else {
SessionData.addPinnedApp(root.appData.appId);
if (modelData && modelData.close) {
modelData.close();
}
root.close();
}
}
}
Rectangle {
visible: {
const hasNvidia = !root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand;
const hasWindow = root.appData && (root.appData.type === "window" || (root.appData.type === "grouped" && root.appData.windowCount > 0));
const hasPinOption = !root.hidePin;
const hasContentAbove = hasPinOption || hasNvidia;
return hasContentAbove && hasWindow;
}
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
DankRipple {
id: windowRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
Rectangle {
visible: !root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand
width: parent.width
height: 28
radius: Theme.cornerRadius
color: nvidiaArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: "memory"
size: 14
color: Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: I18n.tr("Launch on dGPU")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: nvidiaRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: nvidiaArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => nvidiaRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (root.desktopEntry) {
SessionService.launchDesktopEntry(root.desktopEntry, true);
}
root.close();
}
}
}
Rectangle {
visible: root.appData && (root.appData.type === "window" || (root.appData.type === "grouped" && root.appData.windowCount > 0))
width: parent.width
height: 28
radius: Theme.cornerRadius
color: closeArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: "close"
size: 14
color: closeArea.containsMouse ? Theme.error : Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: root.appData && root.appData.type === "grouped" ? I18n.tr("Close All Windows") : I18n.tr("Close Window")
font.pixelSize: Theme.fontSizeSmall
color: closeArea.containsMouse ? Theme.error : Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: closeRipple
rippleColor: Theme.error
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: closeArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => closeRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (root.appData?.type === "window") {
root.appData?.toplevel?.close();
} else if (root.appData?.type === "grouped") {
root.appData?.allWindows?.forEach(window => window.toplevel?.close());
}
root.close();
MouseArea {
id: windowArea
anchors.fill: parent
anchors.rightMargin: 24
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => windowRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (modelData && modelData.activate) {
modelData.activate();
}
root.close();
}
}
}
}
MouseArea {
anchors.fill: parent
z: -1
onClicked: root.close()
Rectangle {
visible: {
if (!root.appData)
return false;
if (root.appData.type !== "grouped")
return false;
return root.appData.windowCount > 0;
}
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
}
Repeater {
model: root.desktopEntry && root.desktopEntry.actions ? root.desktopEntry.actions : []
Rectangle {
width: parent.width
height: 28
radius: Theme.cornerRadius
color: actionArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
Item {
anchors.verticalCenter: parent.verticalCenter
width: 16
height: 16
visible: modelData.icon && modelData.icon !== ""
IconImage {
anchors.fill: parent
source: modelData.icon ? Paths.resolveIconPath(modelData.icon) : ""
smooth: true
asynchronous: true
visible: status === Image.Ready
}
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: modelData.name || ""
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: actionRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: actionArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => actionRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (modelData) {
SessionService.launchDesktopAction(root.desktopEntry, modelData);
}
root.close();
}
}
}
}
Rectangle {
visible: {
if (!root.desktopEntry?.actions || root.desktopEntry.actions.length === 0) {
return false;
}
return !root.hidePin || (!root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand);
}
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
}
Rectangle {
visible: !root.hidePin
width: parent.width
height: 28
radius: Theme.cornerRadius
color: pinArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: root.appData && root.appData.isPinned ? "keep_off" : "push_pin"
size: 14
color: Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: root.appData && root.appData.isPinned ? I18n.tr("Unpin from Dock") : I18n.tr("Pin to Dock")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: pinRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: pinArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (!root.appData)
return;
if (root.appData.isPinned) {
SessionData.removePinnedApp(root.appData.appId);
} else {
SessionData.addPinnedApp(root.appData.appId);
}
root.close();
}
}
}
Rectangle {
visible: {
const hasNvidia = !root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand;
const hasWindow = root.appData && (root.appData.type === "window" || (root.appData.type === "grouped" && root.appData.windowCount > 0));
const hasPinOption = !root.hidePin;
const hasContentAbove = hasPinOption || hasNvidia;
return hasContentAbove && hasWindow;
}
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
}
Rectangle {
visible: !root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand
width: parent.width
height: 28
radius: Theme.cornerRadius
color: nvidiaArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: "memory"
size: 14
color: Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: I18n.tr("Launch on dGPU")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: nvidiaRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: nvidiaArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => nvidiaRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (root.desktopEntry) {
SessionService.launchDesktopEntry(root.desktopEntry, true);
}
root.close();
}
}
}
Rectangle {
visible: root.appData && (root.appData.type === "window" || (root.appData.type === "grouped" && root.appData.windowCount > 0))
width: parent.width
height: 28
radius: Theme.cornerRadius
color: closeArea.containsMouse ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: "close"
size: 14
color: closeArea.containsMouse ? Theme.error : Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: root.appData && root.appData.type === "grouped" ? I18n.tr("Close All Windows") : I18n.tr("Close Window")
font.pixelSize: Theme.fontSizeSmall
color: closeArea.containsMouse ? Theme.error : Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: closeRipple
rippleColor: Theme.error
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: closeArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => closeRipple.trigger(mouse.x, mouse.y)
onClicked: {
if (root.appData?.type === "window") {
root.appData?.toplevel?.close();
} else if (root.appData?.type === "grouped") {
root.appData?.allWindows?.forEach(window => window.toplevel?.close());
}
root.close();
}
}
}
}

View File

@@ -0,0 +1,199 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import qs.Common
import qs.Services
import qs.Widgets
PanelWindow {
id: root
default property alias content: menuColumn.children
property var anchorItem: null
property real dockVisibleHeight: 40
property int margin: 10
property string layerNamespace: "dms:dock-context-menu"
property real menuMaxWidth: 400
property real menuMinWidth: 180
property point anchorPos: Qt.point(screen ? screen.width / 2 : 0, screen ? screen.height - 100 : 0)
function show(button, dockHeight, dockScreen) {
if (dockScreen)
screen = dockScreen;
anchorItem = button;
dockVisibleHeight = dockHeight || 40;
visible = true;
}
function close() {
visible = false;
}
function findDockBackground(item) {
if (!item)
return null;
if (item.objectName === "dockBackground")
return item;
for (let i = 0; i < item.children.length; i++) {
const found = findDockBackground(item.children[i]);
if (found)
return found;
}
return null;
}
function updatePosition() {
if (!anchorItem || !screen) {
anchorPos = Qt.point(screen ? screen.width / 2 : 0, screen ? screen.height - 100 : 0);
return;
}
const dockWindow = anchorItem.Window.window;
if (!dockWindow) {
anchorPos = Qt.point(screen.width / 2, screen.height - 100);
return;
}
const buttonPosInDock = anchorItem.mapToItem(dockWindow.contentItem, 0, 0);
const dockBackground = findDockBackground(dockWindow.contentItem);
const actualDockHeight = dockBackground ? dockBackground.height : root.dockVisibleHeight;
const actualDockWidth = dockBackground ? dockBackground.width : dockWindow.width;
const dockMargin = SettingsData.dockMargin + 16;
let x = 0;
let y = 0;
switch (SettingsData.dockPosition) {
case SettingsData.Position.Left:
{
const dockTopMargin = Math.round((screen.height - dockWindow.height) / 2);
x = actualDockWidth + dockMargin + 20;
y = dockTopMargin + buttonPosInDock.y + anchorItem.height / 2;
break;
}
case SettingsData.Position.Right:
{
const dockTopMargin = Math.round((screen.height - dockWindow.height) / 2);
x = screen.width - actualDockWidth - dockMargin - 20;
y = dockTopMargin + buttonPosInDock.y + anchorItem.height / 2;
break;
}
case SettingsData.Position.Top:
{
const dockLeftMargin = Math.round((screen.width - dockWindow.width) / 2);
x = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2;
y = actualDockHeight + dockMargin + 20;
break;
}
case SettingsData.Position.Bottom:
default:
{
const dockLeftMargin = Math.round((screen.width - dockWindow.width) / 2);
x = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2;
y = screen.height - actualDockHeight - dockMargin - 20;
break;
}
}
anchorPos = Qt.point(x, y);
}
onAnchorItemChanged: updatePosition()
onVisibleChanged: {
if (visible)
updatePosition();
}
WindowBlur {
targetWindow: root
blurX: menuContainer.x
blurY: menuContainer.y
blurWidth: root.visible ? menuContainer.width : 0
blurHeight: root.visible ? menuContainer.height : 0
blurRadius: Theme.cornerRadius
}
WlrLayershell.namespace: root.layerNamespace
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
screen: null
visible: false
color: "transparent"
anchors {
top: true
left: true
right: true
bottom: true
}
Rectangle {
id: menuContainer
readonly property bool isVertical: SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
x: {
if (!isVertical) {
const want = root.anchorPos.x - width / 2;
return Math.max(10, Math.min(root.width - width - 10, want));
}
if (SettingsData.dockPosition === SettingsData.Position.Right)
return Math.max(10, root.anchorPos.x - width + 30);
return Math.min(root.width - width - 10, root.anchorPos.x - 30);
}
y: {
if (isVertical) {
const want = root.anchorPos.y - height / 2;
return Math.max(10, Math.min(root.height - height - 10, want));
}
if (SettingsData.dockPosition === SettingsData.Position.Bottom)
return Math.max(10, root.anchorPos.y - height + 30);
return Math.min(root.height - height - 10, root.anchorPos.y - 30);
}
width: Math.min(root.menuMaxWidth, Math.max(root.menuMinWidth, menuColumn.implicitWidth + Theme.spacingS * 2))
height: menuColumn.implicitHeight + Theme.spacingS * 2
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
radius: Theme.cornerRadius
border.color: BlurService.enabled ? BlurService.borderColor : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
border.width: BlurService.enabled ? BlurService.borderWidth : 1
opacity: root.visible ? 1 : 0
visible: opacity > 0
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing
}
}
Rectangle {
anchors.fill: parent
anchors.topMargin: 4
anchors.leftMargin: 2
anchors.rightMargin: -2
anchors.bottomMargin: -4
radius: parent.radius
color: Qt.rgba(0, 0, 0, 0.15)
z: -1
}
Column {
id: menuColumn
width: parent.width - Theme.spacingS * 2
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Theme.spacingS
spacing: 1
}
}
MouseArea {
anchors.fill: parent
z: -1
onClicked: root.close()
}
}

View File

@@ -1,5 +1,4 @@
import QtQuick
import Quickshell
import Quickshell.Widgets
import qs.Common
import qs.Services
@@ -16,40 +15,39 @@ Item {
property real actualIconSize: 40
property real hoverAnimOffset: 0
property bool isHovered: mouseArea.containsMouse
property bool showTooltip: mouseArea.containsMouse
readonly property bool isHovered: mouseArea.containsMouse
readonly property bool showTooltip: mouseArea.containsMouse
readonly property string tooltipText: TrashService.isEmpty ? I18n.tr("Trash") : (I18n.tr("Trash") + " (" + TrashService.count + ")")
readonly property bool isVertical: SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right
readonly property real animationDistance: actualIconSize
readonly property real animationDirection: {
if (SettingsData.dockPosition === SettingsData.Position.Bottom)
return -1;
if (SettingsData.dockPosition === SettingsData.Position.Top)
switch (SettingsData.dockPosition) {
case SettingsData.Position.Top:
case SettingsData.Position.Left:
return 1;
if (SettingsData.dockPosition === SettingsData.Position.Right)
case SettingsData.Position.Bottom:
case SettingsData.Position.Right:
default:
return -1;
if (SettingsData.dockPosition === SettingsData.Position.Left)
return 1;
return -1;
}
}
onIsHoveredChanged: {
if (mouseArea.pressed)
return;
if (isHovered) {
exitAnimation.stop();
if (!bounceAnimation.running)
bounceAnimation.restart();
} else {
if (!isHovered) {
bounceAnimation.stop();
exitAnimation.restart();
return;
}
exitAnimation.stop();
if (!bounceAnimation.running)
bounceAnimation.restart();
}
SequentialAnimation {
id: bounceAnimation
running: false
NumberAnimation {
@@ -73,7 +71,6 @@ Item {
NumberAnimation {
id: exitAnimation
running: false
target: root
property: "hoverAnimOffset"
@@ -85,52 +82,56 @@ Item {
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: mouse => {
if (mouse.button === Qt.LeftButton) {
switch (mouse.button) {
case Qt.LeftButton:
TrashService.openTrash();
} else if (mouse.button === Qt.RightButton) {
if (contextMenu) {
break;
case Qt.RightButton:
if (contextMenu)
contextMenu.showForButton(root, root.height, parentDockScreen, dockApps);
}
break;
}
}
}
Item {
id: visualContent
anchors.fill: parent
transform: Translate {
x: !isVertical ? 0 : hoverAnimOffset
y: !isVertical ? hoverAnimOffset : 0
x: isVertical ? hoverAnimOffset : 0
y: isVertical ? 0 : hoverAnimOffset
}
Item {
anchors.centerIn: parent
width: actualIconSize
height: actualIconSize
width: actualIconSize - 4
height: actualIconSize - 4
readonly property string iconPath: Paths.resolveIconPath(TrashService.isEmpty ? "user-trash" : "user-trash-full")
IconImage {
id: trashIcon
anchors.centerIn: parent
width: actualIconSize - 4
height: actualIconSize - 4
anchors.fill: parent
source: parent.iconPath
backer.sourceSize: Qt.size(parent.width * 2, parent.height * 2)
smooth: true
mipmap: true
asynchronous: true
source: Quickshell.iconPath(TrashService.isEmpty ? "user-trash" : "user-trash-full", "user-trash")
visible: status === Image.Ready
}
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Easing.OutCubic
}
}
DankIcon {
anchors.centerIn: parent
visible: parent.iconPath === "" || trashIcon.status !== Image.Ready
name: "delete"
size: actualIconSize - 8
color: TrashService.isEmpty ? Theme.surfaceText : Theme.primary
}
}
}

View File

@@ -1,377 +1,55 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import Quickshell.Widgets
import qs.Common
import qs.Services
import qs.Widgets
PanelWindow {
DockContextMenuBase {
id: root
WindowBlur {
targetWindow: root
blurX: menuContainer.x
blurY: menuContainer.y
blurWidth: root.visible ? menuContainer.width : 0
blurHeight: root.visible ? menuContainer.height : 0
blurRadius: Theme.cornerRadius
}
WlrLayershell.namespace: "dms:dock-trash-context-menu"
property var anchorItem: null
property real dockVisibleHeight: 40
property int margin: 10
property var dockApps: null
layerNamespace: "dms:dock-trash-context-menu"
function showForButton(button, dockHeight, dockScreen, parentDockApps) {
if (dockScreen) {
root.screen = dockScreen;
}
anchorItem = button;
dockVisibleHeight = dockHeight || 40;
dockApps = parentDockApps || null;
visible = true;
}
function close() {
visible = false;
show(button, dockHeight, dockScreen);
}
screen: null
visible: false
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
color: "transparent"
anchors {
top: true
left: true
right: true
bottom: true
}
property point anchorPos: Qt.point(screen ? screen.width / 2 : 0, screen ? screen.height - 100 : 0)
onAnchorItemChanged: updatePosition()
onVisibleChanged: {
if (visible) {
updatePosition();
DockTrashMenuItem {
width: parent.width
iconName: "folder_open"
text: I18n.tr("Open Trash")
onTriggered: {
TrashService.openTrash();
root.close();
}
}
function updatePosition() {
if (!anchorItem || !screen) {
anchorPos = Qt.point(screen ? screen.width / 2 : 0, screen ? screen.height - 100 : 0);
return;
DockTrashMenuItem {
width: parent.width
iconName: "delete_forever"
isDestructive: true
enabled: !TrashService.isEmpty
text: TrashService.isEmpty ? I18n.tr("Empty Trash") : I18n.tr("Empty Trash (%1)").arg(TrashService.count)
onTriggered: {
TrashService.requestEmptyTrash();
root.close();
}
const dockWindow = anchorItem.Window.window;
if (!dockWindow) {
anchorPos = Qt.point(screen.width / 2, screen.height - 100);
return;
}
const buttonPosInDock = anchorItem.mapToItem(dockWindow.contentItem, 0, 0);
let actualDockHeight = root.dockVisibleHeight;
function findDockBackground(item) {
if (item.objectName === "dockBackground") {
return item;
}
for (var i = 0; i < item.children.length; i++) {
const found = findDockBackground(item.children[i]);
if (found) {
return found;
}
}
return null;
}
const dockBackground = findDockBackground(dockWindow.contentItem);
let actualDockWidth = dockWindow.width;
if (dockBackground) {
actualDockHeight = dockBackground.height;
actualDockWidth = dockBackground.width;
}
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
const dockMargin = SettingsData.dockMargin + 16;
let buttonScreenX, buttonScreenY;
if (isVertical) {
const dockContentHeight = dockWindow.height;
const screenHeight = root.screen.height;
const dockTopMargin = Math.round((screenHeight - dockContentHeight) / 2);
buttonScreenY = dockTopMargin + buttonPosInDock.y + anchorItem.height / 2;
if (SettingsData.dockPosition === SettingsData.Position.Right) {
buttonScreenX = root.screen.width - actualDockWidth - dockMargin - 20;
} else {
buttonScreenX = actualDockWidth + dockMargin + 20;
}
} else {
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
if (isDockAtBottom) {
buttonScreenY = root.screen.height - actualDockHeight - dockMargin - 20;
} else {
buttonScreenY = actualDockHeight + dockMargin + 20;
}
const dockContentWidth = dockWindow.width;
const screenWidth = root.screen.width;
const dockLeftMargin = Math.round((screenWidth - dockContentWidth) / 2);
buttonScreenX = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2;
}
anchorPos = Qt.point(buttonScreenX, buttonScreenY);
}
Rectangle {
id: menuContainer
x: {
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
if (isVertical) {
const isDockAtRight = SettingsData.dockPosition === SettingsData.Position.Right;
if (isDockAtRight) {
return Math.max(10, root.anchorPos.x - width + 30);
} else {
return Math.min(root.width - width - 10, root.anchorPos.x - 30);
}
} else {
const left = 10;
const right = root.width - width - 10;
const want = root.anchorPos.x - width / 2;
return Math.max(left, Math.min(right, want));
}
}
y: {
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
if (isVertical) {
const top = 10;
const bottom = root.height - height - 10;
const want = root.anchorPos.y - height / 2;
return Math.max(top, Math.min(bottom, want));
} else {
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
if (isDockAtBottom) {
return Math.max(10, root.anchorPos.y - height + 30);
} else {
return Math.min(root.height - height - 10, root.anchorPos.y - 30);
}
}
}
width: Math.min(400, Math.max(180, menuColumn.implicitWidth + Theme.spacingS * 2))
height: menuColumn.implicitHeight + Theme.spacingS * 2
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
radius: Theme.cornerRadius
border.color: BlurService.enabled ? BlurService.borderColor : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
border.width: BlurService.enabled ? BlurService.borderWidth : 1
opacity: root.visible ? 1 : 0
visible: opacity > 0
Behavior on opacity {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing
}
}
Rectangle {
anchors.fill: parent
anchors.topMargin: 4
anchors.leftMargin: 2
anchors.rightMargin: -2
anchors.bottomMargin: -4
radius: parent.radius
color: Qt.rgba(0, 0, 0, 0.15)
z: -1
}
Column {
id: menuColumn
width: parent.width - Theme.spacingS * 2
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: Theme.spacingS
spacing: 1
Rectangle {
width: parent.width
height: 28
radius: Theme.cornerRadius
color: openArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: "folder_open"
size: 14
color: Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: I18n.tr("Open Trash")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: openRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: openArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => openRipple.trigger(mouse.x, mouse.y)
onClicked: {
TrashService.openTrash();
root.close();
}
}
}
Rectangle {
width: parent.width
height: 28
radius: Theme.cornerRadius
enabled: !TrashService.isEmpty
opacity: enabled ? 1 : 0.4
color: emptyArea.containsMouse && enabled ? Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: "delete_forever"
size: 14
color: emptyArea.containsMouse && parent.parent.enabled ? Theme.error : Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: TrashService.isEmpty ? I18n.tr("Empty Trash") : I18n.tr("Empty Trash (%1)").arg(TrashService.count)
font.pixelSize: Theme.fontSizeSmall
color: emptyArea.containsMouse && parent.parent.enabled ? Theme.error : Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: emptyRipple
rippleColor: Theme.error
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: emptyArea
anchors.fill: parent
hoverEnabled: true
enabled: parent.enabled
cursorShape: Qt.PointingHandCursor
onPressed: mouse => emptyRipple.trigger(mouse.x, mouse.y)
onClicked: {
TrashService.requestEmptyTrash();
root.close();
}
}
}
Rectangle {
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
}
Rectangle {
width: parent.width
height: 28
radius: Theme.cornerRadius
color: settingsArea.containsMouse ? BlurService.hoverColor(Theme.widgetBaseHoverColor) : "transparent"
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: "settings"
size: 14
color: Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: I18n.tr("Settings")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: settingsRipple
rippleColor: Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: settingsArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onPressed: mouse => settingsRipple.trigger(mouse.x, mouse.y)
onClicked: {
PopoutService.focusOrToggleSettingsWithTab("dock");
root.close();
}
}
}
}
width: parent.width
height: 1
color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
}
MouseArea {
anchors.fill: parent
z: -1
onClicked: root.close()
DockTrashMenuItem {
width: parent.width
iconName: "settings"
text: I18n.tr("Settings")
onTriggered: {
SettingsSearchService.navigateToSection("dockTrash");
PopoutService.openSettingsWithTab("dock");
root.close();
}
}
}

View File

@@ -0,0 +1,69 @@
import QtQuick
import qs.Common
import qs.Services
import qs.Widgets
Rectangle {
id: root
property string iconName: ""
property string text: ""
property bool isDestructive: false
property bool enabled: true
signal triggered
height: 28
radius: Theme.cornerRadius
opacity: enabled ? 1 : 0.4
color: {
if (!area.containsMouse || !enabled)
return "transparent";
if (isDestructive)
return Qt.rgba(Theme.error.r, Theme.error.g, Theme.error.b, 0.12);
return BlurService.hoverColor(Theme.widgetBaseHoverColor);
}
Row {
anchors.left: parent.left
anchors.leftMargin: Theme.spacingS
anchors.right: parent.right
anchors.rightMargin: Theme.spacingS
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankIcon {
anchors.verticalCenter: parent.verticalCenter
name: root.iconName
size: 14
color: root.isDestructive && area.containsMouse && root.enabled ? Theme.error : Theme.surfaceText
opacity: 0.7
}
StyledText {
anchors.verticalCenter: parent.verticalCenter
text: root.text
font.pixelSize: Theme.fontSizeSmall
color: root.isDestructive && area.containsMouse && root.enabled ? Theme.error : Theme.surfaceText
font.weight: Font.Normal
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
}
DankRipple {
id: ripple
rippleColor: root.isDestructive ? Theme.error : Theme.surfaceText
cornerRadius: Theme.cornerRadius
}
MouseArea {
id: area
anchors.fill: parent
hoverEnabled: true
enabled: root.enabled
cursorShape: Qt.PointingHandCursor
onPressed: mouse => ripple.trigger(mouse.x, mouse.y)
onClicked: root.triggered()
}
}

View File

@@ -558,22 +558,9 @@ Item {
backgroundColor: Theme.surfaceContainerHighest
normalBorderColor: Theme.outlineMedium
focusedBorderColor: Theme.primary
Component.onCompleted: {
if (SettingsData.dockTrashCustomCommand) {
text = SettingsData.dockTrashCustomCommand;
}
}
text: SettingsData.dockTrashCustomCommand
onTextEdited: SettingsData.set("dockTrashCustomCommand", text.trim())
MouseArea {
anchors.fill: parent
onPressed: mouse => {
trashCustomCommandField.forceActiveFocus();
mouse.accepted = false;
}
}
}
}
}