mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
feat(bar-scroll-actions): refactor mouse wheel action setting to use a combobox
This commit is contained in:
@@ -827,8 +827,8 @@
|
||||
"appearance-use-separate-opacity-label": "Use separate bar opacity",
|
||||
"appearance-widget-spacing-description": "Adjust the spacing between each widget in the bar.",
|
||||
"appearance-widget-spacing-label": "Widget spacing",
|
||||
"behavior-workspace-scroll-description": "Use the mouse wheel on empty areas of the bar to switch between workspaces or columns.",
|
||||
"behavior-workspace-scroll-label": "Scroll to switch workspaces",
|
||||
"behavior-workspace-scroll-description": "Choose what the mouse wheel does on empty areas of the bar.",
|
||||
"behavior-workspace-scroll-label": "Bar mouse wheel action",
|
||||
"monitor-configure-widgets": "Configure widgets",
|
||||
"monitor-override-settings": "Override global settings",
|
||||
"monitor-override-settings-description": "Use custom settings for this monitor.",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
]
|
||||
},
|
||||
"enableWorkspaceScroll": false,
|
||||
"mouseWheelAction": "none",
|
||||
"screenOverrides": []
|
||||
},
|
||||
"general": {
|
||||
|
||||
@@ -253,6 +253,7 @@ Singleton {
|
||||
]
|
||||
}
|
||||
property bool enableWorkspaceScroll: false
|
||||
property string mouseWheelAction: "none"
|
||||
// Per-screen overrides for position and widgets
|
||||
// Format: [{ "name": "HDMI-1", "position": "left" }, { "name": "DP-1", "position": "bottom", "widgets": {...} }]
|
||||
property list<var> screenOverrides: []
|
||||
|
||||
+6
-1
@@ -184,6 +184,11 @@ Item {
|
||||
// Wheel scroll handling (empty bar area)
|
||||
property int barWheelAccumulatedDelta: 0
|
||||
property bool barWheelCooldown: false
|
||||
readonly property string barWheelAction: {
|
||||
if (Settings.data.bar.mouseWheelAction !== undefined && Settings.data.bar.mouseWheelAction !== "")
|
||||
return Settings.data.bar.mouseWheelAction;
|
||||
return Settings.data.bar.enableWorkspaceScroll ? "workspace" : "none";
|
||||
}
|
||||
|
||||
// Position and size the bar content based on orientation
|
||||
x: (root.barPosition === "right") ? (parent.width - root.barHeight) : 0
|
||||
@@ -362,7 +367,7 @@ Item {
|
||||
id: barWheelHandler
|
||||
target: bar
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
enabled: Settings.data.bar.enableWorkspaceScroll
|
||||
enabled: bar.barWheelAction === "workspace"
|
||||
|
||||
onWheel: function (event) {
|
||||
if (bar.barWheelCooldown)
|
||||
|
||||
@@ -10,12 +10,40 @@ ColumnLayout {
|
||||
spacing: Style.marginL
|
||||
Layout.fillWidth: true
|
||||
|
||||
NToggle {
|
||||
readonly property string effectiveWheelAction: {
|
||||
if (Settings.data.bar.mouseWheelAction !== undefined && Settings.data.bar.mouseWheelAction !== "")
|
||||
return Settings.data.bar.mouseWheelAction;
|
||||
return Settings.data.bar.enableWorkspaceScroll ? "workspace" : "none";
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("panels.bar.behavior-workspace-scroll-label")
|
||||
description: I18n.tr("panels.bar.behavior-workspace-scroll-description")
|
||||
checked: Settings.data.bar.enableWorkspaceScroll
|
||||
defaultValue: Settings.getDefaultValue("bar.enableWorkspaceScroll")
|
||||
onToggled: checked => Settings.data.bar.enableWorkspaceScroll = checked
|
||||
model: {
|
||||
var items = [
|
||||
{
|
||||
"key": "none",
|
||||
"name": "Nothing"
|
||||
},
|
||||
{
|
||||
"key": "workspace",
|
||||
"name": "Workspace"
|
||||
}
|
||||
];
|
||||
if (CompositorService.isNiri) {
|
||||
items.push({
|
||||
"key": "content",
|
||||
"name": "Content"
|
||||
});
|
||||
}
|
||||
return items;
|
||||
}
|
||||
currentKey: root.effectiveWheelAction
|
||||
defaultValue: Settings.getDefaultValue("bar.mouseWheelAction")
|
||||
onSelected: key => {
|
||||
Settings.data.bar.mouseWheelAction = key;
|
||||
Settings.data.bar.enableWorkspaceScroll = (key === "workspace");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user