Fix swapdesktop script

This commit is contained in:
ItsDrike 2022-08-23 18:59:27 +02:00
parent 7c5b8710fd
commit c9555e60ad
No known key found for this signature in database
GPG key ID: B014E761034AF742

View file

@ -32,16 +32,16 @@ else
# In case the active desktop on the other monitor is the desktop we will be moving # In case the active desktop on the other monitor is the desktop we will be moving
# away into this monitor, we will want to focus the current desktop on the other # away into this monitor, we will want to focus the current desktop on the other
# monitor instead. Essentially, we simply swap them in this case. # monitor instead. Essentially, we simply swap them in this case.
[ "$ACTIVE_OTHER" == "$SELECTED_DESKTOP" ] && ACTIVE_OTHER="$CURRENT_DESKTOP" [ "$ACTIVE_OTHER" == "$SELECTED_DESKTOP" ] && ACTIVE_OTHER="$FOCUSED_DESKTOP"
# Move currently focused desktop into the monitor where the other desktop is. # Move currently focused desktop into the monitor where the other desktop is.
# This is necessary, because BSPWM require each monitor to have at least 1 desktop, # This is necessary, because BSPWM require each monitor to have at least 1 desktop,
# so since we're moving a desktop away, we should first move one in, to avoid failures. # so since we're moving a desktop away, we should first move one in, to avoid failures.
# It also allows us to later bring the current desktop into focus on the other monitor. # It also allows us to later bring the current desktop into focus on the other monitor.
bspc desktop "$CURRENT_DESKTOP" --to-monitor "$SELECTED_MONITOR" bspc desktop "$FOCUSED_DESKTOP" --to-monitor "$SELECTED_MONITOR"
# Now we can move the selected desktop from the other monitor onto this one. # Now we can move the selected desktop from the other monitor onto this one.
bspc desktop "$SELECTED_DESKTOP" --to-monitor "$CURRENT_MONITOR" bspc desktop "$SELECTED_DESKTOP" --to-monitor "$FOCUSED_MONITOR"
# Ensure the previoulsy active desktop on the other monitor is active by bringing it # Ensure the previoulsy active desktop on the other monitor is active by bringing it
# into focus now. If this was the desktop we moved, this will instead be the desktop # into focus now. If this was the desktop we moved, this will instead be the desktop