34 lines
768 B
Bash
Executable File
34 lines
768 B
Bash
Executable File
#!/bin/bash
|
|
|
|
mapfile -t MONITORS < <(hyprctl monitors -j | yq -r '. | sort_by(.x) | .[].name')
|
|
mapfile -t WORKSPACES < <(hyprctl workspaces -j | yq -r '.[].name')
|
|
|
|
function docked() {
|
|
|
|
if [ ! ${#MONITORS[@]} -eq 3 ]; then
|
|
echo "Not the right amount of displays"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Assume Docked at home."
|
|
for i in "${!WORKSPACES[@]}"; do
|
|
# Move the workspace to the correct monitor
|
|
w=${WORKSPACES[$i]}
|
|
case $w in
|
|
4|8|9)
|
|
hyprctl dispatch moveworkspacetomonitor "${w} ${MONITORS[0]}"
|
|
;;
|
|
5|6)
|
|
hyprctl dispatch moveworkspacetomonitor "${w} ${MONITORS[2]}"
|
|
;;
|
|
*)
|
|
hyprctl dispatch moveworkspacetomonitor "${w} ${MONITORS[1]}"
|
|
;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
if [ "$1" = "docked" ]; then
|
|
docked
|
|
fi
|