feat(bar): implement optional mouse-following for right-click panel placement

This commit is contained in:
tibssy
2026-03-02 15:06:11 +00:00
parent 0d1a6d2e25
commit bd91405449
6 changed files with 26 additions and 3 deletions
+2
View File
@@ -844,6 +844,8 @@
"behavior-workspace-scroll-label": "Bar mouse wheel action",
"behavior-right-click-description": "Choose what right click does on empty areas of the bar.",
"behavior-right-click-label": "Bar right click action",
"behavior-right-click-follow-mouse-description": "Open the selected panel at the cursor position.",
"behavior-right-click-follow-mouse-label": "Follow mouse position",
"monitor-configure-widgets": "Configure widgets",
"monitor-override-settings": "Override global settings",
"monitor-override-settings-description": "Use custom settings for this monitor.",
+1
View File
@@ -71,6 +71,7 @@
},
"mouseWheelAction": "none",
"rightClickAction": "controlCenter",
"rightClickFollowMouse": true,
"reverseScroll": false,
"mouseWheelWrap": true,
"screenOverrides": []
+9
View File
@@ -386,6 +386,15 @@
"subTab": 2,
"subTabLabel": "common.behavior"
},
{
"labelKey": "panels.bar.behavior-right-click-follow-mouse-label",
"descriptionKey": "panels.bar.behavior-right-click-follow-mouse-description",
"widget": "NToggle",
"tab": 4,
"tabLabel": "panels.bar.title",
"subTab": 2,
"subTabLabel": "common.behavior"
},
{
"labelKey": "panels.bar.monitor-override-settings",
"descriptionKey": "panels.bar.monitor-override-settings-description",
+2 -1
View File
@@ -257,9 +257,10 @@ Singleton {
]
}
property string mouseWheelAction: "none"
property string rightClickAction: "controlCenter"
property bool reverseScroll: false
property bool mouseWheelWrap: true
property string rightClickAction: "controlCenter"
property bool rightClickFollowMouse: true
// Per-screen overrides for position and widgets
// Format: [{ "name": "HDMI-1", "position": "left" }, { "name": "DP-1", "position": "bottom", "widgets": {...} }]
property list<var> screenOverrides: []
+2 -2
View File
@@ -355,7 +355,7 @@ Item {
var screenRelativePos = mapToItem(null, mouse.x, mouse.y);
// Pass click position directly
controlCenterPanel?.toggle(null, screenRelativePos);
controlCenterPanel?.toggle(null, Settings.data.bar.rightClickFollowMouse ? screenRelativePos : "ControlCenter");
mouse.accepted = true;
} else if (bar.barRightClickAction === "settings") {
SettingsPanelService.toggle(SettingsPanel.Tab.General, -1, screen);
@@ -363,7 +363,7 @@ Item {
} else if (bar.barRightClickAction === "launcherPanel") {
var launcherPanel = PanelService.getPanel("launcherPanel", screen);
var screenRelativePos = mapToItem(null, mouse.x, mouse.y);
launcherPanel?.toggle(null, screenRelativePos);
launcherPanel?.toggle(null, Settings.data.bar.rightClickFollowMouse ? screenRelativePos : null);
mouse.accepted = true;
}
}
@@ -87,4 +87,14 @@ ColumnLayout {
defaultValue: Settings.getDefaultValue("bar.rightClickAction")
onSelected: key => Settings.data.bar.rightClickAction = key
}
NToggle {
Layout.fillWidth: true
label: I18n.tr("panels.bar.behavior-right-click-follow-mouse-label")
description: I18n.tr("panels.bar.behavior-right-click-follow-mouse-description")
checked: Settings.data.bar.rightClickFollowMouse
defaultValue: Settings.getDefaultValue("bar.rightClickFollowMouse")
onToggled: checked => Settings.data.bar.rightClickFollowMouse = checked
visible: Settings.data.bar.rightClickAction !== "none" && Settings.data.bar.rightClickAction !== "settings"
}
}