The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
0

i3-msg set workspace on specific output

asked 2014-08-06 05:31:56 +0000

geekingreen gravatar image

So I am trying to dynamically set my workspaces to output on specific displays. The problem is i3-msg doesn't seem to want to accept i3-msg workspace 1 output $PRIMARY. It works perfectly fine in my ~/.i3/config but when I run it in i3-msg it creates a brand new workspace with the name "1 output HDMI-0" instead of forcing workspace 1 to output HDMI-0. I've also tried putting quotes around the workspace name to no avail i3-msg workspace "1" output $PRIMARY. I would really appreciate it if someone could point me in the right direction, thanks!

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2014-08-06 11:50:21 +0000

Adaephon gravatar image

There is a difference between the workspace command and the workspace setting. They have the same name but do different things:

  • The workspace setting (workspace <workspace> output <output>) in the configuration file sets specific outputs for workspaces. It can not be used as a command. (i3-msg only accepts commands)

  • Whereas the workspace command (usage workspace <workspace>) switches to the given workspace, creating it, if it does not yet exist. It cannot be used to set or even move a workspace to another output

i3-msg only accepts commands, so when you tell it workspace 1 output HDMI-0 it expects the workspace command and takes everything after it as the name of the new workspace.


Setting an output for a workspace before it is created can only be done in the configuration file. Any workspace not set there will open on the current output.

You can always move workspaces after they have been created using the move command in the form move <workspace> to <output>. Where <output> is any direction or the name of the output (as used with the workspace setting).

edit flag offensive delete link more

Comments

That explains it. Is there a way to dynamically set a variable in the i3 config? Moving a workspace won't work since none of them will have any containers on them at the time I'd want to move them, causing them to spawn on whatever display is active at the time when I switch to that workspace.

geekingreen gravatar imagegeekingreen ( 2014-08-06 15:44:00 +0000 )edit

i3 loads the entire configuration at start-up; any changes to variables in the configuration file would require you to restart the window manager afterward. You should explain exactly why you want to do this; it seems [almost random from where I'm sitting.](http://xyproblem.info)

ANOKNUSA gravatar imageANOKNUSA ( 2014-08-06 16:11:26 +0000 )edit

Here is the real problem, I have several machines that I sync my dotfiles across. Each machine has different displays with different names M1: HDMI-0, DVI-D-0 M2: DP-2, DP-3, I can use xrandr to query which is primary or secondary. I want to use what I get from that query to set my workspace outputs

geekingreen gravatar imagegeekingreen ( 2014-08-06 16:20:39 +0000 )edit

You could just write a script, which does the appropriate replacements right after the syncing. Depending on the mechanism you use for syncing it could be easily automated.

Adaephon gravatar imageAdaephon ( 2014-08-06 20:37:14 +0000 )edit

Question Tools

Stats

Asked: 2014-08-06 05:31:56 +0000

Seen: 790 times

Last updated: Aug 06 '14