Actually, this was added as a feature at one point: Add workspace {prev,next}_on_output --create by ddevault · Pull Request #3697 · swaywm/sway · GitHub. You could use workspace next_on_output --create
to switch to the next workspace, or create one (instead of cycling back to 1) if you are at the end.
Unfortunately, whoever added the feature did not contribute documentation for it. At some point an issue was raised against it, because the intended behavior of the feature was somewhat unclear: workspace {prev,next}_on_output --create is undocumented · Issue #5913 · swaywm/sway · GitHub. Instead of trying to backtrack and provide support for the undocumented feature, they decided to just scrap it.
There is an open issue here requesting the feature be brought back, if you want to chime in: Swipe Gesture - Allow creation of workspace with "workspace next" binding · Issue #7848 · swaywm/sway · GitHub. The last comment from a couple months ago said they were considering requesting the feature through SwayFX, but I looked through their issues and didn’t see it in there.
Maybe we can put together a script that provides this behavior until it is restored as a proper feature.
Edit
Here is a quick little something that works reasonably well.
Add a script to your config:
micro ~/.config/sway/scripts/advance_workspace.sh
#!/bin/bash
# Check what workspace we are on
current_workspace=$(swaymsg -t get_workspaces | jq '.[] | select(.focused == true).num')
# Check the total number of workspaces
total_workspaces=$(swaymsg -t get_workspaces | jq 'length')
# Check if the current workspace is greater than or equal to the total number of workspaces
if [ "$current_workspace" -ge "$total_workspaces" ]; then
# If it is, create a new workspace at current_workspace + 1
swaymsg workspace number "$((current_workspace + 1))"
else
# If it's not, simply switch to the next workspace
swaymsg workspace next
fi
Make it executable:
chmod +x ~/.config/sway/scripts/advance_workspace.sh
Then change your swipe:left
action in ~/.config/sway/config.d/input
to run the script:
...
bindgesture swipe:left exec ~/.config/sway/scripts/advance_workspace.sh
...
Reload the Sway config, then give it a shot and let me know how it goes. 