Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions quickshell/Common/SettingsData.qml
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,7 @@ Singleton {
"scrollEnabled": true,
"scrollXBehavior": "column",
"scrollYBehavior": "workspace",
"middleClickAction": "none",
"shadowIntensity": 0,
"shadowOpacity": 60,
"shadowColorMode": "default",
Expand Down
1 change: 1 addition & 0 deletions quickshell/Common/settings/SettingsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ var SPEC = {
scrollEnabled: true,
scrollXBehavior: "column",
scrollYBehavior: "workspace",
middleClickAction: "none",
shadowIntensity: 0,
shadowOpacity: 60,
shadowColorMode: "default",
Expand Down
21 changes: 20 additions & 1 deletion quickshell/Modules/DankBar/DankBarWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,26 @@ PanelWindow {
anchors.fill: parent
z: -2
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: {
onClicked: mouse => {
if (mouse.button === Qt.MiddleButton) {
const action = barConfig?.middleClickAction ?? "none"
switch (action) {
case "control-center":
barWindow.triggerControlCenter();
return;
case "spotlight":
Quickshell.execDetached(["dms", "ipc", "call", "spotlight", "toggle"]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldnt execute dms ipc from within DMS itself, should use PopoutService, e.g. PopoutService.toggleDankLauncherV2()

return;
case "close-window":
const active = ToplevelManager.activeToplevel;
if (active && typeof active.close === "function")
active.close();
return;
case "settings":
Quickshell.execDetached(["dms", "ipc", "call", "settings", "toggle"]);
return;
}
}
const screenName = barWindow.screen?.name;
if (!screenName)
return;
Expand Down
47 changes: 47 additions & 0 deletions quickshell/Modules/Settings/DankBarTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Item {
scrollEnabled: defaultBar.scrollEnabled ?? true,
scrollXBehavior: defaultBar.scrollXBehavior ?? "column",
scrollYBehavior: defaultBar.scrollYBehavior ?? "workspace",
middleClickAction: defaultBar.middleClickAction ?? "none",
hoverPopouts: defaultBar.hoverPopouts ?? false,
hoverPopoutDelay: defaultBar.hoverPopoutDelay ?? 150,
shadowIntensity: defaultBar.shadowIntensity ?? 0,
Expand Down Expand Up @@ -1936,6 +1937,52 @@ Item {
}
}
}

SettingsCard {
iconName: "mouse"
title: I18n.tr("Mouse Click Action")
settingKey: "barMouseClickAction"
visible: !dankBarTab.appearanceOnly && selectedBarConfig?.enabled

SettingsDropdownRow {
text: I18n.tr("Middle Click")
description: I18n.tr("Choose what middle-clicking empty bar space does")
settingKey: "barMiddleClickAction"
options: [
I18n.tr("None", "bar middle click action"),
I18n.tr("Toggle Control Center", "bar middle click action"),
I18n.tr("Toggle Launcher", "bar middle click action"),
I18n.tr("Close Active Window", "bar middle click action"),
I18n.tr("Toggle Settings", "bar middle click action")
]
currentValue: {
switch (selectedBarConfig?.middleClickAction ?? "none") {
case "control-center":
return I18n.tr("Toggle Control Center", "bar middle click action");
case "spotlight":
return I18n.tr("Toggle Launcher", "bar middle click action");
case "close-window":
return I18n.tr("Close Active Window", "bar middle click action");
case "settings":
return I18n.tr("Toggle Settings", "bar middle click action");
default:
return I18n.tr("None", "bar middle click action");
}
}
onValueChanged: value => {
if (value === I18n.tr("Toggle Control Center", "bar middle click action"))
SettingsData.updateBarConfig(selectedBarId, { middleClickAction: "control-center" });
else if (value === I18n.tr("Toggle Launcher", "bar middle click action"))
SettingsData.updateBarConfig(selectedBarId, { middleClickAction: "spotlight" });
else if (value === I18n.tr("Close Active Window", "bar middle click action"))
SettingsData.updateBarConfig(selectedBarId, { middleClickAction: "close-window" });
else if (value === I18n.tr("Toggle Settings", "bar middle click action"))
SettingsData.updateBarConfig(selectedBarId, { middleClickAction: "settings" });
else
SettingsData.updateBarConfig(selectedBarId, { middleClickAction: "none" });
}
}
}
}
}
}
Loading