-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c98a61
commit 7555a7a
Showing
3 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Get the active outputs (screens) and store them in an array | ||
readarray -t active_outputs < <(i3-msg -t get_outputs | jq -r 'map(select(.active == true) | .name)') | ||
|
||
# Find a workspace that is not displayed on any screen | ||
unused_workspace=$(echo {1..20} | tr ' ' '\n' | grep -vxFf <(i3-msg -t get_workspaces | jq -r '.[].num' | tr ' ' '\n') | head -n 1) | ||
|
||
# Apply the workspace change to each screen | ||
for output in "${active_outputs[@]}" | ||
do | ||
# Skip empty or invalid entries | ||
if [[ -z "$output" || "$output" == "[" || "$output" == "]" ]]; then | ||
continue | ||
fi | ||
|
||
# Calculate the workspace number for this screen | ||
workspace_to_switch=$((unused_workspace++)) | ||
|
||
# Uncomment to enable actual workspace switching | ||
i3-msg "focus output $output" && i3-msg "workspace number $workspace_to_switch" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters