1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-30 00:12:50 -05:00

dock: some cleanup to overflow

This commit is contained in:
bbedward
2026-01-26 16:05:22 -05:00
parent 14a3a0ae55
commit 9d1d73a845
9 changed files with 593 additions and 866 deletions

View File

@@ -443,8 +443,8 @@ Singleton {
property int dockLauncherLogoSizeOffset: 0 property int dockLauncherLogoSizeOffset: 0
property real dockLauncherLogoBrightness: 0.5 property real dockLauncherLogoBrightness: 0.5
property real dockLauncherLogoContrast: 1 property real dockLauncherLogoContrast: 1
property int dockMaxVisibleApps: 10 property int dockMaxVisibleApps: 0
property int dockMaxVisibleRunningApps: 10 property int dockMaxVisibleRunningApps: 0
property bool dockShowOverflowBadge: true property bool dockShowOverflowBadge: true
property bool notificationOverlayEnabled: false property bool notificationOverlayEnabled: false

View File

@@ -272,8 +272,8 @@ var SPEC = {
dockLauncherLogoSizeOffset: { def: 0 }, dockLauncherLogoSizeOffset: { def: 0 },
dockLauncherLogoBrightness: { def: 0.5, coerce: percentToUnit }, dockLauncherLogoBrightness: { def: 0.5, coerce: percentToUnit },
dockLauncherLogoContrast: { def: 1, coerce: percentToUnit }, dockLauncherLogoContrast: { def: 1, coerce: percentToUnit },
dockMaxVisibleApps: { def: 10 }, dockMaxVisibleApps: { def: 0 },
dockMaxVisibleRunningApps: { def: 10 }, dockMaxVisibleRunningApps: { def: 0 },
dockShowOverflowBadge: { def: true }, dockShowOverflowBadge: { def: true },
notificationOverlayEnabled: { def: false }, notificationOverlayEnabled: { def: false },

View File

@@ -437,21 +437,19 @@ Variants {
height: { height: {
if (dock.isVertical) { if (dock.isVertical) {
const extra = 4 + dock.borderThickness; if (!dock.reveal)
const hiddenHeight = Math.min(Math.max(dockBackground.implicitHeight + 64, 200), screenHeight * 0.5); return Math.min(Math.max(dockBackground.height + 64, 200), screenHeight * 0.5);
return dock.reveal ? Math.max(Math.min(dockBackground.implicitHeight + extra, maxDockHeight), hiddenHeight) : hiddenHeight; return Math.min(dockBackground.height + 8 + dock.borderThickness, maxDockHeight);
} else {
return dock.reveal ? px(dock.effectiveBarHeight + SettingsData.dockSpacing + SettingsData.dockBottomGap + SettingsData.dockMargin) : 1;
} }
return dock.reveal ? px(dock.effectiveBarHeight + SettingsData.dockSpacing + SettingsData.dockBottomGap + SettingsData.dockMargin) : 1;
} }
width: { width: {
if (dock.isVertical) { if (dock.isVertical) {
return dock.reveal ? px(dock.effectiveBarHeight + SettingsData.dockSpacing + SettingsData.dockBottomGap + SettingsData.dockMargin) : 1; return dock.reveal ? px(dock.effectiveBarHeight + SettingsData.dockSpacing + SettingsData.dockBottomGap + SettingsData.dockMargin) : 1;
} else {
const extra = 4 + dock.borderThickness;
const hiddenWidth = Math.min(Math.max(dockBackground.implicitWidth + 64, 200), screenWidth * 0.5);
return dock.reveal ? Math.max(Math.min(dockBackground.implicitWidth + extra, maxDockWidth), hiddenWidth) : hiddenWidth;
} }
if (!dock.reveal)
return Math.min(Math.max(dockBackground.width + 64, 200), screenWidth * 0.5);
return Math.min(dockBackground.width + 8 + dock.borderThickness, maxDockWidth);
} }
anchors { anchors {
top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? undefined : parent.top) : undefined top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? undefined : parent.top) : undefined
@@ -533,6 +531,7 @@ Variants {
anchors { anchors {
top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Top ? parent.top : undefined) : undefined top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Top ? parent.top : undefined) : undefined
bottom: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? parent.bottom : undefined) : undefined bottom: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? parent.bottom : undefined) : undefined
horizontalCenter: !dock.isVertical ? parent.horizontalCenter : undefined
left: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Left ? parent.left : undefined) : undefined left: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Left ? parent.left : undefined) : undefined
right: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? parent.right : undefined) : undefined right: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? parent.right : undefined) : undefined
verticalCenter: dock.isVertical ? parent.verticalCenter : undefined verticalCenter: dock.isVertical ? parent.verticalCenter : undefined
@@ -542,23 +541,11 @@ Variants {
anchors.leftMargin: dock.isVertical && SettingsData.dockPosition === SettingsData.Position.Left ? barSpacing + SettingsData.dockMargin + 1 + dock.borderThickness : 0 anchors.leftMargin: dock.isVertical && SettingsData.dockPosition === SettingsData.Position.Left ? barSpacing + SettingsData.dockMargin + 1 + dock.borderThickness : 0
anchors.rightMargin: dock.isVertical && SettingsData.dockPosition === SettingsData.Position.Right ? barSpacing + SettingsData.dockMargin + 1 + dock.borderThickness : 0 anchors.rightMargin: dock.isVertical && SettingsData.dockPosition === SettingsData.Position.Right ? barSpacing + SettingsData.dockMargin + 1 + dock.borderThickness : 0
readonly property real baseImplicitWidth: dock.isVertical ? (dockApps.baseImplicitHeight + SettingsData.dockSpacing * 2) : (dockApps.baseImplicitWidth + SettingsData.dockSpacing * 2)
readonly property real baseImplicitHeight: dock.isVertical ? (dockApps.baseImplicitWidth + SettingsData.dockSpacing * 2) : (dockApps.baseImplicitHeight + SettingsData.dockSpacing * 2)
implicitWidth: dock.isVertical ? (dockApps.implicitHeight + SettingsData.dockSpacing * 2) : (dockApps.implicitWidth + SettingsData.dockSpacing * 2) implicitWidth: dock.isVertical ? (dockApps.implicitHeight + SettingsData.dockSpacing * 2) : (dockApps.implicitWidth + SettingsData.dockSpacing * 2)
implicitHeight: dock.isVertical ? (dockApps.implicitWidth + SettingsData.dockSpacing * 2) : (dockApps.implicitHeight + SettingsData.dockSpacing * 2) implicitHeight: dock.isVertical ? (dockApps.implicitWidth + SettingsData.dockSpacing * 2) : (dockApps.implicitHeight + SettingsData.dockSpacing * 2)
width: implicitWidth width: implicitWidth
height: implicitHeight height: implicitHeight
x: {
if (dock.isVertical)
return 0;
const targetWidth = (dockApps.overflowExpanded) ? implicitWidth : baseImplicitWidth;
const centered = (parent.width - targetWidth) / 2;
return Math.max(0, centered);
}
layer.enabled: true layer.enabled: true
clip: false clip: false
@@ -636,12 +623,13 @@ Variants {
anchors.top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Top ? dockBackground.top : undefined) : undefined anchors.top: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Top ? dockBackground.top : undefined) : undefined
anchors.bottom: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? dockBackground.bottom : undefined) : undefined anchors.bottom: !dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Bottom ? dockBackground.bottom : undefined) : undefined
anchors.left: !dock.isVertical ? dockBackground.left : (SettingsData.dockPosition === SettingsData.Position.Left ? dockBackground.left : undefined) anchors.horizontalCenter: !dock.isVertical ? dockBackground.horizontalCenter : undefined
anchors.left: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Left ? dockBackground.left : undefined) : undefined
anchors.right: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? dockBackground.right : undefined) : undefined anchors.right: dock.isVertical ? (SettingsData.dockPosition === SettingsData.Position.Right ? dockBackground.right : undefined) : undefined
anchors.verticalCenter: dock.isVertical ? dockBackground.verticalCenter : undefined anchors.verticalCenter: dock.isVertical ? dockBackground.verticalCenter : undefined
anchors.topMargin: !dock.isVertical ? SettingsData.dockSpacing : 0 anchors.topMargin: !dock.isVertical ? SettingsData.dockSpacing : 0
anchors.bottomMargin: !dock.isVertical ? SettingsData.dockSpacing : 0 anchors.bottomMargin: !dock.isVertical ? SettingsData.dockSpacing : 0
anchors.leftMargin: SettingsData.dockSpacing anchors.leftMargin: dock.isVertical ? SettingsData.dockSpacing : 0
anchors.rightMargin: dock.isVertical ? SettingsData.dockSpacing : 0 anchors.rightMargin: dock.isVertical ? SettingsData.dockSpacing : 0
contextMenu: dockVariants.contextMenu contextMenu: dockVariants.contextMenu
@@ -649,27 +637,6 @@ Variants {
isVertical: dock.isVertical isVertical: dock.isVertical
dockScreen: dock.screen dockScreen: dock.screen
iconSize: dock.widgetHeight iconSize: dock.widgetHeight
maxAvailableLength: {
const border = (SettingsData.dockBorderEnabled ? dock.borderThickness * 2 : 0);
const internalPadding = SettingsData.dockSpacing * 2;
if (dock.isVertical) {
// Calculate vertical space available for apps
const maxH = dockMouseArea.maxDockHeight;
const vMargins = (dockBackground.anchors.topMargin || 0) + (dockBackground.anchors.bottomMargin || 0);
const result = maxH - vMargins - internalPadding - border;
console.warn("Dock: maxAvailableLength (V):", result, "= maxH:", maxH, "- margins:", vMargins, "- padding:", internalPadding, "- border:", border);
return Math.max(0, result); // Ensure non-negative
} else {
// Calculate horizontal space available for apps
const maxW = dockMouseArea.maxDockWidth;
const hMargins = (dockBackground.anchors.leftMargin || 0) + (dockBackground.anchors.rightMargin || 0);
const result = maxW - hMargins - internalPadding - border;
console.warn("Dock: maxAvailableLength (H):", result, "= maxW:", maxW, "- margins:", hMargins, "- padding:", internalPadding, "- border:", border);
return Math.max(0, result); // Ensure non-negative
}
}
} }
} }
} }

