Configure dwm to automatically open applications

dwmopensusewindow-manager

I've just got dwm configured to my liking in terms of colors and tags. I'm just looking for one more thing: the ability to have certain applications automatically start with dwm on certain tags.

For example, I have a irc tag, I would like irssi to be run in that tag when I start my machine up. Is this possible? What would it look like in config.h?

Best Answer

dwm is a minimalist window manager that just manages windows. What you are asking requires a bit of a workaround. There are two separate, but related steps.

First, set up your rules for irrsi in config.h - specifying the tag in which you would like it to appear and whether it should be floating or not. Something like this will open irssi in the first tag:

{ NULL, NULL, "irssi",       1 << 0,       False,       -1 },

(explanation of what 1 << 0 means)

If you would like to specify the layout of this tag when dwm opens, you would need to apply the pertag patch and recompile.

The second step is to start the application when you login to X. If you are not using a login manager, you could add an entry to your ~/.xinitrc - something like:

(sleep 5 && xterm -title "irssi" -e irssi ) &

The sleep is to allow X to start and dwm to load: 5 is ample, you can experiment how little you need...

If you are using a login manager, you will have a .desktop file that you can put the commands in.

I prefer a simpler approach using rules and keybinds. So once dwm is open, I just hit, for example, CtrlAltm and mutt opens in tag 3.

You can see my config.h to get a better idea of how this works: https://bitbucket.org/jasonwryan/dwm-patchset/src/tip/base.config.customizations

Related Question