Configure dwm to automatically open applications

9,174

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

Share:
9,174

Related videos on Youtube

n0pe
Author by

n0pe

Updated on September 18, 2022

Comments

  • n0pe
    n0pe over 1 year

    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?

  • n0pe
    n0pe over 12 years
    I remember seeing a pic of a desktop you had ing dwm/tmux. It was really nice (this was a couple months back, I think I emailed you about it). Small world :) Thanks for the link to your dotfile, I'll take a look.
  • jasonwryan
    jasonwryan over 12 years
    No problem: have fun with dwm.
  • Devon
    Devon almost 5 years
    Are you sure it’s .desktop and not .xprofile?