1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

Implement sizing mechanism for bar widget content

This commit is contained in:
bbedward
2025-10-06 20:40:02 -04:00
parent 7158e09b0e
commit ef9f76190d
27 changed files with 149 additions and 93 deletions

View File

@@ -108,6 +108,7 @@ Singleton {
property string launcherLogoColorOverride: ""
property real launcherLogoBrightness: 0.5
property real launcherLogoContrast: 1
property int launcherLogoSizeOffset: 0
property bool weatherEnabled: true
property string fontFamily: "Inter Variable"
property string monoFontFamily: "Fira Code"
@@ -334,6 +335,7 @@ Singleton {
launcherLogoColorOverride = settings.launcherLogoColorOverride !== undefined ? settings.launcherLogoColorOverride : ""
launcherLogoBrightness = settings.launcherLogoBrightness !== undefined ? settings.launcherLogoBrightness : 0.5
launcherLogoContrast = settings.launcherLogoContrast !== undefined ? settings.launcherLogoContrast : 1
launcherLogoSizeOffset = settings.launcherLogoSizeOffset !== undefined ? settings.launcherLogoSizeOffset : 0
}
fontFamily = settings.fontFamily !== undefined ? settings.fontFamily : defaultFontFamily
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily
@@ -459,6 +461,7 @@ Singleton {
"launcherLogoColorOverride": launcherLogoColorOverride,
"launcherLogoBrightness": launcherLogoBrightness,
"launcherLogoContrast": launcherLogoContrast,
"launcherLogoSizeOffset": launcherLogoSizeOffset,
"fontFamily": fontFamily,
"monoFontFamily": monoFontFamily,
"fontWeight": fontWeight,
@@ -984,6 +987,11 @@ Singleton {
saveSettings()
}
function setLauncherLogoSizeOffset(offset) {
launcherLogoSizeOffset = offset
saveSettings()
}
function setFontFamily(family) {
fontFamily = family
saveSettings()

View File

@@ -473,6 +473,18 @@ Singleton {
return (0.299 * c.r + 0.587 * c.g + 0.114 * c.b) < 0.5
}
function barIconSize(barThickness, offset) {
const defaultOffset = offset !== undefined ? offset : -6
return Math.round((barThickness / 48) * (iconSize + defaultOffset))
}
function barTextSize(barThickness) {
const scale = barThickness / 48
if (scale <= 0.75) return fontSizeSmall * 0.9
if (scale >= 1.25) return fontSizeMedium
return fontSizeSmall
}
function getBatteryIcon(level, isCharging, batteryAvailable) {
if (!batteryAvailable)
return _getBatteryPowerProfileIcon()