Feature (Bar): New Setting for Tooltip Behavior on the Bar (#2431)

This commit is contained in:
end-4
2025-11-14 15:37:40 +01:00
committed by GitHub
10 changed files with 34 additions and 15 deletions
@@ -264,6 +264,9 @@ Singleton {
property bool showUnreadCount: false
}
}
property JsonObject tooltips: JsonObject {
property bool clickToShow: false
}
}
property JsonObject battery: JsonObject {
@@ -16,7 +16,7 @@ MouseArea {
implicitWidth: batteryProgress.implicitWidth
implicitHeight: Appearance.sizes.barHeight
hoverEnabled: true
hoverEnabled: !Config.options.bar.tooltips.clickToShow
ClippedProgressBar {
id: batteryProgress
@@ -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
@@ -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
@@ -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 {
@@ -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
@@ -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
@@ -33,7 +33,7 @@ Item {
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
hoverEnabled: !Config.options.bar.tooltips.clickToShow
acceptedButtons: Qt.NoButton
Bar.ClockWidgetPopup {
@@ -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();
@@ -334,4 +334,17 @@ ContentPage {
}
}
}
ContentSection {
icon: "tooltip"
title: Translation.tr("Tooltips")
ConfigSwitch {
buttonIcon: "ads_click"
text: Translation.tr("Click to show")
checked: Config.options.bar.tooltips.clickToShow
onCheckedChanged: {
Config.options.bar.tooltips.clickToShow = checked;
}
}
}
}