I have 3 screens all working fine.

So i try to implement my i3 config for following behavior:

When I hit my "home"-key every screen has a specific workspace to switch to. The idea is to provide a basic set of workspaces for all screens to act for one purpose, here of general purpose and startup default (also imaginable is a set of workspaces for coding with some terminals firing up left some IDE popping up middle stackoverflow right for example, for now a home row will suffice)

This basically looks like this.

#screen names / output names
set $screen_left "HDMI-0"
set $screen_middle "DVI-D-0"
set $screen_right "DVI-I-0"

# custom workspace names
set $ws_home  "Home"
set $ws_homeL "HomeL"
set $ws_homeR "HomeR"

workspace $ws_homeL output $screen_left
workspace $ws_home output $screen_middle
workspace $ws_homeR output $screen_right

# workspace key settings
# variable to contain the name of keys related to specific workspaces
set $ws_key_home "dead_circumflex"

# switch to workspace
# home workspace
bindsym $mod+$ws_key_home workspace $ws_home ; workspace $ws_homeL ; workspace $ws_homeR

works like a charm.
So now i get on to moving windows to this set of workspaces and here I would want for a window to appear on the same screen it was before i moved it to the set of home-workspaces via one keypress:

bindsim $mod+Shift+$ws_key_home move container to workspace >select workspace to correct screen here<

So lets say I have workspace 3 with a browser open on the left screen and i hit $mod+Shift+circumflex the browser would reappear on workspace HomeL,
while if workspace 3 was on the right screen it would go to HomeR instead.

Providing a binding for each home-workspace is not the desired solution.

So question is ... can I determine the screen a container is on ? How can I then choose among the workspaces inside of the config through an expression?

Am I going at this comletely wrong ? Are there some features I missed, which are already providing what I seek ?

  • 1
    i think you'll need an external script. i3-container-commander can do similar things from commandline, using dmenu or rofi for user input: i3-container-commander.py --command 'move to workspace x' --menu rofi (and rofi pops up to select the container to move). i don't know if it allows exactly the behavior you're seeking, but that's where i'd start. – quixotic Dec 31 '17 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.