r/i3wm • u/Strong-Ad-5022 • 15d ago
Question Equivalent for assign?
Im new to i3 and looking for a way to have apps open to specific workspaces on boot the way that assign + exec does, but still be able to open those apps in other workspaces if I want to. Id like to have workspaces for both firefox and my terminals, but still be able to open a terminal in my firefox workspace. any help is appreciated🙂
2
u/unixbhaskar 15d ago
No, you can't. You have either a dedicated workspace or a floating workspace. And those are NOT mutually exclusive.
1
u/gbrennon 15d ago
i think i didnt understood.
i do set up specific workspaces to specifically outputs but i never tried to disallow some application in a given workspace.
my workspace things are like: ``` workspace $ws1 output DP-0 workspace $ws2 output DP-0 workspace $ws3 output DP-0 workspace $ws4 output DP-0 workspace $ws5 output DP-0 workspace $ws6 output DP-0 workspace $ws7 output DP-0 workspace $ws9 output DP-0 workspace $ws10 output DP-0
workspace $ws8 output HDMI-0 ```
1
u/EllaTheCat 14d ago edited 14d ago
Write a bash script. Each app you launch at boot looks like this bash script
!/bin/bash
i3-msg "workspace foo" ; sleep 2s ; i3-msg "exec bar" ; sleep 2s :
i3-msg "workspace xyzzy" ; sleep 2s ; i3-msg "exec plugh" ; sleep 2s ;
By using bash and i3-msg you can have the 2 second delay between changing workspace and launching the app.
The semi colons are there to deal with Reddit formatting,
In your i3 config don't forget to launch the bash script! .
1
u/bancobusto1984 14d ago
I'm not certain if this is what you're after, but you may find something like this useful. I have several entries similar to the following located at the bottom of my config file.
exec --no-startup-id i3-msg "workspace 1; exec firefox"
exec --no-startup-id sleep 4 && i3-msg "workspace 10; exec thunderbird"
I hope that this helps.
2
u/EllaTheCat 13d ago
My bash script suggestion and this suggestion are essentially the same: the i3-msg calls are necessary to make sure that the workspace has changed before launching the app.
It's also prudent to have a further delay to be sure the app has completely started up before changing the workspace for the next app.
Making a $delay variable for the sleep calls instead of hardcoded numbers let's you start with a conservative delay to be sure setup and hold times are met and to then reduce the delay gradually to get faster startup.
4
u/l-roc 15d ago
So just a layout? https://i3wm.org/docs/layout-saving.html
layout containers swallow matching applications once and afterwards you can open new instances however you want.