From 00509170efc009d9d209b39bfc9bf0edf01c8910 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Mon, 13 Oct 2025 20:16:18 -0400 Subject: [PATCH] Bar: improved "mini" density look --- Modules/Bar/Extras/BarPill.qml | 6 ++-- Modules/Bar/Extras/BarPillHorizontal.qml | 33 +++++++++++++----- Modules/Bar/Extras/BarPillVertical.qml | 37 +++++++++++++++------ Modules/Bar/Widgets/Battery.qml | 2 +- Modules/Bar/Widgets/Bluetooth.qml | 2 +- Modules/Bar/Widgets/Brightness.qml | 2 +- Modules/Bar/Widgets/Clock.qml | 2 +- Modules/Bar/Widgets/ControlCenter.qml | 2 +- Modules/Bar/Widgets/CustomButton.qml | 2 +- Modules/Bar/Widgets/DarkMode.qml | 2 +- Modules/Bar/Widgets/KeepAwake.qml | 2 +- Modules/Bar/Widgets/KeyboardLayout.qml | 2 +- Modules/Bar/Widgets/MediaMini.qml | 2 +- Modules/Bar/Widgets/Microphone.qml | 2 +- Modules/Bar/Widgets/NightLight.qml | 2 +- Modules/Bar/Widgets/NotificationHistory.qml | 2 +- Modules/Bar/Widgets/PowerProfile.qml | 2 +- Modules/Bar/Widgets/ScreenRecorder.qml | 2 +- Modules/Bar/Widgets/SessionMenu.qml | 2 +- Modules/Bar/Widgets/SystemMonitor.qml | 4 +-- Modules/Bar/Widgets/Taskbar.qml | 8 ++--- Modules/Bar/Widgets/Tray.qml | 2 +- Modules/Bar/Widgets/Volume.qml | 2 +- Modules/Bar/Widgets/WallpaperSelector.qml | 2 +- Modules/Bar/Widgets/WiFi.qml | 2 +- Modules/Bar/Widgets/Workspace.qml | 4 +-- Widgets/NCheckbox.qml | 2 +- Widgets/NIconButton.qml | 11 ++++-- Widgets/NIconButtonHot.qml | 4 +-- 29 files changed, 95 insertions(+), 54 deletions(-) diff --git a/Modules/Bar/Extras/BarPill.qml b/Modules/Bar/Extras/BarPill.qml index ff4ae3bb..ba1601d3 100644 --- a/Modules/Bar/Extras/BarPill.qml +++ b/Modules/Bar/Extras/BarPill.qml @@ -12,13 +12,13 @@ Item { property string text: "" property string suffix: "" property string tooltipText: "" + property string density: "" property bool autoHide: false property bool forceOpen: false property bool forceClose: false property bool disableOpen: false property bool rightOpen: false property bool hovered: false - property bool compact: false readonly property string barPosition: Settings.data.bar.position readonly property bool isVerticalBar: barPosition === "left" || barPosition === "right" @@ -54,7 +54,7 @@ Item { disableOpen: root.disableOpen rightOpen: root.rightOpen hovered: root.hovered - compact: root.compact + density: root.density onShown: root.shown() onHidden: root.hidden() onEntered: root.entered() @@ -79,7 +79,7 @@ Item { disableOpen: root.disableOpen rightOpen: root.rightOpen hovered: root.hovered - compact: root.compact + density: root.density onShown: root.shown() onHidden: root.hidden() onEntered: root.entered() diff --git a/Modules/Bar/Extras/BarPillHorizontal.qml b/Modules/Bar/Extras/BarPillHorizontal.qml index b7d871b2..0c2b5e90 100644 --- a/Modules/Bar/Extras/BarPillHorizontal.qml +++ b/Modules/Bar/Extras/BarPillHorizontal.qml @@ -14,13 +14,13 @@ Item { property string text: "" property string suffix: "" property string tooltipText: "" + property string density: "" property bool autoHide: false property bool forceOpen: false property bool forceClose: false property bool disableOpen: false property bool rightOpen: false property bool hovered: false - property bool compact: false // Effective shown state (true if hovered/animated open or forced) readonly property bool revealed: !forceClose && (forceOpen || showPill) @@ -41,10 +41,25 @@ Item { readonly property int pillHeight: Style.capsuleHeight readonly property int pillPaddingHorizontal: Math.round(Style.capsuleHeight * 0.2) readonly property int pillOverlap: Math.round(Style.capsuleHeight * 0.5) - readonly property int pillMaxWidth: Math.max(1, textItem.implicitWidth + pillPaddingHorizontal * 2 + pillOverlap) + readonly property int pillMaxWidth: Math.max(1, Math.round(textItem.implicitWidth + pillPaddingHorizontal * 2 + pillOverlap)) - readonly property real iconSize: Math.max(1, compact ? pillHeight * 0.65 : pillHeight * 0.48) - readonly property real textSize: Math.max(1, compact ? pillHeight * 0.45 : pillHeight * 0.33) + readonly property real iconSize: { + switch (root.density) { + case "compact": + return Math.max(1, Math.round(pillHeight * 0.65)) + default: + return Math.max(1, Math.round(pillHeight * 0.48)) + } + } + + readonly property real textSize: { + switch (root.density) { + case "compact": + return Math.max(1, Math.round(pillHeight * 0.45)) + default: + return Math.max(1, Math.round(pillHeight * 0.33)) + } + } width: pillHeight + Math.max(0, pill.width - pillOverlap) height: pillHeight @@ -68,10 +83,12 @@ Item { opacity: revealed ? Style.opacityFull : Style.opacityNone color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent - topLeftRadius: rightOpen ? 0 : pillHeight * 0.5 - bottomLeftRadius: rightOpen ? 0 : pillHeight * 0.5 - topRightRadius: rightOpen ? pillHeight * 0.5 : 0 - bottomRightRadius: rightOpen ? pillHeight * 0.5 : 0 + readonly property int halfPillHeight: Math.round(pillHeight * 0.5) + + topLeftRadius: rightOpen ? 0 : halfPillHeight + bottomLeftRadius: rightOpen ? 0 : halfPillHeight + topRightRadius: rightOpen ? halfPillHeight : 0 + bottomRightRadius: rightOpen ? halfPillHeight : 0 anchors.verticalCenter: parent.verticalCenter NText { diff --git a/Modules/Bar/Extras/BarPillVertical.qml b/Modules/Bar/Extras/BarPillVertical.qml index 781dc587..c8b53997 100644 --- a/Modules/Bar/Extras/BarPillVertical.qml +++ b/Modules/Bar/Extras/BarPillVertical.qml @@ -12,13 +12,13 @@ Item { property string text: "" property string suffix: "" property string tooltipText: "" + property string density: "" property bool autoHide: false property bool forceOpen: false property bool forceClose: false property bool disableOpen: false property bool rightOpen: false property bool hovered: false - property bool compact: false // Bar position detection for pill direction readonly property string barPosition: Settings.data.bar.position @@ -48,12 +48,27 @@ Item { readonly property int buttonSize: Style.capsuleHeight readonly property int pillHeight: buttonSize readonly property int pillPaddingVertical: 3 * 2 // Very precise adjustment don't replace by Style.margin - readonly property int pillOverlap: buttonSize * 0.5 + readonly property int pillOverlap: Math.round(buttonSize * 0.5) readonly property int maxPillWidth: buttonSize - readonly property int maxPillHeight: Math.max(1, textItem.implicitHeight + pillPaddingVertical * 4) + readonly property int maxPillHeight: Math.max(1, Math.round(textItem.implicitHeight + pillPaddingVertical * 4)) - readonly property real iconSize: Math.max(1, compact ? pillHeight * 0.65 : pillHeight * 0.48) - readonly property real textSize: Math.max(1, compact ? pillHeight * 0.38 : pillHeight * 0.33) + readonly property real iconSize: { + switch (root.density) { + case "compact": + return Math.max(1, Math.round(pillHeight * 0.65)) + default: + return Math.max(1, Math.round(pillHeight * 0.48)) + } + } + + readonly property real textSize: { + switch (root.density) { + case "compact": + return Math.max(1, Math.round(pillHeight * 0.38)) + default: + return Math.max(1, Math.round(pillHeight * 0.33)) + } + } // For vertical bars: width is just icon size, height includes pill space width: buttonSize @@ -79,11 +94,13 @@ Item { opacity: revealed ? Style.opacityFull : Style.opacityNone color: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent + readonly property int halfButtonSize: Math.round(buttonSize * 0.5) + // Radius logic for vertical expansion - rounded on the side that connects to icon - topLeftRadius: openUpward ? buttonSize * 0.5 : 0 - bottomLeftRadius: openDownward ? buttonSize * 0.5 : 0 - topRightRadius: openUpward ? buttonSize * 0.5 : 0 - bottomRightRadius: openDownward ? buttonSize * 0.5 : 0 + topLeftRadius: openUpward ? halfButtonSize : 0 + bottomLeftRadius: openDownward ? halfButtonSize : 0 + topRightRadius: openUpward ? halfButtonSize : 0 + bottomRightRadius: openDownward ? halfButtonSize : 0 anchors.horizontalCenter: parent.horizontalCenter @@ -92,7 +109,7 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter anchors.verticalCenterOffset: { - var offset = openDownward ? pillPaddingVertical * 0.75 : -pillPaddingVertical * 0.75 + var offset = openDownward ? Math.round(pillPaddingVertical * 0.75) : -Math.round(pillPaddingVertical * 0.75) if (forceOpen) { // If its force open, the icon disc background is the same color as the bg pill move text slightly offset += rightOpen ? -Style.marginXXS : Style.marginXXS diff --git a/Modules/Bar/Widgets/Battery.qml b/Modules/Bar/Widgets/Battery.qml index 14192d29..02032cd9 100644 --- a/Modules/Bar/Widgets/Battery.qml +++ b/Modules/Bar/Widgets/Battery.qml @@ -86,7 +86,7 @@ Item { BarPill { id: pill - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density rightOpen: BarService.getPillDirection(root) icon: testMode ? BatteryService.getIcon(testPercent, testCharging, true) : BatteryService.getIcon(percent, charging, isReady) text: (isReady || testMode) ? Math.round(percent) : "-" diff --git a/Modules/Bar/Widgets/Bluetooth.qml b/Modules/Bar/Widgets/Bluetooth.qml index 039c10dc..e6f50f0f 100644 --- a/Modules/Bar/Widgets/Bluetooth.qml +++ b/Modules/Bar/Widgets/Bluetooth.qml @@ -14,7 +14,7 @@ NIconButton { baseSize: Style.capsuleHeight applyUiScale: false - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density colorBg: Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent colorFg: Color.mOnSurface colorBorder: Color.transparent diff --git a/Modules/Bar/Widgets/Brightness.qml b/Modules/Bar/Widgets/Brightness.qml index 6f35108d..5c02e490 100644 --- a/Modules/Bar/Widgets/Brightness.qml +++ b/Modules/Bar/Widgets/Brightness.qml @@ -76,7 +76,7 @@ Item { BarPill { id: pill - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density rightOpen: BarService.getPillDirection(root) icon: getIcon() autoHide: false // Important to be false so we can hover as long as we want diff --git a/Modules/Bar/Widgets/Clock.qml b/Modules/Bar/Widgets/Clock.qml index fdf3a58a..cbbecd2f 100644 --- a/Modules/Bar/Widgets/Clock.qml +++ b/Modules/Bar/Widgets/Clock.qml @@ -29,7 +29,7 @@ Rectangle { readonly property string barPosition: Settings.data.bar.position readonly property bool isBarVertical: barPosition === "left" || barPosition === "right" - readonly property bool compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + readonly property bool density: Settings.data.bar.density readonly property var now: Time.date diff --git a/Modules/Bar/Widgets/ControlCenter.qml b/Modules/Bar/Widgets/ControlCenter.qml index ee7122b2..b0ceea69 100644 --- a/Modules/Bar/Widgets/ControlCenter.qml +++ b/Modules/Bar/Widgets/ControlCenter.qml @@ -38,7 +38,7 @@ NIconButton { tooltipDirection: BarService.getTooltipDirection() baseSize: Style.capsuleHeight applyUiScale: false - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) colorFg: Color.mOnSurface colorBgHover: useDistroLogo ? Color.mSurfaceVariant : Color.mTertiary diff --git a/Modules/Bar/Widgets/CustomButton.qml b/Modules/Bar/Widgets/CustomButton.qml index 94f94ada..af0e58cd 100644 --- a/Modules/Bar/Widgets/CustomButton.qml +++ b/Modules/Bar/Widgets/CustomButton.qml @@ -48,7 +48,7 @@ Item { rightOpen: BarService.getPillDirection(root) icon: customIcon text: _dynamicText - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density autoHide: false forceOpen: _dynamicText !== "" forceClose: false diff --git a/Modules/Bar/Widgets/DarkMode.qml b/Modules/Bar/Widgets/DarkMode.qml index 8506001b..d9a2cb25 100644 --- a/Modules/Bar/Widgets/DarkMode.qml +++ b/Modules/Bar/Widgets/DarkMode.qml @@ -11,7 +11,7 @@ NIconButton { icon: "dark-mode" tooltipText: Settings.data.colorSchemes.darkMode ? I18n.tr("tooltips.switch-to-light-mode") : I18n.tr("tooltips.switch-to-dark-mode") tooltipDirection: BarService.getTooltipDirection() - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density baseSize: Style.capsuleHeight applyUiScale: false colorBg: Settings.data.colorSchemes.darkMode ? (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) : Color.mPrimary diff --git a/Modules/Bar/Widgets/KeepAwake.qml b/Modules/Bar/Widgets/KeepAwake.qml index 3a30652e..c0546884 100644 --- a/Modules/Bar/Widgets/KeepAwake.qml +++ b/Modules/Bar/Widgets/KeepAwake.qml @@ -12,7 +12,7 @@ NIconButton { baseSize: Style.capsuleHeight applyUiScale: false - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density icon: IdleInhibitorService.isInhibited ? "keep-awake-on" : "keep-awake-off" tooltipText: IdleInhibitorService.isInhibited ? I18n.tr("tooltips.disable-keep-awake") : I18n.tr("tooltips.enable-keep-awake") tooltipDirection: BarService.getTooltipDirection() diff --git a/Modules/Bar/Widgets/KeyboardLayout.qml b/Modules/Bar/Widgets/KeyboardLayout.qml index d98e62dd..6d597227 100644 --- a/Modules/Bar/Widgets/KeyboardLayout.qml +++ b/Modules/Bar/Widgets/KeyboardLayout.qml @@ -42,7 +42,7 @@ Item { id: pill anchors.verticalCenter: parent.verticalCenter - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density rightOpen: BarService.getPillDirection(root) icon: "keyboard" autoHide: false // Important to be false so we can hover as long as we want diff --git a/Modules/Bar/Widgets/MediaMini.qml b/Modules/Bar/Widgets/MediaMini.qml index 8c72af9a..f3502781 100644 --- a/Modules/Bar/Widgets/MediaMini.qml +++ b/Modules/Bar/Widgets/MediaMini.qml @@ -30,7 +30,7 @@ Item { } readonly property string barPosition: Settings.data.bar.position - readonly property bool compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + readonly property bool density: Settings.data.bar.density readonly property string hideMode: (widgetSettings.hideMode !== undefined) ? widgetSettings.hideMode : "hidden" // "visible", "hidden", "transparent" readonly property bool showAlbumArt: (widgetSettings.showAlbumArt !== undefined) ? widgetSettings.showAlbumArt : widgetMetadata.showAlbumArt diff --git a/Modules/Bar/Widgets/Microphone.qml b/Modules/Bar/Widgets/Microphone.qml index 96081b99..a3058e36 100644 --- a/Modules/Bar/Widgets/Microphone.qml +++ b/Modules/Bar/Widgets/Microphone.qml @@ -91,7 +91,7 @@ Item { rightOpen: BarService.getPillDirection(root) icon: getIcon() - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density autoHide: false // Important to be false so we can hover as long as we want text: Math.round(AudioService.inputVolume * 100) suffix: "%" diff --git a/Modules/Bar/Widgets/NightLight.qml b/Modules/Bar/Widgets/NightLight.qml index 1554c936..80d2c01d 100644 --- a/Modules/Bar/Widgets/NightLight.qml +++ b/Modules/Bar/Widgets/NightLight.qml @@ -13,7 +13,7 @@ NIconButton { property ShellScreen screen - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density baseSize: Style.capsuleHeight applyUiScale: false colorBg: Settings.data.nightLight.forced ? Color.mPrimary : (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) diff --git a/Modules/Bar/Widgets/NotificationHistory.qml b/Modules/Bar/Widgets/NotificationHistory.qml index 3f0c3c00..6d6652fe 100644 --- a/Modules/Bar/Widgets/NotificationHistory.qml +++ b/Modules/Bar/Widgets/NotificationHistory.qml @@ -50,7 +50,7 @@ NIconButton { baseSize: Style.capsuleHeight applyUiScale: false - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density icon: Settings.data.notifications.doNotDisturb ? "bell-off" : "bell" tooltipText: Settings.data.notifications.doNotDisturb ? I18n.tr("tooltips.open-notification-history-disable-dnd") : I18n.tr("tooltips.open-notification-history-enable-dnd") tooltipDirection: BarService.getTooltipDirection() diff --git a/Modules/Bar/Widgets/PowerProfile.qml b/Modules/Bar/Widgets/PowerProfile.qml index 1d527688..da96fcf1 100644 --- a/Modules/Bar/Widgets/PowerProfile.qml +++ b/Modules/Bar/Widgets/PowerProfile.qml @@ -13,7 +13,7 @@ NIconButton { baseSize: Style.capsuleHeight applyUiScale: false - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density visible: PowerProfileService.available icon: PowerProfileService.getIcon() tooltipText: I18n.tr("tooltips.power-profile", { diff --git a/Modules/Bar/Widgets/ScreenRecorder.qml b/Modules/Bar/Widgets/ScreenRecorder.qml index 59728c0c..4e528c2f 100644 --- a/Modules/Bar/Widgets/ScreenRecorder.qml +++ b/Modules/Bar/Widgets/ScreenRecorder.qml @@ -12,7 +12,7 @@ NIconButton { icon: "camera-video" tooltipText: ScreenRecorderService.isRecording ? I18n.tr("tooltips.click-to-stop-recording") : I18n.tr("tooltips.click-to-start-recording") tooltipDirection: BarService.getTooltipDirection() - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density baseSize: Style.capsuleHeight applyUiScale: false colorBg: ScreenRecorderService.isRecording ? Color.mPrimary : (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) diff --git a/Modules/Bar/Widgets/SessionMenu.qml b/Modules/Bar/Widgets/SessionMenu.qml index e5125615..bb24f446 100644 --- a/Modules/Bar/Widgets/SessionMenu.qml +++ b/Modules/Bar/Widgets/SessionMenu.qml @@ -10,7 +10,7 @@ NIconButton { property ShellScreen screen - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density baseSize: Style.capsuleHeight applyUiScale: false icon: "power" diff --git a/Modules/Bar/Widgets/SystemMonitor.qml b/Modules/Bar/Widgets/SystemMonitor.qml index e8bbe666..7609f3bf 100644 --- a/Modules/Bar/Widgets/SystemMonitor.qml +++ b/Modules/Bar/Widgets/SystemMonitor.qml @@ -29,7 +29,7 @@ Rectangle { readonly property string barPosition: Settings.data.bar.position readonly property bool isVertical: barPosition === "left" || barPosition === "right" - readonly property bool compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + readonly property bool density: Settings.data.bar.density readonly property bool showCpuUsage: (widgetSettings.showCpuUsage !== undefined) ? widgetSettings.showCpuUsage : widgetMetadata.showCpuUsage readonly property bool showCpuTemp: (widgetSettings.showCpuTemp !== undefined) ? widgetSettings.showCpuTemp : widgetMetadata.showCpuTemp @@ -41,7 +41,7 @@ Rectangle { readonly property real iconSize: textSize * 1.4 readonly property real textSize: { var base = isVertical ? width * 0.82 : height - return Math.max(1, compact ? base * 0.43 : base * 0.33) + return Math.max(1, (density === "compact") ? base * 0.43 : base * 0.33) } readonly property int percentTextWidth: Math.ceil(percentMetrics.boundingRect.width + 3) diff --git a/Modules/Bar/Widgets/Taskbar.qml b/Modules/Bar/Widgets/Taskbar.qml index 3725a583..8dcab751 100644 --- a/Modules/Bar/Widgets/Taskbar.qml +++ b/Modules/Bar/Widgets/Taskbar.qml @@ -20,8 +20,8 @@ Rectangle { property int sectionWidgetsCount: 0 readonly property bool isVerticalBar: Settings.data.bar.position === "left" || Settings.data.bar.position === "right" - readonly property bool compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") - readonly property real itemSize: compact ? Style.capsuleHeight * 0.9 : Style.capsuleHeight * 0.8 + readonly property bool density: Settings.data.bar.density + readonly property real itemSize: (density === "compact") ? Style.capsuleHeight * 0.9 : Style.capsuleHeight * 0.8 property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetSettings: { @@ -46,8 +46,8 @@ Rectangle { anchors { leftMargin: isVerticalBar ? undefined : Style.marginM rightMargin: isVerticalBar ? undefined : Style.marginM - topMargin: compact ? 0 : isVerticalBar ? Style.marginM : undefined - bottomMargin: compact ? 0 : isVerticalBar ? Style.marginM : undefined + topMargin: (density === "compact") ? 0 : isVerticalBar ? Style.marginM : undefined + bottomMargin: (density === "compact") ? 0 : isVerticalBar ? Style.marginM : undefined } // Configure GridLayout to behave like RowLayout or ColumnLayout diff --git a/Modules/Bar/Widgets/Tray.qml b/Modules/Bar/Widgets/Tray.qml index 2a5665e7..f76be377 100644 --- a/Modules/Bar/Widgets/Tray.qml +++ b/Modules/Bar/Widgets/Tray.qml @@ -34,7 +34,7 @@ Rectangle { readonly property string barPosition: Settings.data.bar.position readonly property bool isVertical: barPosition === "left" || barPosition === "right" - readonly property bool compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + readonly property bool density: Settings.data.bar.density property real itemSize: Math.round(Style.capsuleHeight * 0.65) property list blacklist: widgetSettings.blacklist || widgetMetadata.blacklist || [] // Read from settings property var filteredItems: [] diff --git a/Modules/Bar/Widgets/Volume.qml b/Modules/Bar/Widgets/Volume.qml index 703725b8..4254b842 100644 --- a/Modules/Bar/Widgets/Volume.qml +++ b/Modules/Bar/Widgets/Volume.qml @@ -74,7 +74,7 @@ Item { BarPill { id: pill - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density rightOpen: BarService.getPillDirection(root) icon: getIcon() autoHide: false // Important to be false so we can hover as long as we want diff --git a/Modules/Bar/Widgets/WallpaperSelector.qml b/Modules/Bar/Widgets/WallpaperSelector.qml index c707b942..e48f368a 100644 --- a/Modules/Bar/Widgets/WallpaperSelector.qml +++ b/Modules/Bar/Widgets/WallpaperSelector.qml @@ -12,7 +12,7 @@ NIconButton { baseSize: Style.capsuleHeight applyUiScale: false - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density icon: "wallpaper-selector" tooltipText: I18n.tr("tooltips.open-wallpaper-selector") tooltipDirection: BarService.getTooltipDirection() diff --git a/Modules/Bar/Widgets/WiFi.qml b/Modules/Bar/Widgets/WiFi.qml index 53c7686c..a9156e3e 100644 --- a/Modules/Bar/Widgets/WiFi.qml +++ b/Modules/Bar/Widgets/WiFi.qml @@ -12,7 +12,7 @@ NIconButton { property ShellScreen screen - compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + density: Settings.data.bar.density baseSize: Style.capsuleHeight applyUiScale: false colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) diff --git a/Modules/Bar/Widgets/Workspace.qml b/Modules/Bar/Widgets/Workspace.qml index ef5be306..389cf148 100644 --- a/Modules/Bar/Widgets/Workspace.qml +++ b/Modules/Bar/Widgets/Workspace.qml @@ -33,9 +33,9 @@ Item { readonly property string barPosition: Settings.data.bar.position readonly property bool isVertical: barPosition === "left" || barPosition === "right" - readonly property bool compact: (Settings.data.bar.density === "compact") || (Settings.data.bar.density === "mini") + readonly property bool density: Settings.data.bar.density readonly property real baseDimensionRatio: { - const b = compact ? 0.85 : 0.65 + const b = (density === "compact") ? 0.85 : 0.65 if (widgetSettings.labelMode === "none") { return b * 0.75 } diff --git a/Widgets/NCheckbox.qml b/Widgets/NCheckbox.qml index 8d3d36d6..f27694e6 100644 --- a/Widgets/NCheckbox.qml +++ b/Widgets/NCheckbox.qml @@ -6,7 +6,7 @@ import qs.Commons RowLayout { id: root - // Public API (mirrors NToggle but compact) + // Public API property string label: "" property string description: "" property bool checked: false diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index 7976e449..4a61c1df 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -13,10 +13,10 @@ Rectangle { property string icon property string tooltipText property string tooltipDirection: "auto" + property string density: "" property bool enabled: true property bool allowClickWhenDisabled: false property bool hovering: false - property bool compact: false property color colorBg: Color.mSurfaceVariant property color colorFg: Color.mPrimary @@ -49,7 +49,14 @@ Rectangle { NIcon { icon: root.icon - pointSize: Math.max(1, root.compact ? root.width * 0.65 : root.width * 0.48) + pointSize: { + switch (root.density) { + case "compact": + return Math.max(1, root.width * 0.65) + default: + return Math.max(1, root.width * 0.48) + } + } applyUiScale: root.applyUiScale color: root.enabled && root.hovering ? colorFgHover : colorFg // Center horizontally diff --git a/Widgets/NIconButtonHot.qml b/Widgets/NIconButtonHot.qml index 202f0d1b..18df3bac 100644 --- a/Widgets/NIconButtonHot.qml +++ b/Widgets/NIconButtonHot.qml @@ -14,9 +14,9 @@ Rectangle { property string icon: "" property string tooltipText: "" property string tooltipDirection: "auto" + property string density: "" property bool enabled: true property bool allowClickWhenDisabled: false - property bool compact: false property bool hot: false // Internal properties @@ -81,7 +81,7 @@ Rectangle { // Icon NIcon { icon: root.icon - pointSize: Math.max(1, root.compact ? root.width * 0.65 : root.width * 0.48) + pointSize: Math.max(1, Math.round(root.width * 0.48)) applyUiScale: root.applyUiScale color: { if (pressed) {