Last active
August 29, 2015 14:15
-
-
Save layus/89a6bb8feebe6c1f96d2 to your computer and use it in GitHub Desktop.
Autorandr postswitch hook
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 -x | |
| config="$1" | |
| primary="eDP1" | |
| secondary="eDP1" | |
| case "$config" in | |
| docked) | |
| primary="DP1-1" | |
| secondary="eDP1" | |
| ;; | |
| presentation) | |
| secondary="DP1-3" | |
| ;; | |
| esac | |
| move_workspace () { | |
| workspace="$1" | |
| output="$2" | |
| sed -i "/^workspace $workspace output/ c \\workspace $workspace output $output" $HOME/.i3/config | |
| # is this needed ? yes ! | |
| i3-msg workspace "$workspace" | |
| i3-msg move workspace to output "$output" | |
| i3-msg workspace 1 | |
| } | |
| export -f move_workspace | |
| # worspace 0 is on secondary screen | |
| move_workspace 0 "$secondary" | |
| # all other workspaces are on the primary display | |
| # this is just a 'for i in 1 2 ... 10' loop ;) | |
| parallel -kj1 move_workspace "{}" "$primary" ::: $(seq 1 10) | |
| # got to sane default after moving everything | |
| i3-msg workspace 1 | |
| # Is reload sufficient to remap workspaces ? Yes | |
| # ! Neither reload nor restart do change the worspace location. | |
| # ! Reload does not create missing (i3)bars. | |
| #i3-msg reload | |
| i3-msg restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment