How can I start applications on specific workspaces in i3 when it starts?
Why is this not working in my config file? :
workspace 1; exec firefox; workspace 2; exec chromium; workspace 1
According to the Arch Wiki i3 page, to autostart an application on a specific workspace, you use
exec --no-startup-id i3-msg 'workspace 1:Web; exec /usr/bin/firefox'
# This is what I use in ie config # custom variables for workspaces set $ws1 "1< txt >" set $ws2 "2> fm " set $ws3 "3< Web >" set $ws4 4 set $ws5 5 set $ws6 6 set $ws7 7 set $ws8 8 set $ws9 9 ##==================================================## # *** Workspace specific settings *** # ##=================================================## # Assign Workspaces: assign [class="Firefox"] $ws3 assign [class="Chromium"] $ws3 assign [class="Google-chrome-beta"] $ws3 assign [class="^Geany"] $ws1
It's an autostart on workspace launch only, not an autostart when i3 starts but I thought it could be useful.
For example, to launch my web browser in the named second workspace "web" this is what I did in my config :
bindsym $mod+2 workspace 2:web; layout tabbed; exec [ $(ps h -C vimb | wc -l) = 0 ] && /usr/bin/vimb -s
When I hit key 2, my web browser starts but when it's already opened it didn't relaunch it, it just switch to the web workspace.
Note: the layout part can be annoying sometime, it's not a requirement.
For more details see my conf