Launching application on fresh boot on bspwm

Hey,

I recently moved to bspwm , my main issue is starting my usual application on every reboot.

I have tried to methods:

  1. Using bspc to just get the latest node and move it to the desktop I want. This went really bad as (as much as I added sleep time to commands) they are unpredictable and it will not follow the order it recieved commands.
  2. Using bspc -a rule running my command then running bspc -r rule to nullify previous rule for that program. This one works a little better but still don’t work well with heavy applications like Brave browser (and anything running on Electron).

Any standard way to do this. I really liking bspwm, specially because I have used sxhkd for a long time for my hotkeys and this allows me have all of them in just one program and file. But I still need this feature.

My question is: Is there a way to lauch my startup setup using bspwm? And if not which WM you recommend to do so. I really like to get in and out of work faster. Just manually setting up windows and their setting is very time consuming and annoying for me.

Thanks for your help in advanced.

I once used this post with some success:

https://new.reddit.com/r/bspwm/comments/ggtwxa/guide_to_creating_startup_layout_using_receptacles/

Check if this helps

I would add the programs you want to your bspwmrc, they will all spawn in the same workspace… unless you want them some of them to be floating, in which case you will have to either do that manually, or make every instance of that program floating with a specific dimensions. OR you can make a keybinding in sxhkd to run apps (one time) with specific dimensions. For example:

{alacritty --hold -e 'echo ""', bspc rule -a \* -o state=floating rectangle=400x800 && alacritty --hold -e echo ""}

makes a terminal echoing “” appear with dimensions 400x800 while floating. This makes a rule that only happens once.

I think all my windows i need are tiled. I also don’t think autolauching it with bspwmrc is an good idea. These are heavy applications (for specs of my machine) and take a while to load. I want an option to cancel the launch if needed. So I put them in my startup script and activate it via sxhkd.

Thanks , it seems to be exactly what I want. unfortunatly I can’t make it work even on single command. Most important for me is to put windows in right desktop not mentioned here. I think it was desktop=^N. I also using kitty instead of termit. --name and --title seems to be option but don’t work

kitty --name works for me, do you have a bar? if not, run xprop and click on the kitty window and look at WM_CLASS, it should say whatever name you used. If you do have a bar, enable the xwindow module in polybar if you have it. desktop='N' should work.

Yeah I figure it out , WM_CLASS is strange , usually it is just name of the program with first letter capital. For kitty it is all lower case for some reason. Thanks

Here’s something I use to offset the time my systray items launch:

xfce4-power-manager &
numlockx on &
(sleep 1s && pasystray) &
dunst &
(sleep 2s && copyq) &
(sleep 2s && flameshot) &

In my case, I don’t actually call the bspc command. These are just lines in my bspwmrc. Not sure if this makes a difference.

Interesting, these are very light programs compared to Chrome. This method works fine for TUI programs for me too.
It is interesting you used () to group them before the launch tho. I thing I test with this too

Seems like this -o or --one-shot flag doesn’t work most of the times and is the most problomatic one.

Looks like there is no --name support for brave nor firefox.

What? I’m not sure what you mean here.

I mean naming apps via using --name don’t work for everyone. For kitty it works but for browsers for example which I want to launch of startup there is not such an option.

I just realised how confusing this whole thread is.

Let’s clarify:

  • Do you want apps to launch automatically when you log into bspwm?
In bspwmrc

(sleep 10s && firefox|xfce4-terminal) & 
# launches firefox and terminal automatically

OR

  • Do you want to manually start a list of apps with a hotkey?
In sxhkdrc

super + m
	{firefox|xfce4-terminal} 
# launches firefox and terminal with a hotkey

If you have browser profiles for firefox, you can use “firefox -P ProfileName”.
It’s a similar syntax in i3wm.

On a side note, since you use xfce-power-manager, do have the same experience with using xset command to manually disable and enable power saving / dpms mode?

I want to automatically launch apps and I know it can be done in bspwmrc or an script to launch them in batch. My problem is that I have multiple terminal and browser sessions and I one each of of them in a specific Workspace. When the application is slow to launch bspwm just dump all of them in the current Workspace. This is my problem.

Sorry for late reply, I was not active here.

You can do it with wmctrl, that’s what I do in Xfce.

For example, go to first workspace, launch Geany editor, set its position, then launch Thunar and set its position :

wmctrl -s 0 

geany &

sleep 1s

wmctrl -r geany -e 0,10,35,980,900

thunar &

sleep 2s

wmctrl -r "gege - Thunar" -e 0,860,35,1040,900

The moving to the workspace works, the positioning doesn’t but it is because I think I am using bspwm and windows are tiled and not floating.
The is doable in bspwm , I have also added a liberal amount for sleep to it to stop it from failing. Maybe wmctrl be less buggy for this purpose. I give it a try on my next boot to see how it works

Thank

Honestly, I don’t actually use the power manager — it’s just part of the config file and I keep it in there.
:person_shrugging:

I thought you are using it. I don’t use it anymore (it is not even in background) but it seems to mess with my power management by changing a config in the system