Last active
October 31, 2023 15:10
-
-
Save pablotrianda/293ed1b68e4cd4dc2c47d6f56be6c7f0 to your computer and use it in GitHub Desktop.
Select and change all workspaces to specific monitor
This file contains hidden or 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
#!/bin/bash | |
# Script to change all the workspaces to the selected monitor | |
# | |
# Requirements: | |
# [Rofi](https://github.com/davatorium/rofi) | |
# [jq](https://jqlang.github.io/jq/) | |
display=$(echo -e "$(xrandr --listmonitors | awk 'NR > 1 {print $NF}')" | rofi -theme Pop-Dark -dmenu -multi-select ) | |
if [ -z "$display" ]; then | |
exit 0 | |
fi | |
workspaces=$(i3-msg -t get_workspaces | jq '.[].num' | sort ) | |
for workspace in $workspaces | |
do | |
i3-msg workspace $workspace | |
i3-msg move workspace to output $display | |
done | |
# Set the focus to the workspace 1 | |
i3-msg workspace 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment