From 2ccdf3b751edfeb87cc6f2bf0333f26ae98e9ae2 Mon Sep 17 00:00:00 2001 From: Firmino Veras Date: Fri, 14 Nov 2025 09:55:06 -0300 Subject: [PATCH] add option to open tooltips by pressing the mouse button --- .../quickshell/ii/modules/common/Config.qml | 3 +++ .../ii/modules/ii/bar/BatteryIndicator.qml | 2 +- .../ii/modules/ii/bar/ClockWidget.qml | 3 +-- .../quickshell/ii/modules/ii/bar/Resources.qml | 2 +- .../ii/modules/ii/bar/weather/WeatherBar.qml | 18 +++++++++++------- .../ii/verticalBar/BatteryIndicator.qml | 2 +- .../ii/modules/ii/verticalBar/Resources.qml | 2 +- .../ii/verticalBar/VerticalClockWidget.qml | 2 +- .../modules/ii/verticalBar/VerticalMedia.qml | 2 +- .../ii/modules/settings/BarConfig.qml | 13 +++++++++++++ 10 files changed, 34 insertions(+), 15 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/common/Config.qml b/dots/.config/quickshell/ii/modules/common/Config.qml index a724c043d..993d48398 100644 --- a/dots/.config/quickshell/ii/modules/common/Config.qml +++ b/dots/.config/quickshell/ii/modules/common/Config.qml @@ -264,6 +264,9 @@ Singleton { property bool showUnreadCount: false } } + property JsonObject tooltips: JsonObject { + property bool clickToShow: false + } } property JsonObject battery: JsonObject { diff --git a/dots/.config/quickshell/ii/modules/ii/bar/BatteryIndicator.qml b/dots/.config/quickshell/ii/modules/ii/bar/BatteryIndicator.qml index 3cabf9f36..36799fefd 100644 --- a/dots/.config/quickshell/ii/modules/ii/bar/BatteryIndicator.qml +++ b/dots/.config/quickshell/ii/modules/ii/bar/BatteryIndicator.qml @@ -16,7 +16,7 @@ MouseArea { implicitWidth: batteryProgress.implicitWidth implicitHeight: Appearance.sizes.barHeight - hoverEnabled: true + hoverEnabled: !Config.options.bar.tooltips.clickToShow ClippedProgressBar { id: batteryProgress diff --git a/dots/.config/quickshell/ii/modules/ii/bar/ClockWidget.qml b/dots/.config/quickshell/ii/modules/ii/bar/ClockWidget.qml index 958695a86..1d4b9f865 100644 --- a/dots/.config/quickshell/ii/modules/ii/bar/ClockWidget.qml +++ b/dots/.config/quickshell/ii/modules/ii/bar/ClockWidget.qml @@ -40,8 +40,7 @@ Item { MouseArea { id: mouseArea anchors.fill: parent - hoverEnabled: true - acceptedButtons: Qt.NoButton + hoverEnabled: !Config.options.bar.tooltips.clickToShow ClockWidgetPopup { hoverTarget: mouseArea diff --git a/dots/.config/quickshell/ii/modules/ii/bar/Resources.qml b/dots/.config/quickshell/ii/modules/ii/bar/Resources.qml index 6c25ab507..2d9e936ac 100644 --- a/dots/.config/quickshell/ii/modules/ii/bar/Resources.qml +++ b/dots/.config/quickshell/ii/modules/ii/bar/Resources.qml @@ -9,7 +9,7 @@ MouseArea { property bool alwaysShowAllResources: false implicitWidth: rowLayout.implicitWidth + rowLayout.anchors.leftMargin + rowLayout.anchors.rightMargin implicitHeight: Appearance.sizes.barHeight - hoverEnabled: true + hoverEnabled: !Config.options.bar.tooltips.clickToShow RowLayout { id: rowLayout diff --git a/dots/.config/quickshell/ii/modules/ii/bar/weather/WeatherBar.qml b/dots/.config/quickshell/ii/modules/ii/bar/weather/WeatherBar.qml index 1fcde7176..e82f41dab 100644 --- a/dots/.config/quickshell/ii/modules/ii/bar/weather/WeatherBar.qml +++ b/dots/.config/quickshell/ii/modules/ii/bar/weather/WeatherBar.qml @@ -13,15 +13,19 @@ MouseArea { implicitWidth: rowLayout.implicitWidth + 10 * 2 implicitHeight: Appearance.sizes.barHeight - hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + hoverEnabled: !Config.options.bar.tooltips.clickToShow onPressed: { - Weather.getData(); - Quickshell.execDetached(["notify-send", - Translation.tr("Weather"), - Translation.tr("Refreshing (manually triggered)") - , "-a", "Shell" - ]) + if (mouse.button === Qt.RightButton) { + Weather.getData(); + Quickshell.execDetached(["notify-send", + Translation.tr("Weather"), + Translation.tr("Refreshing (manually triggered)") + , "-a", "Shell" + ]) + mouse.accepted = false + } } RowLayout { diff --git a/dots/.config/quickshell/ii/modules/ii/verticalBar/BatteryIndicator.qml b/dots/.config/quickshell/ii/modules/ii/verticalBar/BatteryIndicator.qml index d2b729244..3f20cbd2c 100644 --- a/dots/.config/quickshell/ii/modules/ii/verticalBar/BatteryIndicator.qml +++ b/dots/.config/quickshell/ii/modules/ii/verticalBar/BatteryIndicator.qml @@ -15,7 +15,7 @@ MouseArea { readonly property bool isLow: percentage <= Config.options.battery.low / 100 implicitHeight: batteryProgress.implicitHeight - hoverEnabled: true + hoverEnabled: !Config.options.bar.tooltips.clickToShow ClippedProgressBar { id: batteryProgress diff --git a/dots/.config/quickshell/ii/modules/ii/verticalBar/Resources.qml b/dots/.config/quickshell/ii/modules/ii/verticalBar/Resources.qml index 353874723..1c3815721 100644 --- a/dots/.config/quickshell/ii/modules/ii/verticalBar/Resources.qml +++ b/dots/.config/quickshell/ii/modules/ii/verticalBar/Resources.qml @@ -9,7 +9,7 @@ MouseArea { property bool alwaysShowAllResources: false implicitHeight: columnLayout.implicitHeight implicitWidth: columnLayout.implicitWidth - hoverEnabled: true + hoverEnabled: !Config.options.bar.tooltips.clickToShow ColumnLayout { id: columnLayout diff --git a/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalClockWidget.qml b/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalClockWidget.qml index 15a49c5a5..3fdacc337 100644 --- a/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalClockWidget.qml +++ b/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalClockWidget.qml @@ -33,7 +33,7 @@ Item { MouseArea { id: mouseArea anchors.fill: parent - hoverEnabled: true + hoverEnabled: !Config.options.bar.tooltips.clickToShow acceptedButtons: Qt.NoButton Bar.ClockWidgetPopup { diff --git a/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalMedia.qml b/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalMedia.qml index 8d38caa76..4db432b26 100644 --- a/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalMedia.qml +++ b/dots/.config/quickshell/ii/modules/ii/verticalBar/VerticalMedia.qml @@ -28,7 +28,7 @@ MouseArea { } acceptedButtons: Qt.MiddleButton | Qt.BackButton | Qt.ForwardButton | Qt.RightButton | Qt.LeftButton - hoverEnabled: true + hoverEnabled: !Config.options.bar.tooltips.clickToShow onPressed: (event) => { if (event.button === Qt.MiddleButton) { activePlayer.togglePlaying(); diff --git a/dots/.config/quickshell/ii/modules/settings/BarConfig.qml b/dots/.config/quickshell/ii/modules/settings/BarConfig.qml index a53d30644..182124693 100644 --- a/dots/.config/quickshell/ii/modules/settings/BarConfig.qml +++ b/dots/.config/quickshell/ii/modules/settings/BarConfig.qml @@ -334,4 +334,17 @@ ContentPage { } } } + + ContentSection { + icon: "tooltip" + title: Translation.tr("Tooltips") + ConfigSwitch { + buttonIcon: "web_traffic" + text: Translation.tr("Click to show") + checked: Config.options.bar.tooltips.clickToShow + onCheckedChanged: { + Config.options.bar.tooltips.clickToShow = checked; + } + } + } }