Re: [i3] Assign workspaces to outputs dynamically.

  • From: "Guillaume Maudoux (Layus)" <layus.on@xxxxxxxxx>
  • To: Discussions/Questions about the i3 window manager <i3-discuss@xxxxxxxxxxxxx>
  • Date: Thu, 26 Feb 2015 14:36:08 +0100

Ok, reached a stable solution.
A restart is needed because otherwise the missing (i3)bars for the new display are not started.

If some are interested, here is the gist : https://gist.github.com/layus/89a6bb8feebe6c1f96d2#file-postswitch

Layus.

PS : No bug yet with the "next" branch :)

Le 21/02/15 12:05, Michael Stapelberg a écrit :

Correct. I’m not sure if reload does the trick or if a restart is
required. In case reload is not sufficient, I bet TonyC is interested
in fixing that ;).

On Sat, Feb 21, 2015 at 11:47 AM, Layus <layus.on@xxxxxxxxx> wrote:
@Michael,

You mean that I should rewrite .i3/config and reload (restart?) i3 every
time I detect a monitor change, right ?

This seems a bit overkill but might just work.
I will try that on Monday.

Le 21/02/15 11:25, Michael Stapelberg a écrit :

For the level of customization you describe, you’ll need to create a
simple script that generates/puts together your config file. See e.g.
https://faq.i3wm.org/question/1367/anyway-to-include-in-config-file/

On Tue, Feb 17, 2015 at 9:31 PM, Serge van Ginderachter
<serge@xxxxxxxxxxxxxxxxxx> wrote:
fwiw, I use a script that detects things like which monitor is connected,
and falls back to certain defaults, or can be forced to e.g. VGA display
etc.

https://github.com/srvg/dotfiles/blob/master/bin/xdisp

HTH,

Serge

On 17 February 2015 at 21:24, Layus <layus.on@xxxxxxxxx> wrote:
Hi,

I use my laptop in three different environments with different randr
outputs enabled.
I often switch between environments, and could not configure i3 to place
my workspaces on the desired outputs.
My randr configuration is updated automatically on udev drm change
events
with autorandr.
Is there some way to specify dynamic output bindings ?

My three environments are pretty simple :

Nomad (undocked)

eDP1 connected primary ← all workspaces

Docked

eDP1 connected ← workspace 0
DP1-1 connected primary ← all other workspaces

Presentation

VGA1 connected ← workspace 0
eDP1 connected primary ← all other workspaces

My current config works for situation 1 and 2 :

workspace 0 output eDP1

workspace 1 output DP1-1
workspace 2 output DP1-1
workspace 3 output DP1-1
workspace 4 output DP1-1
workspace 5 output DP1-1
workspace 6 output DP1-1
workspace 7 output DP1-1
workspace 8 output DP1-1
workspace 9 output DP1-1
workspace 10 output DP1-1

This is already a hack because the configuration describes the Docked
configuration.
It incidentally works when Undocked because there is only one output,
and
all workspaces are mapped to it.

It does not work at all for my presentation.

One solution that would suit me would be to extend the workspace <x>
output command to support multiple outputs in order of preference.
for example, worspace 0 output(s) VGA1 eDP1 would place workspace 0 on
the
projector when available, and on eDP1 otherwise.

Do you find this useful ?

Layus.







Other related posts: