mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-04 04:42:05 -04:00
dankbar: fix spacing at scale of running apps, dock, and system tray
This commit is contained in:
@@ -75,6 +75,7 @@ Item {
|
||||
readonly property color dimColor: Theme.surfaceVariantText
|
||||
|
||||
property string currentGpuPciIdRef: ""
|
||||
property var activeModuleRefs: []
|
||||
|
||||
property var cpuHistory: []
|
||||
property var memHistory: []
|
||||
@@ -140,12 +141,13 @@ Item {
|
||||
modules.push("disk", "diskmounts");
|
||||
if (showTopProcesses)
|
||||
modules.push("processes");
|
||||
activeModuleRefs = modules;
|
||||
DgopService.addRef(modules);
|
||||
updateGpuRef();
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
DgopService.removeRef();
|
||||
DgopService.removeRef(activeModuleRefs);
|
||||
if (currentGpuPciIdRef)
|
||||
DgopService.removeGpuPciId(currentGpuPciIdRef);
|
||||
}
|
||||
@@ -153,8 +155,13 @@ Item {
|
||||
onShowGpuTempChanged: updateGpuRef()
|
||||
onSelectedGpuPciIdChanged: updateGpuRef()
|
||||
onShowTopProcessesChanged: {
|
||||
if (showTopProcesses)
|
||||
if (showTopProcesses) {
|
||||
activeModuleRefs = activeModuleRefs.concat(["processes"]);
|
||||
DgopService.addRef(["processes"]);
|
||||
} else {
|
||||
DgopService.removeRef(["processes"]);
|
||||
activeModuleRefs = activeModuleRefs.filter(m => m !== "processes");
|
||||
}
|
||||
}
|
||||
|
||||
function updateGpuRef() {
|
||||
|
||||
@@ -400,6 +400,7 @@ BasePill {
|
||||
Component.onCompleted: updateModel()
|
||||
|
||||
visible: dockItems.length > 0
|
||||
readonly property real iconCellSize: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.noBackground) + 6
|
||||
|
||||
content: Component {
|
||||
Item {
|
||||
@@ -460,7 +461,7 @@ BasePill {
|
||||
readonly property bool isOverflowToggle: modelData.type === "overflow-toggle"
|
||||
readonly property bool isInOverflow: modelData.isInOverflow === true
|
||||
|
||||
readonly property real visualSize: isSeparator ? 8 : ((widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? 24 : (24 + Theme.spacingXS + 120))
|
||||
readonly property real visualSize: isSeparator ? 8 : ((widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? root.iconCellSize : (root.iconCellSize + Theme.spacingXS + 120))
|
||||
readonly property real visualWidth: root.isVerticalOrientation ? root.barThickness : visualSize
|
||||
readonly property real visualHeight: root.isVerticalOrientation ? visualSize : root.barThickness
|
||||
|
||||
@@ -620,8 +621,8 @@ BasePill {
|
||||
|
||||
Rectangle {
|
||||
id: visualContent
|
||||
width: root.isVerticalOrientation ? 24 : delegateItem.visualSize
|
||||
height: root.isVerticalOrientation ? delegateItem.visualSize : 24
|
||||
width: root.isVerticalOrientation ? root.iconCellSize : delegateItem.visualSize
|
||||
height: root.isVerticalOrientation ? delegateItem.visualSize : root.iconCellSize
|
||||
anchors.centerIn: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
@@ -937,18 +938,15 @@ BasePill {
|
||||
const globalPos = delegateItem.mapToGlobal(0, delegateItem.height / 2);
|
||||
const screenX = root.parentScreen ? root.parentScreen.x : 0;
|
||||
const screenY = root.parentScreen ? root.parentScreen.y : 0;
|
||||
const barThickness = root.effectiveBarThickness;
|
||||
const spacing = barConfig?.spacing ?? 4;
|
||||
const isLeft = root.axis?.edge === "left";
|
||||
const tooltipOffset = barThickness + spacing + Theme.spacingM;
|
||||
const tooltipX = isLeft ? tooltipOffset : (root.parentScreen.width - tooltipOffset);
|
||||
const screenRelativeY = globalPos.y - screenY + root.barY;
|
||||
const tooltipX = isLeft ? (root.barThickness + root.barSpacing + Theme.spacingXS) : (root.parentScreen.width - root.barThickness - root.barSpacing - Theme.spacingXS);
|
||||
const screenRelativeY = globalPos.y - screenY + root.minTooltipY;
|
||||
tooltipLoader.item.show(appItem.tooltipText, screenX + tooltipX, screenRelativeY, root.parentScreen, isLeft, !isLeft);
|
||||
} else {
|
||||
const globalPos = delegateItem.mapToGlobal(delegateItem.width / 2, delegateItem.height);
|
||||
const screenHeight = root.parentScreen ? root.parentScreen.height : Screen.height;
|
||||
const isBottom = root.axis?.edge === "bottom";
|
||||
const tooltipY = isBottom ? (screenHeight - Theme.barHeight - (barConfig?.spacing ?? 4) - Theme.spacingXS - 35) : (Theme.barHeight + (barConfig?.spacing ?? 4) + Theme.spacingXS);
|
||||
const tooltipY = isBottom ? (screenHeight - root.barThickness - root.barSpacing - Theme.spacingXS - 35) : (root.barThickness + root.barSpacing + Theme.spacingXS);
|
||||
tooltipLoader.item.show(appItem.tooltipText, globalPos.x, tooltipY, root.parentScreen, false, false);
|
||||
}
|
||||
}
|
||||
@@ -972,21 +970,27 @@ BasePill {
|
||||
|
||||
if (contextMenuLoader.item) {
|
||||
const globalPos = delegateItem.mapToGlobal(delegateItem.width / 2, delegateItem.height / 2);
|
||||
|
||||
const screenX = root.parentScreen ? root.parentScreen.x : 0;
|
||||
const screenY = root.parentScreen ? root.parentScreen.y : 0;
|
||||
const isBarVertical = root.axis?.isVertical ?? false;
|
||||
const barEdge = root.axis?.edge ?? "top";
|
||||
|
||||
let x = globalPos.x;
|
||||
let y = globalPos.y;
|
||||
let x = globalPos.x - screenX;
|
||||
let y = globalPos.y - screenY;
|
||||
|
||||
if (barEdge === "bottom") {
|
||||
y = (root.parentScreen ? root.parentScreen.height : Screen.height) - root.effectiveBarThickness;
|
||||
} else if (barEdge === "top") {
|
||||
y = root.effectiveBarThickness;
|
||||
} else if (barEdge === "left") {
|
||||
x = root.effectiveBarThickness;
|
||||
} else if (barEdge === "right") {
|
||||
x = (root.parentScreen ? root.parentScreen.width : Screen.width) - root.effectiveBarThickness;
|
||||
switch (barEdge) {
|
||||
case "bottom":
|
||||
y = (root.parentScreen ? root.parentScreen.height : Screen.height) - root.barThickness - root.barSpacing;
|
||||
break;
|
||||
case "top":
|
||||
y = root.barThickness + root.barSpacing;
|
||||
break;
|
||||
case "left":
|
||||
x = root.barThickness + root.barSpacing;
|
||||
break;
|
||||
case "right":
|
||||
x = (root.parentScreen ? root.parentScreen.width : Screen.width) - root.barThickness - root.barSpacing;
|
||||
break;
|
||||
}
|
||||
|
||||
const shouldHidePin = modelData.appId === "org.quickshell";
|
||||
|
||||
@@ -135,6 +135,7 @@ BasePill {
|
||||
}
|
||||
}
|
||||
readonly property int windowCount: _groupByApp ? (groupedWindows?.length || 0) : (sortedToplevels?.length || 0)
|
||||
readonly property real iconCellSize: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.noBackground) + 6
|
||||
visible: windowCount > 0
|
||||
|
||||
property real scrollAccumulator: 0
|
||||
@@ -242,7 +243,7 @@ BasePill {
|
||||
}
|
||||
return appName + (windowTitle ? " • " + windowTitle : "");
|
||||
}
|
||||
readonly property real visualWidth: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? 24 : (24 + Theme.spacingXS + 120)
|
||||
readonly property real visualWidth: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? root.iconCellSize : (root.iconCellSize + Theme.spacingXS + 120)
|
||||
|
||||
width: visualWidth
|
||||
height: root.barThickness
|
||||
@@ -250,7 +251,7 @@ BasePill {
|
||||
Rectangle {
|
||||
id: visualContent
|
||||
width: delegateItem.visualWidth
|
||||
height: 24
|
||||
height: root.iconCellSize
|
||||
anchors.centerIn: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
@@ -433,7 +434,7 @@ BasePill {
|
||||
const screenX = root.parentScreen ? root.parentScreen.x : 0;
|
||||
const screenY = root.parentScreen ? root.parentScreen.y : 0;
|
||||
const relativeY = globalPos.y - screenY;
|
||||
const tooltipX = root.axis?.edge === "left" ? (Theme.barHeight + (barConfig?.spacing ?? 4) + Theme.spacingXS) : (root.parentScreen.width - Theme.barHeight - (barConfig?.spacing ?? 4) - Theme.spacingXS);
|
||||
const tooltipX = root.axis?.edge === "left" ? (root.barThickness + root.barSpacing + Theme.spacingXS) : (root.parentScreen.width - root.barThickness - root.barSpacing - Theme.spacingXS);
|
||||
const isLeft = root.axis?.edge === "left";
|
||||
const adjustedY = relativeY + root.minTooltipY;
|
||||
const finalX = screenX + tooltipX;
|
||||
@@ -442,7 +443,7 @@ BasePill {
|
||||
const globalPos = delegateItem.mapToGlobal(delegateItem.width / 2, delegateItem.height);
|
||||
const screenHeight = root.parentScreen ? root.parentScreen.height : Screen.height;
|
||||
const isBottom = root.axis?.edge === "bottom";
|
||||
const tooltipY = isBottom ? (screenHeight - Theme.barHeight - (barConfig?.spacing ?? 4) - Theme.spacingXS - 35) : (Theme.barHeight + (barConfig?.spacing ?? 4) + Theme.spacingXS);
|
||||
const tooltipY = isBottom ? (screenHeight - root.barThickness - root.barSpacing - Theme.spacingXS - 35) : (root.barThickness + root.barSpacing + Theme.spacingXS);
|
||||
tooltipLoader.item.show(delegateItem.tooltipText, globalPos.x, tooltipY, root.parentScreen, false, false);
|
||||
}
|
||||
}
|
||||
@@ -497,15 +498,15 @@ BasePill {
|
||||
}
|
||||
return appName + (windowTitle ? " • " + windowTitle : "");
|
||||
}
|
||||
readonly property real visualWidth: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? 24 : (24 + Theme.spacingXS + 120)
|
||||
readonly property real visualWidth: (widgetData?.runningAppsCompactMode !== undefined ? widgetData.runningAppsCompactMode : SettingsData.runningAppsCompactMode) ? root.iconCellSize : (root.iconCellSize + Theme.spacingXS + 120)
|
||||
|
||||
width: root.barThickness
|
||||
height: 24
|
||||
height: root.iconCellSize
|
||||
|
||||
Rectangle {
|
||||
id: visualContent
|
||||
width: delegateItem.visualWidth
|
||||
height: 24
|
||||
height: root.iconCellSize
|
||||
anchors.centerIn: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: {
|
||||
|
||||
@@ -99,6 +99,7 @@ BasePill {
|
||||
property bool suppressShiftAnimation: false
|
||||
readonly property bool hasHiddenItems: allTrayItems.length > mainBarItems.length
|
||||
visible: allTrayItems.length > 0
|
||||
readonly property real trayItemSize: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.noBackground) + 6
|
||||
|
||||
readonly property real minTooltipY: {
|
||||
if (!parentScreen || !isVerticalOrientation) {
|
||||
@@ -172,7 +173,7 @@ BasePill {
|
||||
return "";
|
||||
}
|
||||
|
||||
width: 24
|
||||
width: root.trayItemSize
|
||||
height: root.barThickness
|
||||
z: dragHandler.dragging ? 100 : 0
|
||||
|
||||
@@ -183,7 +184,7 @@ BasePill {
|
||||
return 0;
|
||||
const dragIdx = root.draggedIndex;
|
||||
const dropIdx = root.dropTargetIndex;
|
||||
const shiftAmount = 24;
|
||||
const shiftAmount = root.trayItemSize;
|
||||
if (dropIdx < 0)
|
||||
return 0;
|
||||
if (dragIdx < dropIdx && index > dragIdx && index <= dropIdx)
|
||||
@@ -222,8 +223,8 @@ BasePill {
|
||||
|
||||
Rectangle {
|
||||
id: visualContent
|
||||
width: 24
|
||||
height: 24
|
||||
width: root.trayItemSize
|
||||
height: root.trayItemSize
|
||||
anchors.centerIn: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: trayItemArea.containsMouse ? Theme.widgetBaseHoverColor : "transparent"
|
||||
@@ -328,7 +329,7 @@ BasePill {
|
||||
|
||||
const axisOffset = mouse.x - dragHandler.dragStartPos.x;
|
||||
dragHandler.dragAxisOffset = axisOffset;
|
||||
const itemSize = 24;
|
||||
const itemSize = root.trayItemSize;
|
||||
const slotOffset = Math.round(axisOffset / itemSize);
|
||||
const newTargetIndex = Math.max(0, Math.min(root.mainBarItems.length - 1, index + slotOffset));
|
||||
if (newTargetIndex !== root.dropTargetIndex) {
|
||||
@@ -351,14 +352,14 @@ BasePill {
|
||||
}
|
||||
|
||||
Item {
|
||||
width: 24
|
||||
width: root.trayItemSize
|
||||
height: root.barThickness
|
||||
visible: root.hasHiddenItems
|
||||
|
||||
Rectangle {
|
||||
id: caretButton
|
||||
width: 24
|
||||
height: 24
|
||||
width: root.trayItemSize
|
||||
height: root.trayItemSize
|
||||
anchors.centerIn: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: caretArea.containsMouse ? Theme.widgetBaseHoverColor : "transparent"
|
||||
@@ -430,7 +431,7 @@ BasePill {
|
||||
}
|
||||
|
||||
width: root.barThickness
|
||||
height: 24
|
||||
height: root.trayItemSize
|
||||
z: dragHandler.dragging ? 100 : 0
|
||||
|
||||
property real shiftOffset: {
|
||||
@@ -440,7 +441,7 @@ BasePill {
|
||||
return 0;
|
||||
const dragIdx = root.draggedIndex;
|
||||
const dropIdx = root.dropTargetIndex;
|
||||
const shiftAmount = 24;
|
||||
const shiftAmount = root.trayItemSize;
|
||||
if (dropIdx < 0)
|
||||
return 0;
|
||||
if (dragIdx < dropIdx && index > dragIdx && index <= dropIdx)
|
||||
@@ -479,8 +480,8 @@ BasePill {
|
||||
|
||||
Rectangle {
|
||||
id: visualContent
|
||||
width: 24
|
||||
height: 24
|
||||
width: root.trayItemSize
|
||||
height: root.trayItemSize
|
||||
anchors.centerIn: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: trayItemArea.containsMouse ? Theme.widgetBaseHoverColor : "transparent"
|
||||
@@ -585,7 +586,7 @@ BasePill {
|
||||
|
||||
const axisOffset = mouse.y - dragHandler.dragStartPos.y;
|
||||
dragHandler.dragAxisOffset = axisOffset;
|
||||
const itemSize = 24;
|
||||
const itemSize = root.trayItemSize;
|
||||
const slotOffset = Math.round(axisOffset / itemSize);
|
||||
const newTargetIndex = Math.max(0, Math.min(root.mainBarItems.length - 1, index + slotOffset));
|
||||
if (newTargetIndex !== root.dropTargetIndex) {
|
||||
@@ -609,13 +610,13 @@ BasePill {
|
||||
|
||||
Item {
|
||||
width: root.barThickness
|
||||
height: 24
|
||||
height: root.trayItemSize
|
||||
visible: root.hasHiddenItems
|
||||
|
||||
Rectangle {
|
||||
id: caretButtonVert
|
||||
width: 24
|
||||
height: 24
|
||||
width: root.trayItemSize
|
||||
height: root.trayItemSize
|
||||
anchors.centerIn: parent
|
||||
radius: Theme.cornerRadius
|
||||
color: caretAreaVert.containsMouse ? Theme.widgetBaseHoverColor : "transparent"
|
||||
@@ -835,7 +836,7 @@ BasePill {
|
||||
readonly property real rawWidth: {
|
||||
const itemCount = root.hiddenBarItems.length;
|
||||
const cols = Math.min(5, itemCount);
|
||||
const itemSize = 28;
|
||||
const itemSize = root.trayItemSize + 4;
|
||||
const spacing = 2;
|
||||
return cols * itemSize + (cols - 1) * spacing + Theme.spacingS * 2;
|
||||
}
|
||||
@@ -843,7 +844,7 @@ BasePill {
|
||||
const itemCount = root.hiddenBarItems.length;
|
||||
const cols = Math.min(5, itemCount);
|
||||
const rows = Math.ceil(itemCount / cols);
|
||||
const itemSize = 28;
|
||||
const itemSize = root.trayItemSize + 4;
|
||||
const spacing = 2;
|
||||
return rows * itemSize + (rows - 1) * spacing + Theme.spacingS * 2;
|
||||
}
|
||||
@@ -982,8 +983,8 @@ BasePill {
|
||||
return "";
|
||||
}
|
||||
|
||||
width: 28
|
||||
height: 28
|
||||
width: root.trayItemSize + 4
|
||||
height: root.trayItemSize + 4
|
||||
radius: Theme.cornerRadius
|
||||
color: itemArea.containsMouse ? Theme.widgetBaseHoverColor : Theme.withAlpha(Theme.surfaceContainer, 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user