pragma Singleton import QtQuick 6.8 // 6.12 added a QtQuick Color singleton that hides Commons.Color import Quickshell import qs.compat.noctalia.Services.Power import "../../../theme" as G import "../../../core" as Core Singleton { id: root // glassMxrph: radii, bar sizes, animation and panel opacity follow the // glassMxrph theme so Noctalia plugins match the shell. readonly property real glassRadiusRatio: G.Theme.radius / 20 readonly property real glassBarHeight: Core.BarDrawers.height readonly property real glassCapsuleHeight: Core.ModuleRegistry.pillHeight // Font size readonly property real fontSizeXXS: 8 readonly property real fontSizeXS: 9 readonly property real fontSizeS: 10 readonly property real fontSizeM: 11 readonly property real fontSizeL: 13 readonly property real fontSizeXL: 16 readonly property real fontSizeXXL: 18 readonly property real fontSizeXXXL: 24 // Font weight readonly property int fontWeightRegular: 400 readonly property int fontWeightMedium: 500 readonly property int fontWeightSemiBold: 600 readonly property int fontWeightBold: 700 // Container Radii: major layout sections (sidebars, cards, content panels) readonly property int radiusXXXS: Math.round(3 * root.glassRadiusRatio) readonly property int radiusXXS: Math.round(4 * root.glassRadiusRatio) readonly property int radiusXS: Math.round(8 * root.glassRadiusRatio) readonly property int radiusS: Math.round(12 * root.glassRadiusRatio) readonly property int radiusM: Math.round(16 * root.glassRadiusRatio) readonly property int radiusL: Math.round(20 * root.glassRadiusRatio) // Input radii: interactive elements (buttons, toggles, text fields) readonly property int iRadiusXXXS: Math.round(3 * root.glassRadiusRatio) readonly property int iRadiusXXS: Math.round(4 * root.glassRadiusRatio) readonly property int iRadiusXS: Math.round(8 * root.glassRadiusRatio) readonly property int iRadiusS: Math.round(12 * root.glassRadiusRatio) readonly property int iRadiusM: Math.round(16 * root.glassRadiusRatio) readonly property int iRadiusL: Math.round(20 * root.glassRadiusRatio) readonly property int screenRadius: Math.round(20 * Settings.data.general.screenRadiusRatio) // Border readonly property int borderS: Math.max(1, Math.round(1 * uiScaleRatio)) readonly property int borderM: Math.max(1, Math.round(2 * uiScaleRatio)) readonly property int borderL: Math.max(1, Math.round(3 * uiScaleRatio)) // Margins (for margins and spacing) readonly property int marginXXXS: Math.round(1 * uiScaleRatio) readonly property int marginXXS: Math.round(2 * uiScaleRatio) readonly property int marginXS: Math.round(4 * uiScaleRatio) readonly property int marginS: Math.round(6 * uiScaleRatio) readonly property int marginM: Math.round(9 * uiScaleRatio) readonly property int marginL: Math.round(13 * uiScaleRatio) readonly property int marginXL: Math.round(18 * uiScaleRatio) // Double margins, for proper container sizing only (e.g. height: id.implicitHeight + Style.margin2M) readonly property int margin2XXXS: marginXXXS * 2 readonly property int margin2XXS: marginXXS * 2 readonly property int margin2XS: marginXS * 2 readonly property int margin2S: marginS * 2 readonly property int margin2M: marginM * 2 readonly property int margin2L: marginL * 2 readonly property int margin2XL: marginXL * 2 // Opacity readonly property real opacityNone: 0.0 readonly property real opacityLight: 0.25 readonly property real opacityMedium: 0.5 readonly property real opacityHeavy: 0.75 readonly property real opacityAlmost: 0.95 readonly property real opacityFull: 1.0 readonly property real effectivePanelOpacity: G.Theme.glassOpacity readonly property real effectiveBarOpacity: G.Theme.glassOpacity // Shadows readonly property real shadowOpacity: 0.85 readonly property real shadowBlur: 1.0 readonly property int shadowBlurMax: 22 readonly property real shadowHorizontalOffset: Settings.data.general.shadowOffsetX readonly property real shadowVerticalOffset: Settings.data.general.shadowOffsetY // Animation duration (ms) readonly property int animationFaster: Math.round(G.Theme.duration * 0.35) readonly property int animationFast: Math.round(G.Theme.duration * 0.7) readonly property int animationNormal: Math.round(G.Theme.duration * 1.3) readonly property int animationSlow: Math.round(G.Theme.duration * 2) readonly property int animationSlowest: Math.round(G.Theme.duration * 3.3) // Delays readonly property int tooltipDelay: 300 readonly property int tooltipDelayLong: 1200 readonly property int pillDelay: 500 // Widgets base size readonly property real baseWidgetSize: 33 readonly property real sliderWidth: 200 readonly property real uiScaleRatio: 1.0 // Bar Height readonly property real barHeight: glassBarHeight readonly property real capsuleHeight: glassCapsuleHeight readonly property real _barBaseFontSize: 12 readonly property real barFontSize: 12 readonly property color capsuleColor: "transparent" readonly property color capsuleBorderColor: "transparent" readonly property int capsuleBorderWidth: 0 readonly property color boxBorderColor: Color.mOutline // Pixel-perfect utility for centering content without subpixel positioning function pixelAlignCenter(containerSize, contentSize) { return Math.round((containerSize - contentSize) / 2); } // Ensures a number is always odd (rounds down to nearest odd) function toOdd(n) { return Math.floor(n / 2) * 2 + 1; } // Ensures a number is always even (rounds down to nearest even) function toEven(n) { return Math.floor(n / 2) * 2; } // Get bar height for a specific density and orientation function getBarHeightForDensity(density, isVertical) { let h; switch (density) { case "mini": h = isVertical ? 23 : 21; break; case "compact": h = isVertical ? 27 : 25; break; case "comfortable": h = isVertical ? 39 : 37; break; case "spacious": h = isVertical ? 49 : 47; break; default: case "default": h = isVertical ? 33 : 31; } return toOdd(h); } // Get capsule height for a specific density and bar height function getCapsuleHeightForDensity(density, barHeight) { let h; switch (density) { case "mini": h = Math.round(barHeight * 0.90); break; case "compact": h = Math.round(barHeight * 0.85); break; case "comfortable": h = Math.round(barHeight * 0.75); break; case "spacious": h = Math.round(barHeight * 0.65); break; default: h = Math.round(barHeight * 0.82); break; } return toOdd(h); } // Get bar font size for a specific bar height, capsule height, and orientation function getBarFontSizeForDensity(barHeight, capsuleHeight, isVertical) { const baseFontSize = Math.max(1, (barHeight / capsuleHeight) * Style.fontSizeXXS); return isVertical ? baseFontSize * 0.9 * Settings.data.bar.fontScale : baseFontSize * Settings.data.bar.fontScale; } // Convenience functions for per-screen bar sizing function getBarHeightForScreen(screenName) { return glassBarHeight; } function getCapsuleHeightForScreen(screenName) { return glassCapsuleHeight; } function getBarFontSizeForScreen(screenName) { return barFontSize; } }