The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

Workspace output multiple values

asked 2014-04-24 13:36:08 +0000

kviktor gravatar image

I'm trying to bind workspace 5 to output VGA1 and DP1 too. (I have display port at home and vga at work)

I currently have this, but the second entry obviously overwrites the first one so when I plugin the VGA monitor it gets workspace 2.

workspace 5 output VGA1
workspace 5 output DP1

What would be the best way to do it?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-04-25 05:16:14 +0000

Adaephon gravatar image

There is no builtin feature to do this. But with some scripting it should not be too difficult.

First set a variable in your configuration file for the output(s) and reference it in your workspace definitions:


workspace 1 output $OUTPUT1
workspace 5 output $OUTPUT2

Then you need a script that changes the variable definitions for you and reloads the configuration

OUT2=$(xrandr | awk '/(VGA1|DP1)/ connected/{print $1}')
sed 's/^set\s\s*$OUTPUT2\s.*/set $OUTPUT2 '$OUT2'/' -i "${HOME}/.i3/config"
i3-msg reload

Now you can set a keybinding for this script.


You could even run this script directly from your configuration file

exec --no-startup-id /path/to/

As exec statements are not executed when reloading the configuration it should not lead to an endless loop. I am assuming that the statements are also only run after i3 has fully parsed the configuration file (for the first time) and reloading can thus be done without risk, but I am not sure.

edit flag offensive delete link more

Question Tools


Asked: 2014-04-24 13:36:08 +0000

Seen: 172 times

Last updated: Apr 25 '14