View File

@@ -215,20 +215,9 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
enabled: true enabled: true
// Prevent stealing during drag operations preventStealing: dragging || longPressing
// 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 cursorShape: longPressing ? Qt.DragMoveCursor : Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton 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 => { onPressed: mouse => {
if (mouse.button === Qt.LeftButton && appData && appData.isPinned) { if (mouse.button === Qt.LeftButton && appData && appData.isPinned) {
dragStartPos = Qt.point(mouse.x, mouse.y); dragStartPos = Qt.point(mouse.x, mouse.y);
@@ -241,14 +230,8 @@ Item {
const wasDragging = dragging; const wasDragging = dragging;
const didReorder = wasDragging && targetIndex >= 0 && targetIndex !== originalIndex && dockApps; const didReorder = wasDragging && targetIndex >= 0 && targetIndex !== originalIndex && dockApps;
console.warn("DockAppButton onReleased:", appData?.appId || "unknown"); if (didReorder)
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); dockApps.movePinnedApp(originalIndex, targetIndex);
}
longPressing = false; longPressing = false;
dragging = false; dragging = false;
@@ -331,7 +314,6 @@ Item {
const distance = Math.sqrt(Math.pow(mouse.x - dragStartPos.x, 2) + Math.pow(mouse.y - dragStartPos.y, 2)); const distance = Math.sqrt(Math.pow(mouse.x - dragStartPos.x, 2) + Math.pow(mouse.y - dragStartPos.y, 2));
if (distance > 5) { if (distance > 5) {
dragging = true; dragging = true;
// Use dock index directly (original behavior)
targetIndex = index; targetIndex = index;
originalIndex = index; originalIndex = index;
if (dockApps) { if (dockApps) {
@@ -350,7 +332,6 @@ Item {
const spacing = Math.min(8, Math.max(4, actualIconSize * 0.08)); const spacing = Math.min(8, Math.max(4, actualIconSize * 0.08));
const itemSize = actualIconSize * 1.2 + spacing; const itemSize = actualIconSize * 1.2 + spacing;
const slotOffset = Math.round(axisOffset / itemSize); const slotOffset = Math.round(axisOffset / itemSize);
// Use pinnedAppCount as max (original behavior)
const newTargetIndex = Math.max(0, Math.min(dockApps.pinnedAppCount - 1, originalIndex + slotOffset)); const newTargetIndex = Math.max(0, Math.min(dockApps.pinnedAppCount - 1, originalIndex + slotOffset));
if (newTargetIndex !== targetIndex) { if (newTargetIndex !== targetIndex) {

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
import QtQuick import QtQuick
import Quickshell import Quickshell
import Quickshell.Wayland import Quickshell.Wayland
import Quickshell.Hyprland
import Quickshell.Widgets import Quickshell.Widgets
import qs.Common import qs.Common
import qs.Services import qs.Services
@@ -23,20 +22,20 @@ PanelWindow {
function showForButton(button, data, dockHeight, hidePinOption, entry, dockScreen, parentDockApps) { function showForButton(button, data, dockHeight, hidePinOption, entry, dockScreen, parentDockApps) {
if (dockScreen) { if (dockScreen) {
root.screen = dockScreen root.screen = dockScreen;
} }
anchorItem = button anchorItem = button;
appData = data appData = data;
dockVisibleHeight = dockHeight || 40 dockVisibleHeight = dockHeight || 40;
hidePin = hidePinOption || false hidePin = hidePinOption || false;
desktopEntry = entry || null desktopEntry = entry || null;
dockApps = parentDockApps || null dockApps = parentDockApps || null;
visible = true visible = true;
} }
function close() { function close() {
visible = false visible = false;
} }
screen: null screen: null
@@ -57,110 +56,110 @@ PanelWindow {
onAnchorItemChanged: updatePosition() onAnchorItemChanged: updatePosition()
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
updatePosition() updatePosition();
} }
} }
function updatePosition() { function updatePosition() {
if (!anchorItem) { if (!anchorItem) {
anchorPos = Qt.point(screen.width / 2, screen.height - 100) anchorPos = Qt.point(screen.width / 2, screen.height - 100);
return return;
} }
const dockWindow = anchorItem.Window.window const dockWindow = anchorItem.Window.window;
if (!dockWindow) { if (!dockWindow) {
anchorPos = Qt.point(screen.width / 2, screen.height - 100) anchorPos = Qt.point(screen.width / 2, screen.height - 100);
return return;
} }
const buttonPosInDock = anchorItem.mapToItem(dockWindow.contentItem, 0, 0) const buttonPosInDock = anchorItem.mapToItem(dockWindow.contentItem, 0, 0);
let actualDockHeight = root.dockVisibleHeight let actualDockHeight = root.dockVisibleHeight;
function findDockBackground(item) { function findDockBackground(item) {
if (item.objectName === "dockBackground") { if (item.objectName === "dockBackground") {
return item return item;
} }
for (var i = 0; i < item.children.length; i++) { for (var i = 0; i < item.children.length; i++) {
const found = findDockBackground(item.children[i]) const found = findDockBackground(item.children[i]);
if (found) { if (found) {
return found return found;
} }
} }
return null return null;
} }
const dockBackground = findDockBackground(dockWindow.contentItem) const dockBackground = findDockBackground(dockWindow.contentItem);
let actualDockWidth = dockWindow.width let actualDockWidth = dockWindow.width;
if (dockBackground) { if (dockBackground) {
actualDockHeight = dockBackground.height actualDockHeight = dockBackground.height;
actualDockWidth = dockBackground.width actualDockWidth = dockBackground.width;
} }
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
const dockMargin = SettingsData.dockMargin + 16 const dockMargin = SettingsData.dockMargin + 16;
let buttonScreenX, buttonScreenY let buttonScreenX, buttonScreenY;
if (isVertical) { if (isVertical) {
const dockContentHeight = dockWindow.height const dockContentHeight = dockWindow.height;
const screenHeight = root.screen.height const screenHeight = root.screen.height;
const dockTopMargin = Math.round((screenHeight - dockContentHeight) / 2) const dockTopMargin = Math.round((screenHeight - dockContentHeight) / 2);
buttonScreenY = dockTopMargin + buttonPosInDock.y + anchorItem.height / 2 buttonScreenY = dockTopMargin + buttonPosInDock.y + anchorItem.height / 2;
if (SettingsData.dockPosition === SettingsData.Position.Right) { if (SettingsData.dockPosition === SettingsData.Position.Right) {
buttonScreenX = root.screen.width - actualDockWidth - dockMargin - 20 buttonScreenX = root.screen.width - actualDockWidth - dockMargin - 20;
} else { } else {
buttonScreenX = actualDockWidth + dockMargin + 20 buttonScreenX = actualDockWidth + dockMargin + 20;
} }
} else { } else {
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
if (isDockAtBottom) { if (isDockAtBottom) {
buttonScreenY = root.screen.height - actualDockHeight - dockMargin - 20 buttonScreenY = root.screen.height - actualDockHeight - dockMargin - 20;
} else { } else {
buttonScreenY = actualDockHeight + dockMargin + 20 buttonScreenY = actualDockHeight + dockMargin + 20;
} }
const dockContentWidth = dockWindow.width const dockContentWidth = dockWindow.width;
const screenWidth = root.screen.width const screenWidth = root.screen.width;
const dockLeftMargin = Math.round((screenWidth - dockContentWidth) / 2) const dockLeftMargin = Math.round((screenWidth - dockContentWidth) / 2);
buttonScreenX = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2 buttonScreenX = dockLeftMargin + buttonPosInDock.x + anchorItem.width / 2;
} }
anchorPos = Qt.point(buttonScreenX, buttonScreenY) anchorPos = Qt.point(buttonScreenX, buttonScreenY);
} }
Rectangle { Rectangle {
id: menuContainer id: menuContainer
x: { x: {
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
if (isVertical) { if (isVertical) {
const isDockAtRight = SettingsData.dockPosition === SettingsData.Position.Right const isDockAtRight = SettingsData.dockPosition === SettingsData.Position.Right;
if (isDockAtRight) { if (isDockAtRight) {
return Math.max(10, root.anchorPos.x - width + 30) return Math.max(10, root.anchorPos.x - width + 30);
} else { } else {
return Math.min(root.width - width - 10, root.anchorPos.x - 30) return Math.min(root.width - width - 10, root.anchorPos.x - 30);
} }
} else { } else {
const left = 10 const left = 10;
const right = root.width - width - 10 const right = root.width - width - 10;
const want = root.anchorPos.x - width / 2 const want = root.anchorPos.x - width / 2;
return Math.max(left, Math.min(right, want)) return Math.max(left, Math.min(right, want));
} }
} }
y: { y: {
const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right const isVertical = SettingsData.dockPosition === SettingsData.Position.Left || SettingsData.dockPosition === SettingsData.Position.Right;
if (isVertical) { if (isVertical) {
const top = 10 const top = 10;
const bottom = root.height - height - 10 const bottom = root.height - height - 10;
const want = root.anchorPos.y - height / 2 const want = root.anchorPos.y - height / 2;
return Math.max(top, Math.min(bottom, want)) return Math.max(top, Math.min(bottom, want));
} else { } else {
const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom const isDockAtBottom = SettingsData.dockPosition === SettingsData.Position.Bottom;
if (isDockAtBottom) { if (isDockAtBottom) {
return Math.max(10, root.anchorPos.y - height + 30) return Math.max(10, root.anchorPos.y - height + 30);
} else { } else {
return Math.min(root.height - height - 10, root.anchorPos.y - 30) return Math.min(root.height - height - 10, root.anchorPos.y - 30);
} }
} }
} }
@@ -204,17 +203,18 @@ PanelWindow {
// Window list for grouped apps // Window list for grouped apps
Repeater { Repeater {
model: { model: {
if (!root.appData || root.appData.type !== "grouped") return [] if (!root.appData || root.appData.type !== "grouped")
return [];
const toplevels = [] const toplevels = [];
const allToplevels = ToplevelManager.toplevels.values const allToplevels = ToplevelManager.toplevels.values;
for (let i = 0; i < allToplevels.length; i++) { for (let i = 0; i < allToplevels.length; i++) {
const toplevel = allToplevels[i] const toplevel = allToplevels[i];
if (toplevel.appId === root.appData.appId) { if (toplevel.appId === root.appData.appId) {
toplevels.push(toplevel) toplevels.push(toplevel);
} }
} }
return toplevels return toplevels;
} }
Rectangle { Rectangle {
@@ -229,7 +229,7 @@ PanelWindow {
anchors.right: closeButton.left anchors.right: closeButton.left
anchors.rightMargin: Theme.spacingXS anchors.rightMargin: Theme.spacingXS
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: (modelData && modelData.title) ? modelData.title: I18n.tr("(Unnamed)") text: (modelData && modelData.title) ? modelData.title : I18n.tr("(Unnamed)")
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText color: Theme.surfaceText
font.weight: Font.Normal font.weight: Font.Normal
@@ -261,9 +261,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (modelData && modelData.close) { if (modelData && modelData.close) {
modelData.close() modelData.close();
} }
root.close() root.close();
} }
} }
} }
@@ -276,9 +276,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (modelData && modelData.activate) { if (modelData && modelData.activate) {
modelData.activate() modelData.activate();
} }
root.close() root.close();
} }
} }
} }
@@ -286,9 +286,11 @@ PanelWindow {
Rectangle { Rectangle {
visible: { visible: {
if (!root.appData) return false if (!root.appData)
if (root.appData.type !== "grouped") return false return false;
return root.appData.windowCount > 0 if (root.appData.type !== "grouped")
return false;
return root.appData.windowCount > 0;
} }
width: parent.width width: parent.width
height: 1 height: 1
@@ -345,9 +347,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (modelData) { if (modelData) {
SessionService.launchDesktopAction(root.desktopEntry, modelData) SessionService.launchDesktopAction(root.desktopEntry, modelData);
} }
root.close() root.close();
} }
} }
} }
@@ -356,9 +358,9 @@ PanelWindow {
Rectangle { Rectangle {
visible: { visible: {
if (!root.desktopEntry?.actions || root.desktopEntry.actions.length === 0) { if (!root.desktopEntry?.actions || root.desktopEntry.actions.length === 0) {
return false return false;
} }
return !root.hidePin || (!root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand) return !root.hidePin || (!root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand);
} }
width: parent.width width: parent.width
height: 1 height: 1
@@ -392,36 +394,26 @@ PanelWindow {
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (!root.appData) { if (!root.appData)
return return;
}
if (root.appData.isPinned) {
SessionData.removePinnedApp(root.appData.appId)
} else {
SessionData.addPinnedApp(root.appData.appId)
// Auto-expand overflow if pinning would exceed limit if (root.appData.isPinned) {
if (root.dockApps) { SessionData.removePinnedApp(root.appData.appId);
Qt.callLater(() => { } else {
const newPinnedCount = SessionData.pinnedApps.length; SessionData.addPinnedApp(root.appData.appId);
if (newPinnedCount > root.dockApps.maxVisibleApps && root.dockApps.overflowItemCount > 0) {
root.dockApps.overflowExpanded = true;
}
});
}
} }
root.close() root.close();
} }
} }
} }
Rectangle { Rectangle {
visible: { visible: {
const hasNvidia = !root.isDmsWindow && root.desktopEntry && SessionService.nvidiaCommand 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 hasWindow = root.appData && (root.appData.type === "window" || (root.appData.type === "grouped" && root.appData.windowCount > 0));
const hasPinOption = !root.hidePin const hasPinOption = !root.hidePin;
const hasContentAbove = hasPinOption || hasNvidia const hasContentAbove = hasPinOption || hasNvidia;
return hasContentAbove && hasWindow return hasContentAbove && hasWindow;
} }
width: parent.width width: parent.width
height: 1 height: 1
@@ -456,9 +448,9 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (root.desktopEntry) { if (root.desktopEntry) {
SessionService.launchDesktopEntry(root.desktopEntry, true) SessionService.launchDesktopEntry(root.desktopEntry, true);
} }
root.close() root.close();
} }
} }
} }
@@ -478,9 +470,9 @@ PanelWindow {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: { text: {
if (root.appData && root.appData.type === "grouped") { if (root.appData && root.appData.type === "grouped") {
return "Close All Windows" return "Close All Windows";
} }
return "Close Window" return "Close Window";
} }
font.pixelSize: Theme.fontSizeSmall font.pixelSize: Theme.fontSizeSmall
color: closeArea.containsMouse ? Theme.error : Theme.surfaceText color: closeArea.containsMouse ? Theme.error : Theme.surfaceText
@@ -496,11 +488,11 @@ PanelWindow {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: { onClicked: {
if (root.appData?.type === "window") { if (root.appData?.type === "window") {
root.appData?.toplevel?.close() root.appData?.toplevel?.close();
} else if (root.appData?.type === "grouped") { } else if (root.appData?.type === "grouped") {
root.appData?.allWindows?.forEach(window => window.toplevel?.close()) root.appData?.allWindows?.forEach(window => window.toplevel?.close());
} }
root.close() root.close();
} }
} }
} }

View File

@@ -115,20 +115,9 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
enabled: true enabled: true
// Prevent stealing during drag operations preventStealing: dragging || longPressing
// 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 cursorShape: longPressing ? Qt.DragMoveCursor : Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
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 => { onPressed: mouse => {
if (mouse.button === Qt.LeftButton) { if (mouse.button === Qt.LeftButton) {
dragStartPos = Qt.point(mouse.x, mouse.y); dragStartPos = Qt.point(mouse.x, mouse.y);

View File

@@ -1,6 +1,5 @@
import QtQuick import QtQuick
import qs.Common import qs.Common
import qs.Services
import qs.Widgets import qs.Widgets
Item { Item {
@@ -11,7 +10,7 @@ Item {
property bool overflowExpanded: false property bool overflowExpanded: false
property bool isVertical: false property bool isVertical: false
signal clicked() signal clicked
Rectangle { Rectangle {
id: buttonBackground id: buttonBackground
@@ -22,7 +21,9 @@ Item {
color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, mouseArea.containsMouse ? 0.2 : 0.1) color: Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, mouseArea.containsMouse ? 0.2 : 0.1)
Behavior on color { Behavior on color {
ColorAnimation { duration: Theme.shortDuration } ColorAnimation {
duration: Theme.shortDuration
}
} }
DankIcon { DankIcon {
@@ -31,16 +32,7 @@ Item {
size: actualIconSize * 0.6 size: actualIconSize * 0.6
name: "expand_more" name: "expand_more"
color: Theme.surfaceText color: Theme.surfaceText
rotation: isVertical ? (overflowExpanded ? 180 : 0) : (overflowExpanded ? 90 : -90)
// For horizontal docks, rotate -90° to point right (collapsed), then 90° to point left (expanded)
// For vertical docks, keep default (down arrow = 0°), flip 180° to point up (expanded)
rotation: {
if (isVertical) {
return overflowExpanded ? 180 : 0;
} else {
return overflowExpanded ? 90 : -90;
}
}
Behavior on rotation { Behavior on rotation {
NumberAnimation { NumberAnimation {
@@ -51,7 +43,6 @@ Item {
} }
} }
// Badge showing overflow count (outside main rectangle to avoid clipping)
Rectangle { Rectangle {
visible: overflowCount > 0 && !overflowExpanded && SettingsData.dockShowOverflowBadge visible: overflowCount > 0 && !overflowExpanded && SettingsData.dockShowOverflowBadge
anchors.right: buttonBackground.right anchors.right: buttonBackground.right
@@ -79,10 +70,6 @@ Item {
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onWheel: (wheel) => {
// Always allow wheel events to propagate to Flickable for scrolling
wheel.accepted = false
}
onClicked: root.clicked() onClicked: root.clicked()
} }
} }

View File

@@ -166,11 +166,11 @@ Item {
SettingsSliderRow { SettingsSliderRow {
settingKey: "dockMaxVisibleApps" settingKey: "dockMaxVisibleApps"
tags: ["dock", "overflow", "max", "apps", "limit"] tags: ["dock", "overflow", "max", "apps", "limit"]
text: I18n.tr("Max Number of Pinned Apps Before Overflow") text: I18n.tr("Max Pinned Apps (0 = Unlimited)")
minimum: 3 minimum: 0
maximum: 20 maximum: 30
value: SettingsData.dockMaxVisibleApps value: SettingsData.dockMaxVisibleApps
defaultValue: 10 defaultValue: 0
unit: "" unit: ""
onSliderValueChanged: newValue => SettingsData.set("dockMaxVisibleApps", newValue) onSliderValueChanged: newValue => SettingsData.set("dockMaxVisibleApps", newValue)
} }
@@ -178,11 +178,11 @@ Item {
SettingsSliderRow { SettingsSliderRow {
settingKey: "dockMaxVisibleRunningApps" settingKey: "dockMaxVisibleRunningApps"
tags: ["dock", "overflow", "max", "running", "apps", "limit"] tags: ["dock", "overflow", "max", "running", "apps", "limit"]
text: I18n.tr("Max Open Running Apps Before Overflow") text: I18n.tr("Max Running Apps (0 = Unlimited)")
minimum: 0 minimum: 0
maximum: 20 maximum: 30
value: SettingsData.dockMaxVisibleRunningApps value: SettingsData.dockMaxVisibleRunningApps
defaultValue: 10 defaultValue: 0
unit: "" unit: ""
onSliderValueChanged: newValue => SettingsData.set("dockMaxVisibleRunningApps", newValue) onSliderValueChanged: newValue => SettingsData.set("dockMaxVisibleRunningApps", newValue)
} }
@@ -191,7 +191,7 @@ Item {
settingKey: "dockShowOverflowBadge" settingKey: "dockShowOverflowBadge"
tags: ["dock", "overflow", "badge", "count", "indicator"] tags: ["dock", "overflow", "badge", "count", "indicator"]
text: I18n.tr("Show Overflow Badge Count") text: I18n.tr("Show Overflow Badge Count")
description: I18n.tr("Display a badge with the number of apps in overflow") description: I18n.tr("Displays count when overflow is active")
checked: SettingsData.dockShowOverflowBadge checked: SettingsData.dockShowOverflowBadge
onToggled: checked => SettingsData.set("dockShowOverflowBadge", checked) onToggled: checked => SettingsData.set("dockShowOverflowBadge", checked)
} }