Files
quickshell/config/Config.qml
T
2026-06-16 19:09:09 +02:00

69 lines
2.4 KiB
QML

pragma Singleton
import QtQuick 2.15
import "./path"
QtObject {
readonly property string configDir: ConfigPath.path
readonly property string wallpaperDir: WallpaperPath.wallpaperDir
readonly property int small_spacing: 4
readonly property int spacing: 8
function small_spacing_fun(screenHeight) { return Math.floor(barHeight(screenHeight) / 16) }
function spacing_fun(barH) { return Math.floor(barH / 8) }
function big_spacing_fun(barH) { return Math.floor(barH / 6) }
function font_size(spaceHeight) { return Math.floor(spaceHeight * 0.75) }
function font_size_small(spaceHeight) { return Math.floor(spaceHeight * 0.625) }
function font_size_tiny(spaceHeight) { return Math.floor(spaceHeight * 0.4) }
readonly property int small_radius: 8
readonly property int radius: 16
function small_radius_fun(barHeight) { return Math.floor(barHeight / 8) }
function radius_fun(barHeight) { return Math.floor(barHeight / 4) }
readonly property int big_radius: 10
readonly property int border_width: 2
readonly property string font: "CodeNewRoman Nerd Font"
function big_font_size(value) {
return value * 0.6
}
function medium_scaling(value) {
return value * 0.4
}
// Scale font/icon size relative to bar height
function bigIconSize(barHeight) { return Math.floor(barHeight * 0.7) }
function halfBigIconSize(barHeight) { return Math.floor(barHeight * 0.6) }
function iconSize(barHeight) { return Math.floor(barHeight * 0.5) }
function labelSize(barHeight) { return Math.floor(barHeight * 0.35) }
function normalSpacing(screenHeight) { return Math.floor(barHeight(screenHeight) / 4) }
function widgetSpacing(screenHeight) { return Math.floor(barHeight(screenHeight) / 8) }
function barHeight(screenHeight) {
return Math.floor(screenHeight * barHeightRatio(screenHeight))
}
// Resolution-aware bar height ratio
function barHeightRatio(screenHeight) {
return screenHeight >= 2160 ? 0.03 :
screenHeight >= 1440 ? 0.035 :
0.04
}
// Tray
readonly property int reload_interval: 10000
readonly property int fast_reload_interval: 1000
function maxTextWidth(maxNum, texts) {
let maxWidth = 0;
for (let i = 0; i < Math.min(maxNum, texts.length); i++)
maxWidth = Math.max(maxWidth, texts[i].width);
return maxWidth;
}
}