bar: configurable scroll actions (#559)
* bar: add option to disable scroll actions for volume and brightness * options for workspaces, brightness and volume * add options to readme + format --------- Co-authored-by: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
This commit is contained in:
parent
24a1af185a
commit
a8baaa9929
3 changed files with 15 additions and 3 deletions
|
|
@ -314,6 +314,11 @@ default, you must create it manually.
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"persistent": true,
|
"persistent": true,
|
||||||
|
"scrollActions": {
|
||||||
|
"brightness": true,
|
||||||
|
"workspaces": true,
|
||||||
|
"volume": true
|
||||||
|
},
|
||||||
"showOnHover": true,
|
"showOnHover": true,
|
||||||
"status": {
|
"status": {
|
||||||
"showAudio": false,
|
"showAudio": false,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ JsonObject {
|
||||||
property bool persistent: true
|
property bool persistent: true
|
||||||
property bool showOnHover: true
|
property bool showOnHover: true
|
||||||
property int dragThreshold: 20
|
property int dragThreshold: 20
|
||||||
|
property ScrollActions scrollActions: ScrollActions {}
|
||||||
property Workspaces workspaces: Workspaces {}
|
property Workspaces workspaces: Workspaces {}
|
||||||
property Tray tray: Tray {}
|
property Tray tray: Tray {}
|
||||||
property Status status: Status {}
|
property Status status: Status {}
|
||||||
|
|
@ -53,6 +54,12 @@ JsonObject {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
component ScrollActions: JsonObject {
|
||||||
|
property bool workspaces: true
|
||||||
|
property bool volume: true
|
||||||
|
property bool brightness: true
|
||||||
|
}
|
||||||
|
|
||||||
component Workspaces: JsonObject {
|
component Workspaces: JsonObject {
|
||||||
property int shown: 5
|
property int shown: 5
|
||||||
property bool activeIndicator: true
|
property bool activeIndicator: true
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ ColumnLayout {
|
||||||
|
|
||||||
function handleWheel(y: real, angleDelta: point): void {
|
function handleWheel(y: real, angleDelta: point): void {
|
||||||
const ch = childAt(width / 2, y) as WrappedLoader;
|
const ch = childAt(width / 2, y) as WrappedLoader;
|
||||||
if (ch?.id === "workspaces") {
|
if (ch?.id === "workspaces" && Config.bar.scrollActions.workspaces) {
|
||||||
// Workspace scroll
|
// Workspace scroll
|
||||||
const mon = (Config.bar.workspaces.perMonitorWorkspaces ? Hypr.monitorFor(screen) : Hypr.focusedMonitor);
|
const mon = (Config.bar.workspaces.perMonitorWorkspaces ? Hypr.monitorFor(screen) : Hypr.focusedMonitor);
|
||||||
const specialWs = mon?.lastIpcObject.specialWorkspace.name;
|
const specialWs = mon?.lastIpcObject.specialWorkspace.name;
|
||||||
|
|
@ -62,13 +62,13 @@ ColumnLayout {
|
||||||
Hypr.dispatch(`togglespecialworkspace ${specialWs.slice(8)}`);
|
Hypr.dispatch(`togglespecialworkspace ${specialWs.slice(8)}`);
|
||||||
else if (angleDelta.y < 0 || (Config.bar.workspaces.perMonitorWorkspaces ? mon.activeWorkspace?.id : Hypr.activeWsId) > 1)
|
else if (angleDelta.y < 0 || (Config.bar.workspaces.perMonitorWorkspaces ? mon.activeWorkspace?.id : Hypr.activeWsId) > 1)
|
||||||
Hypr.dispatch(`workspace r${angleDelta.y > 0 ? "-" : "+"}1`);
|
Hypr.dispatch(`workspace r${angleDelta.y > 0 ? "-" : "+"}1`);
|
||||||
} else if (y < screen.height / 2) {
|
} else if (y < screen.height / 2 && Config.bar.scrollActions.volume) {
|
||||||
// Volume scroll on top half
|
// Volume scroll on top half
|
||||||
if (angleDelta.y > 0)
|
if (angleDelta.y > 0)
|
||||||
Audio.incrementVolume();
|
Audio.incrementVolume();
|
||||||
else if (angleDelta.y < 0)
|
else if (angleDelta.y < 0)
|
||||||
Audio.decrementVolume();
|
Audio.decrementVolume();
|
||||||
} else {
|
} else if (Config.bar.scrollActions.brightness) {
|
||||||
// Brightness scroll on bottom half
|
// Brightness scroll on bottom half
|
||||||
const monitor = Brightness.getMonitorForScreen(screen);
|
const monitor = Brightness.getMonitorForScreen(screen);
|
||||||
if (angleDelta.y > 0)
|
if (angleDelta.y > 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue