mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 07:52:50 -05:00
tweak popout margins for consistency (#399)
This commit is contained in:
@@ -17,7 +17,7 @@ Singleton {
|
|||||||
readonly property bool envDisableMatugen: Quickshell.env("DMS_DISABLE_MATUGEN") === "1" || Quickshell.env("DMS_DISABLE_MATUGEN") === "true"
|
readonly property bool envDisableMatugen: Quickshell.env("DMS_DISABLE_MATUGEN") === "1" || Quickshell.env("DMS_DISABLE_MATUGEN") === "true"
|
||||||
|
|
||||||
// ! TODO - Synchronize with niri/hyprland gaps?
|
// ! TODO - Synchronize with niri/hyprland gaps?
|
||||||
readonly property real popupDistance: 2
|
readonly property real popupDistance: SettingsData.dankBarSpacing
|
||||||
|
|
||||||
property string currentTheme: "blue"
|
property string currentTheme: "blue"
|
||||||
property string currentThemeCategory: "generic"
|
property string currentThemeCategory: "generic"
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ PanelWindow {
|
|||||||
readonly property real alignedHeight: Theme.px(popupHeight, dpr)
|
readonly property real alignedHeight: Theme.px(popupHeight, dpr)
|
||||||
readonly property real alignedX: Theme.snap((() => {
|
readonly property real alignedX: Theme.snap((() => {
|
||||||
if (SettingsData.dankBarPosition === SettingsData.Position.Left) {
|
if (SettingsData.dankBarPosition === SettingsData.Position.Left) {
|
||||||
return triggerY
|
return triggerY + SettingsData.dankBarBottomGap
|
||||||
} else if (SettingsData.dankBarPosition === SettingsData.Position.Right) {
|
} else if (SettingsData.dankBarPosition === SettingsData.Position.Right) {
|
||||||
return screenWidth - triggerY - popupWidth
|
return screenWidth - triggerY - SettingsData.dankBarBottomGap - popupWidth
|
||||||
} else {
|
} else {
|
||||||
const centerX = triggerX + (triggerWidth / 2) - (popupWidth / 2)
|
const centerX = triggerX + (triggerWidth / 2) - (popupWidth / 2)
|
||||||
return Math.max(Theme.popupDistance, Math.min(screenWidth - popupWidth - Theme.popupDistance, centerX))
|
return Math.max(Theme.popupDistance, Math.min(screenWidth - popupWidth - Theme.popupDistance, centerX))
|
||||||
@@ -100,9 +100,9 @@ PanelWindow {
|
|||||||
const centerY = triggerX + (triggerWidth / 2) - (popupHeight / 2)
|
const centerY = triggerX + (triggerWidth / 2) - (popupHeight / 2)
|
||||||
return Math.max(Theme.popupDistance, Math.min(screenHeight - popupHeight - Theme.popupDistance, centerY))
|
return Math.max(Theme.popupDistance, Math.min(screenHeight - popupHeight - Theme.popupDistance, centerY))
|
||||||
} else if (SettingsData.dankBarPosition === SettingsData.Position.Bottom) {
|
} else if (SettingsData.dankBarPosition === SettingsData.Position.Bottom) {
|
||||||
return Math.max(Theme.popupDistance, Math.min(screenHeight - popupHeight - Theme.popupDistance, screenHeight - triggerY - popupHeight + Theme.popupDistance))
|
return Math.max(Theme.popupDistance, screenHeight - triggerY - popupHeight)
|
||||||
} else {
|
} else {
|
||||||
return Math.max(Theme.popupDistance, Math.min(screenHeight - popupHeight - Theme.popupDistance, triggerY + Theme.popupDistance))
|
return Math.min(screenHeight - popupHeight - Theme.popupDistance, triggerY)
|
||||||
}
|
}
|
||||||
})(), dpr)
|
})(), dpr)
|
||||||
|
|
||||||
|
|||||||
@@ -48,13 +48,13 @@ PanelWindow {
|
|||||||
|
|
||||||
margins {
|
margins {
|
||||||
left: {
|
left: {
|
||||||
if (alignLeft) return Math.round(targetX)
|
if (alignLeft) return Math.round(Math.max(Theme.spacingS, Math.min((targetScreen?.width ?? Screen.width) - implicitWidth - Theme.spacingS, targetX)))
|
||||||
if (alignRight) return Math.round(targetX - implicitWidth)
|
if (alignRight) return Math.round(Math.max(Theme.spacingS, Math.min((targetScreen?.width ?? Screen.width) - implicitWidth - Theme.spacingS, targetX - implicitWidth)))
|
||||||
return Math.round(targetX - implicitWidth / 2)
|
return Math.round(Math.max(Theme.spacingS, Math.min((targetScreen?.width ?? Screen.width) - implicitWidth - Theme.spacingS, targetX - implicitWidth / 2)))
|
||||||
}
|
}
|
||||||
top: {
|
top: {
|
||||||
if (alignLeft || alignRight) return Math.round(targetY - implicitHeight / 2)
|
if (alignLeft || alignRight) return Math.round(Math.max(Theme.spacingS, Math.min((targetScreen?.height ?? Screen.height) - implicitHeight - Theme.spacingS, targetY - implicitHeight / 2)))
|
||||||
return Math.round(targetY)
|
return Math.round(Math.max(Theme.spacingS, Math.min((targetScreen?.height ?? Screen.height) - implicitHeight - Theme.spacingS, targetY)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user