Skip to content

Commit

Permalink
Merge pull request #2220 from sigboe/warp-on-scroll-toggle
Browse files Browse the repository at this point in the history
sway/workspaces: setting to not warp to window when scrolling
  • Loading branch information
Alexays authored Jul 4, 2023
2 parents 5c64d03 + a67e692 commit 12725f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions man/waybar-sway-workspaces.5.scd
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ Addressed by *sway/workspaces*
typeof: bool ++
Whether to sort workspaces alphabetically. Please note this can make "swaymsg workspace prev/next" move to workspaces inconsistent with the ordering shown in Waybar.

warp-on-scroll: ++
typeof: bool ++
default: true ++
If set to false, you can scroll to cycle through workspaces without mouse warping being enabled. If set to true this behaviour is disabled.

# FORMAT REPLACEMENTS

*{value}*: Name of the workspace, as defined by sway.
Expand Down
1 change: 1 addition & 0 deletions resources/config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "warp-on-scroll": false,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
Expand Down
6 changes: 6 additions & 0 deletions src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,17 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
return true;
}
}
if (!config_["warp-on-scroll"].asBool()) {
ipc_.sendCmd(IPC_COMMAND, fmt::format("mouse_warping none"));
}
try {
ipc_.sendCmd(IPC_COMMAND, fmt::format(workspace_switch_cmd_, "--no-auto-back-and-forth", name));
} catch (const std::exception &e) {
spdlog::error("Workspaces: {}", e.what());
}
if (!config_["warp-on-scroll"].asBool()) {
ipc_.sendCmd(IPC_COMMAND, fmt::format("mouse_warping container"));
}
return true;
}

Expand Down

0 comments on commit 12725f4

Please sign in to comment.