mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
Separate bar font scale
This commit is contained in:
@@ -115,6 +115,7 @@ Singleton {
|
|||||||
property string monoFontFamily: "Fira Code"
|
property string monoFontFamily: "Fira Code"
|
||||||
property int fontWeight: Font.Normal
|
property int fontWeight: Font.Normal
|
||||||
property real fontScale: 1.0
|
property real fontScale: 1.0
|
||||||
|
property real dankBarFontScale: 1.0
|
||||||
property bool notepadUseMonospace: true
|
property bool notepadUseMonospace: true
|
||||||
property string notepadFontFamily: ""
|
property string notepadFontFamily: ""
|
||||||
property real notepadFontSize: 14
|
property real notepadFontSize: 14
|
||||||
@@ -373,6 +374,7 @@ Singleton {
|
|||||||
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily
|
monoFontFamily = settings.monoFontFamily !== undefined ? settings.monoFontFamily : defaultMonoFontFamily
|
||||||
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal
|
fontWeight = settings.fontWeight !== undefined ? settings.fontWeight : Font.Normal
|
||||||
fontScale = settings.fontScale !== undefined ? settings.fontScale : 1.0
|
fontScale = settings.fontScale !== undefined ? settings.fontScale : 1.0
|
||||||
|
dankBarFontScale = settings.dankBarFontScale !== undefined ? settings.dankBarFontScale : 1.0
|
||||||
notepadUseMonospace = settings.notepadUseMonospace !== undefined ? settings.notepadUseMonospace : true
|
notepadUseMonospace = settings.notepadUseMonospace !== undefined ? settings.notepadUseMonospace : true
|
||||||
notepadFontFamily = settings.notepadFontFamily !== undefined ? settings.notepadFontFamily : ""
|
notepadFontFamily = settings.notepadFontFamily !== undefined ? settings.notepadFontFamily : ""
|
||||||
notepadFontSize = settings.notepadFontSize !== undefined ? settings.notepadFontSize : 14
|
notepadFontSize = settings.notepadFontSize !== undefined ? settings.notepadFontSize : 14
|
||||||
@@ -503,6 +505,7 @@ Singleton {
|
|||||||
"monoFontFamily": monoFontFamily,
|
"monoFontFamily": monoFontFamily,
|
||||||
"fontWeight": fontWeight,
|
"fontWeight": fontWeight,
|
||||||
"fontScale": fontScale,
|
"fontScale": fontScale,
|
||||||
|
"dankBarFontScale": dankBarFontScale,
|
||||||
"notepadUseMonospace": notepadUseMonospace,
|
"notepadUseMonospace": notepadUseMonospace,
|
||||||
"notepadFontFamily": notepadFontFamily,
|
"notepadFontFamily": notepadFontFamily,
|
||||||
"notepadFontSize": notepadFontSize,
|
"notepadFontSize": notepadFontSize,
|
||||||
@@ -1059,6 +1062,11 @@ Singleton {
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setDankBarFontScale(scale) {
|
||||||
|
dankBarFontScale = scale
|
||||||
|
saveSettings()
|
||||||
|
}
|
||||||
|
|
||||||
function setGtkThemingEnabled(enabled) {
|
function setGtkThemingEnabled(enabled) {
|
||||||
gtkThemingEnabled = enabled
|
gtkThemingEnabled = enabled
|
||||||
saveSettings()
|
saveSettings()
|
||||||
|
|||||||
@@ -480,9 +480,10 @@ Singleton {
|
|||||||
|
|
||||||
function barTextSize(barThickness) {
|
function barTextSize(barThickness) {
|
||||||
const scale = barThickness / 48
|
const scale = barThickness / 48
|
||||||
if (scale <= 0.75) return fontSizeSmall * 0.9
|
const dankBarScale = (typeof SettingsData !== "undefined" ? SettingsData.dankBarFontScale : 1.0)
|
||||||
if (scale >= 1.25) return fontSizeMedium
|
if (scale <= 0.75) return fontSizeSmall * 0.9 * dankBarScale
|
||||||
return fontSizeSmall
|
if (scale >= 1.25) return fontSizeMedium * dankBarScale
|
||||||
|
return fontSizeSmall * dankBarScale
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBatteryIcon(level, isCharging, batteryAvailable) {
|
function getBatteryIcon(level, isCharging, batteryAvailable) {
|
||||||
|
|||||||
@@ -1065,6 +1065,97 @@ Item {
|
|||||||
SettingsData.setDankBarBorderEnabled(checked)
|
SettingsData.setDankBarBorderEnabled(checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 1
|
||||||
|
color: Theme.outline
|
||||||
|
opacity: 0.2
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: parent.width
|
||||||
|
height: 60
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Column {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: dankBarFontScaleControls.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.leftMargin: Theme.spacingM
|
||||||
|
anchors.rightMargin: Theme.spacingM
|
||||||
|
spacing: Theme.spacingXS
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("DankBar Font Scale")
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: qsTr("Scale DankBar font sizes independently")
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.surfaceVariantText
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
id: dankBarFontScaleControls
|
||||||
|
|
||||||
|
width: 180
|
||||||
|
height: 36
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 0
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
spacing: Theme.spacingS
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
buttonSize: 32
|
||||||
|
iconName: "remove"
|
||||||
|
iconSize: Theme.iconSizeSmall
|
||||||
|
enabled: SettingsData.dankBarFontScale > 0.5
|
||||||
|
backgroundColor: Theme.surfaceContainerHigh
|
||||||
|
iconColor: Theme.surfaceText
|
||||||
|
onClicked: {
|
||||||
|
var newScale = Math.max(0.5, SettingsData.dankBarFontScale - 0.05)
|
||||||
|
SettingsData.setDankBarFontScale(newScale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledRect {
|
||||||
|
width: 60
|
||||||
|
height: 32
|
||||||
|
radius: Theme.cornerRadius
|
||||||
|
color: Theme.surfaceContainerHigh
|
||||||
|
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
|
border.width: 0
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: (SettingsData.dankBarFontScale * 100).toFixed(0) + "%"
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankActionButton {
|
||||||
|
buttonSize: 32
|
||||||
|
iconName: "add"
|
||||||
|
iconSize: Theme.iconSizeSmall
|
||||||
|
enabled: SettingsData.dankBarFontScale < 2.0
|
||||||
|
backgroundColor: Theme.surfaceContainerHigh
|
||||||
|
iconColor: Theme.surfaceText
|
||||||
|
onClicked: {
|
||||||
|
var newScale = Math.min(2.0, SettingsData.dankBarFontScale + 0.05)
|
||||||
|
SettingsData.setDankBarFontScale(newScale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user