mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-27 15:02:50 -05:00
feat: Dock overflow & New setting options
This commit is contained in:
@@ -29,6 +29,15 @@ Item {
|
||||
property bool showTooltip: mouseArea.containsMouse && !dragging
|
||||
property var cachedDesktopEntry: null
|
||||
property real actualIconSize: 40
|
||||
property bool shouldShowIndicator: {
|
||||
if (!appData)
|
||||
return false;
|
||||
if (appData.type === "window")
|
||||
return true;
|
||||
if (appData.type === "grouped")
|
||||
return appData.windowCount > 0;
|
||||
return appData.isRunning;
|
||||
}
|
||||
readonly property string coreIconColorOverride: SettingsData.dockLauncherLogoColorOverride
|
||||
readonly property bool coreIconHasCustomColor: coreIconColorOverride !== "" && coreIconColorOverride !== "primary" && coreIconColorOverride !== "surface"
|
||||
readonly property color effectiveCoreIconColor: {
|
||||
@@ -206,9 +215,20 @@ Item {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: true
|
||||
preventStealing: true
|
||||
// Prevent stealing during drag operations
|
||||
// Also prevent stealing when NOT in scroll mode (original behavior)
|
||||
// Only allow Flickable to steal when scrollable AND not dragging
|
||||
preventStealing: dragging || longPressing || !(dockApps && dockApps.canScroll)
|
||||
cursorShape: longPressing ? Qt.DragMoveCursor : Qt.PointingHandCursor
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
onWheel: (wheel) => {
|
||||
// Only handle wheel if we're NOT in scrollable mode
|
||||
if (dockApps && dockApps.canScroll) {
|
||||
wheel.accepted = false // Allow event to propagate to Flickable
|
||||
} else {
|
||||
wheel.accepted = true // Consume event (no scrolling needed)
|
||||
}
|
||||
}
|
||||
onPressed: mouse => {
|
||||
if (mouse.button === Qt.LeftButton && appData && appData.isPinned) {
|
||||
dragStartPos = Qt.point(mouse.x, mouse.y);
|
||||
@@ -221,8 +241,14 @@ Item {
|
||||
const wasDragging = dragging;
|
||||
const didReorder = wasDragging && targetIndex >= 0 && targetIndex !== originalIndex && dockApps;
|
||||
|
||||
if (didReorder)
|
||||
console.warn("DockAppButton onReleased:", appData?.appId || "unknown");
|
||||
console.warn(" wasDragging:", wasDragging, "originalIndex:", originalIndex, "targetIndex:", targetIndex);
|
||||
console.warn(" didReorder:", didReorder);
|
||||
|
||||
if (didReorder) {
|
||||
// Use movePinnedApp which takes dock indices (original behavior)
|
||||
dockApps.movePinnedApp(originalIndex, targetIndex);
|
||||
}
|
||||
|
||||
longPressing = false;
|
||||
dragging = false;
|
||||
@@ -295,7 +321,7 @@ Item {
|
||||
groupedToplevel.activate();
|
||||
} else if (contextMenu) {
|
||||
const shouldHidePin = appData.appId === "org.quickshell";
|
||||
contextMenu.showForButton(root, appData, root.height + 25, shouldHidePin, cachedDesktopEntry, parentDockScreen);
|
||||
contextMenu.showForButton(root, appData, root.height + 25, shouldHidePin, cachedDesktopEntry, parentDockScreen, dockApps);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -305,6 +331,7 @@ Item {
|
||||
const distance = Math.sqrt(Math.pow(mouse.x - dragStartPos.x, 2) + Math.pow(mouse.y - dragStartPos.y, 2));
|
||||
if (distance > 5) {
|
||||
dragging = true;
|
||||
// Use dock index directly (original behavior)
|
||||
targetIndex = index;
|
||||
originalIndex = index;
|
||||
if (dockApps) {
|
||||
@@ -323,6 +350,7 @@ Item {
|
||||
const spacing = Math.min(8, Math.max(4, actualIconSize * 0.08));
|
||||
const itemSize = actualIconSize * 1.2 + spacing;
|
||||
const slotOffset = Math.round(axisOffset / itemSize);
|
||||
// Use pinnedAppCount as max (original behavior)
|
||||
const newTargetIndex = Math.max(0, Math.min(dockApps.pinnedAppCount - 1, originalIndex + slotOffset));
|
||||
|
||||
if (newTargetIndex !== targetIndex) {
|
||||
@@ -342,7 +370,7 @@ Item {
|
||||
case "grouped":
|
||||
if (contextMenu) {
|
||||
const shouldHidePin = appData.appId === "org.quickshell";
|
||||
contextMenu.showForButton(root, appData, root.height, shouldHidePin, cachedDesktopEntry, parentDockScreen);
|
||||
contextMenu.showForButton(root, appData, root.height, shouldHidePin, cachedDesktopEntry, parentDockScreen, dockApps);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -365,7 +393,7 @@ Item {
|
||||
if (!contextMenu)
|
||||
return;
|
||||
const shouldHidePin = appData.appId === "org.quickshell";
|
||||
contextMenu.showForButton(root, appData, root.height, shouldHidePin, cachedDesktopEntry, parentDockScreen);
|
||||
contextMenu.showForButton(root, appData, root.height, shouldHidePin, cachedDesktopEntry, parentDockScreen, dockApps);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,15 +526,7 @@ Item {
|
||||
|
||||
sourceComponent: SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right ? columnIndicator : rowIndicator
|
||||
|
||||
visible: {
|
||||
if (!appData)
|
||||
return false;
|
||||
if (appData.type === "window")
|
||||
return true;
|
||||
if (appData.type === "grouped")
|
||||
return appData.windowCount > 0;
|
||||
return appData.isRunning;
|
||||
}
|
||||
visible: root.shouldShowIndicator
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user