Files
quickshell/config/Config.qml
T

79 lines
3.0 KiB
QML

pragma Singleton
import QtQuick
import Quickshell.Hyprland
import "./path"
QtObject {
// Not really usable since it is not updating when changed
property var focusedMonitor: Hyprland.focusedMonitor
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) }
function screen_height_to_font_tiny(screenHeight) {return Math.round(9 * screenHeight / 1080)}
function screen_height_to_font_small(screenHeight) {return Math.round(12 * screenHeight / 1080)}
function screen_height_to_font_medium(screenHeight) {return Math.round(16 * screenHeight / 1080)}
function screen_height_to_font_big(screenHeight) {return Math.round(22 * screenHeight / 1080)}
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"
readonly property string jfont: "Noto Sans JP"
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;
}
property string debug: "Notification"
}