Well.. it costed me around 6 hours to do it. So I'm going to make a simple resume how I did it:
I have two monitors so I did fallowing:
I created a file workspaces.conf
and inside I did this:
# assign workspaces to screens
workspace 1 output $Monitor_left
workspace 2 output $Monitor_left
...
workspace 9 output $Monitor_left
workspace 10 output $Monitor_left
workspace 11 output $Monitor_right
workspace 12 output $Monitor_right
...
workspace 19 output $Monitor_right
workspace 20 output $Monitor_right
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws01 "1"
set $ws02 "2"
....
set $ws09 "9"
set $ws00 "10"
set $ws11 "11"
...
set $ws19 "19"
set $ws20 "20"
and if you have 2 or more monitors PLEASE name the WS
s as ws01
, ws02
, ws03
,... instead of ws1
, ws2
, ws3
. (I'll tell you why later ;D ).
After doing it you can include this file inside of yours i3config
config
include $HOME/.config/i3/workspaces.conf
After that, make sure to add the super keys
(just use the command xmodmap
)
#Master key Super "Windows" and Alt Left "alt"
(soon you will understand why 2 mod keys)
set $mod Mod4
set $mod_alt Mod1
And now set your monitors inside of variables (you can use the command xrand
and findout what is the output)
set $Monitor_left DP-0
set $Monitor_right HDMI-0
Now make the confs to switch to the workspaces, something like this:
# switch to workspace
# Monitor1
bindsym $mod+mod2+KP_1 workspace $ws01 ; move workspace to output $Monitor_left
bindsym $mod+mod2+KP_2 workspace $ws02 ; move workspace to output $Monitor_left
......
bindsym $mod+mod2+KP_9 workspace $ws09 ; move workspace to output $Monitor_left
bindsym $mod+mod2+KP_0 workspace $ws00 ; move workspace to output $Monitor_left
# Monitor2
bindsym $mod_alt+mod2+KP_1 workspace $ws11 ; move workspace to output $Monitor_right
bindsym $mod_alt+mod2+KP_2 workspace $ws12 ; move workspace to output $Monitor_right
.....
bindsym $mod_alt+mod2+KP_9 workspace $ws19 ; move workspace to output $Monitor_right
bindsym $mod_alt+mod2+KP_0 workspace $ws20 ; move workspace to output $Monitor_right
it's almost perfect :)
From now on, you can use superkey+number
(windows_key) / superkey+numpad_number
to switch to ALL workspaces (1-10) on your left monitor and alt_left+numpad_number
to switch to ALL workspaces (11-20) on your right monitor
Moving containers to other workspacies!
To do it you can just copy this lines here OR use the command xmodmap -pke | grep KP_
to find the right keys
# move focused container to workspace
# (monitor1 numpad)
bindsym $mod+Mod2+Shift+KP_End move container to workspace $ws01
bindsym $mod+Mod2+Shift+KP_Down move container to workspace $ws02
bindsym $mod+Mod2+Shift+KP_Next move container to workspace $ws03
bindsym $mod+Mod2+Shift+KP_Left move container to workspace $ws04
bindsym $mod+Mod2+Shift+KP_Begin move container to workspace $ws05
bindsym $mod+Mod2+Shift+KP_Right move container to workspace $ws06
bindsym $mod+Mod2+Shift+KP_Home move container to workspace $ws07
bindsym $mod+Mod2+Shift+KP_Up move container to workspace $ws08
bindsym $mod+Mod2+Shift+KP_Prior move container to workspace $ws09
bindsym $mod+Mod2+Shift+KP_Insert move container to workspace $ws00
# (Monitor2 numpad)
bindsym $mod_alt+Mod2+Shift+KP_End move container to workspace $ws11
bindsym $mod_alt+Mod2+Shift+KP_Down move container to workspace $ws12
bindsym $mod_alt+Mod2+Shift+KP_Next move container to workspace $ws13
bindsym $mod_alt+Mod2+Shift+KP_Left move container to workspace $ws14
bindsym $mod_alt+Mod2+Shift+KP_Begin move container to workspace $ws15
bindsym $mod_alt+Mod2+Shift+KP_Right move container to workspace $ws16
bindsym $mod_alt+Mod2+Shift+KP_Home move container to workspace $ws17
bindsym $mod_alt+Mod2+Shift+KP_Up move container to workspace $ws18
bindsym $mod_alt+Mod2+Shift+KP_Prior move container to workspace $ws19
bindsym $mod_alt+Mod2+Shift+KP_Insert move container to workspace $ws20
I have never used the i3bar and I don't know how to config it. BUT if you are using polybar then you NEED to config like this:
[module/i3]
...
ws-icon-0 = "00;X"
ws-icon-1 = "01;I"
ws-icon-2 = "02;II"
ws-icon-3 = "03;III"
ws-icon-4 = "04;IV"
ws-icon-5 = "05;V"
ws-icon-6 = "06;VI"
ws-icon-7 = "07;VII"
ws-icon-8 = "08;VIII"
ws-icon-9 = "09;IX"
notice that if you try to call the WSs like this: ws-icon-1 = "1;I"
it will get in conflict with the ws
number 11
BUG by system start
I noticed that everytime when I started my system my i3 started in the workflow1 ($mod+1
) instead of workflow01($mod+mod2+KP_1
). So I created a mini script in python that solves that problem
config_workflow.py
import pyautogui
p=pyautogui
p.hotkey('win', 'right')
p.hotkey('altleft', 'num1')
p.hotkey('win', 'left')
p.hotkey('win', 'num1')
and of course I start the script every time when my i3 starts (i3 autostart)
I don't know if there is a better way to solve it, BUT this was the only way I found.
bindcode $mod+87
, but leaving$mod
set asMod4
? Orbindsym $mod+KP_End
/KP_Down
, etc. Also check output ofxev
with numlock off for keysyms.