diff --git a/Modules/Bar/Extras/BarPillVertical.qml b/Modules/Bar/Extras/BarPillVertical.qml index 494083e4..deb304be 100644 --- a/Modules/Bar/Extras/BarPillVertical.qml +++ b/Modules/Bar/Extras/BarPillVertical.qml @@ -242,7 +242,6 @@ Item { text: root.tooltipText positionLeft: barPosition === "right" positionRight: barPosition === "left" - positionAbove: Settings.data.bar.position === "bottom" delay: Style.tooltipDelayLong } diff --git a/Modules/Bar/Widgets/Clock.qml b/Modules/Bar/Widgets/Clock.qml index 4a21bb10..0b314ffd 100644 --- a/Modules/Bar/Widgets/Clock.qml +++ b/Modules/Bar/Widgets/Clock.qml @@ -111,6 +111,8 @@ Rectangle { text: I18n.tr("clock.tooltip") target: clockContainer positionAbove: Settings.data.bar.position === "bottom" + positionLeft: barPosition === "right" + positionRight: barPosition === "left" } MouseArea { diff --git a/Modules/Bar/Widgets/ControlCenter.qml b/Modules/Bar/Widgets/ControlCenter.qml index a81199de..b730152a 100644 --- a/Modules/Bar/Widgets/ControlCenter.qml +++ b/Modules/Bar/Widgets/ControlCenter.qml @@ -36,6 +36,9 @@ NIconButton { // If we have a custom path or distro logo, don't use the theme icon. icon: (customIconPath === "" && !useDistroLogo) ? customIcon : "" tooltipText: I18n.tr("tooltips.open-control-center") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" baseSize: Style.capsuleHeight compact: (Settings.data.bar.density === "compact") colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) diff --git a/Modules/Bar/Widgets/DarkMode.qml b/Modules/Bar/Widgets/DarkMode.qml index 1043b225..333b3a9b 100644 --- a/Modules/Bar/Widgets/DarkMode.qml +++ b/Modules/Bar/Widgets/DarkMode.qml @@ -11,6 +11,9 @@ NIconButton { icon: "dark-mode" tooltipText: Settings.data.colorSchemes.darkMode ? I18n.tr("tooltips.switch-to-light-mode") : I18n.tr("tooltips.switch-to-dark-mode") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" compact: (Settings.data.bar.density === "compact") baseSize: Style.capsuleHeight 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 91ca6af2..72321b7c 100644 --- a/Modules/Bar/Widgets/KeepAwake.qml +++ b/Modules/Bar/Widgets/KeepAwake.qml @@ -15,6 +15,9 @@ NIconButton { compact: (Settings.data.bar.density === "compact") icon: IdleInhibitorService.isInhibited ? "keep-awake-on" : "keep-awake-off" tooltipText: IdleInhibitorService.isInhibited ? I18n.tr("tooltips.disable-keep-awake") : I18n.tr("tooltips.enable-keep-awake") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" colorBg: IdleInhibitorService.isInhibited ? Color.mPrimary : (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) colorFg: IdleInhibitorService.isInhibited ? Color.mOnPrimary : Color.mOnSurface colorBorder: Color.transparent diff --git a/Modules/Bar/Widgets/NightLight.qml b/Modules/Bar/Widgets/NightLight.qml index 605f572a..72f44867 100644 --- a/Modules/Bar/Widgets/NightLight.qml +++ b/Modules/Bar/Widgets/NightLight.qml @@ -23,6 +23,9 @@ NIconButton { icon: Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? "nightlight-forced" : "nightlight-on") : "nightlight-off" tooltipText: Settings.data.nightLight.enabled ? (Settings.data.nightLight.forced ? I18n.tr("tooltips.night-light-forced") : I18n.tr("tooltips.night-light-enabled")) : I18n.tr("tooltips.night-light-disabled") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" onClicked: { // Check if wlsunset is available before enabling night light if (!ProgramCheckerService.wlsunsetAvailable) { diff --git a/Modules/Bar/Widgets/NotificationHistory.qml b/Modules/Bar/Widgets/NotificationHistory.qml index d33f3116..c5a9f47b 100644 --- a/Modules/Bar/Widgets/NotificationHistory.qml +++ b/Modules/Bar/Widgets/NotificationHistory.qml @@ -53,6 +53,9 @@ NIconButton { compact: (Settings.data.bar.density === "compact") 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") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) colorFg: Color.mOnSurface colorBorder: Color.transparent diff --git a/Modules/Bar/Widgets/PowerProfile.qml b/Modules/Bar/Widgets/PowerProfile.qml index 691c72ca..0158c024 100644 --- a/Modules/Bar/Widgets/PowerProfile.qml +++ b/Modules/Bar/Widgets/PowerProfile.qml @@ -19,6 +19,9 @@ NIconButton { tooltipText: I18n.tr("tooltips.power-profile", { "profile": PowerProfileService.getName() }) + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" compact: (Settings.data.bar.density === "compact") colorBg: (PowerProfileService.profile === PowerProfile.Balanced) ? (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) : Color.mPrimary colorFg: (PowerProfileService.profile === PowerProfile.Balanced) ? Color.mOnSurface : Color.mOnPrimary diff --git a/Modules/Bar/Widgets/ScreenRecorder.qml b/Modules/Bar/Widgets/ScreenRecorder.qml index 28b5e7c2..01971e25 100644 --- a/Modules/Bar/Widgets/ScreenRecorder.qml +++ b/Modules/Bar/Widgets/ScreenRecorder.qml @@ -12,6 +12,9 @@ NIconButton { icon: "camera-video" tooltipText: ScreenRecorderService.isRecording ? I18n.tr("tooltips.click-to-stop-recording") : I18n.tr("tooltips.click-to-start-recording") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" compact: (Settings.data.bar.density === "compact") baseSize: Style.capsuleHeight 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 8aea7785..fb309d29 100644 --- a/Modules/Bar/Widgets/SessionMenu.qml +++ b/Modules/Bar/Widgets/SessionMenu.qml @@ -15,6 +15,9 @@ NIconButton { baseSize: Style.capsuleHeight icon: "power" tooltipText: I18n.tr("tooltips.session-menu") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) colorFg: Color.mError colorBorder: Color.transparent diff --git a/Modules/Bar/Widgets/Taskbar.qml b/Modules/Bar/Widgets/Taskbar.qml index 63e7326d..e9aadf4f 100644 --- a/Modules/Bar/Widgets/Taskbar.qml +++ b/Modules/Bar/Widgets/Taskbar.qml @@ -106,7 +106,9 @@ Rectangle { id: taskbarTooltip text: taskbarItem.modelData.title || taskbarItem.modelData.appId || "Unknown app." target: taskbarItem - positionAbove: Settings.data.bar.position === "bottom" + positionAbove: barPosition === "bottom" + positionLeft: barPosition === "right" + positionRight: barPosition === "left" } } } diff --git a/Modules/Bar/Widgets/WallpaperSelector.qml b/Modules/Bar/Widgets/WallpaperSelector.qml index 341df6df..79e794ea 100644 --- a/Modules/Bar/Widgets/WallpaperSelector.qml +++ b/Modules/Bar/Widgets/WallpaperSelector.qml @@ -15,6 +15,9 @@ NIconButton { compact: (Settings.data.bar.density === "compact") icon: "wallpaper-selector" tooltipText: I18n.tr("tooltips.open-wallpaper-selector") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" colorBg: (Settings.data.bar.showCapsule ? Color.mSurfaceVariant : Color.transparent) colorFg: Color.mOnSurface colorBorder: Color.transparent diff --git a/Modules/Bar/Widgets/WiFi.qml b/Modules/Bar/Widgets/WiFi.qml index 0e8d3f9b..610a0351 100644 --- a/Modules/Bar/Widgets/WiFi.qml +++ b/Modules/Bar/Widgets/WiFi.qml @@ -41,6 +41,9 @@ NIconButton { } } tooltipText: I18n.tr("tooltips.manage-wifi") + tooltipPositionAbove: Settings.data.bar.position === "bottom" + tooltipPositionLeft: Settings.data.bar.position === "right" + tooltipPositionRight: Settings.data.bar.position === "left" onClicked: PanelService.getPanel("wifiPanel")?.toggle(this) onRightClicked: PanelService.getPanel("wifiPanel")?.toggle(this) } diff --git a/Widgets/NIconButton.qml b/Widgets/NIconButton.qml index 59891903..0e6c2c8e 100644 --- a/Widgets/NIconButton.qml +++ b/Widgets/NIconButton.qml @@ -11,6 +11,9 @@ Rectangle { property string icon property string tooltipText + property bool tooltipPositionAbove: false + property bool tooltipPositionLeft: false + property bool tooltipPositionRight: false property bool enabled: true property bool allowClickWhenDisabled: false property bool hovering: false @@ -65,7 +68,9 @@ Rectangle { NTooltip { id: tooltip target: root - positionAbove: Settings.data.bar.position === "bottom" + positionAbove: root.tooltipPositionAbove + positionLeft: root.tooltipPositionLeft + positionRight: root.tooltipPositionRight text: root.tooltipText } diff --git a/Widgets/NTooltip.qml b/Widgets/NTooltip.qml index 67cf6169..f0cd55df 100644 --- a/Widgets/NTooltip.qml +++ b/Widgets/NTooltip.qml @@ -48,34 +48,17 @@ Window { return } - // Auto-detect positioning based on bar position if not explicitly set - var shouldPositionLeft = positionLeft - var shouldPositionRight = positionRight - var shouldPositionAbove = positionAbove - - // If no explicit positioning is set, auto-detect based on bar position - if (!positionLeft && !positionRight && !positionAbove) { - if (barPosition === "left") { - shouldPositionRight = true - } else if (barPosition === "right") { - shouldPositionLeft = true - } else if (barPosition === "bottom") { - shouldPositionAbove = true - } - // For "top" bar, default to below (no change needed) - } - - if (shouldPositionLeft) { + if (positionLeft) { // Position tooltip to the left of the target var pos = target.mapToGlobal(0, 0) x = pos.x - width - 12 // 12 px margin to the left y = pos.y - height / 2 + target.height / 2 - } else if (shouldPositionRight) { + } else if (positionRight) { // Position tooltip to the right of the target var pos = target.mapToGlobal(target.width, 0) x = pos.x + 12 // 12 px margin to the right y = pos.y - height / 2 + target.height / 2 - } else if (shouldPositionAbove) { + } else if (positionAbove) { // Position tooltip above the target var pos = target.mapToGlobal(0, 0) x = pos.x - width / 2 + target.width / 2