2008/4/26 Jules Villard <[EMAIL PROTECTED]>: > Hi all, > > This patch adds the ability to perform user-defined actions on > startup. In particular, you can launch some applications like a bunch > of terms, a browser, you name it... or select a specific tag. I found > a need for it because I always perform the same actions when I start > X :) As the patch is very small --it only adds a structure and a > small loop in dwm.c, amounting to 9 lines of code-- I'm (perhaps > boldly) hoping that you might find it interesting too and consider it > for inclusion. > > For my personal use, I have something similar to the following snippet > of code in config.h: > > -8<------------------------------------------------------------------- > > /* tagging */ > const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "#", "zik", "www" }; > > Rule rules[] = { > /* class instance title tags ref > isfloating */ > { "Firefox", NULL, NULL, tags[6], False > }, > { "rxvt", NULL, "ncmpc", tags[5], False > }, > { "rxvt", NULL, "alsamixer", tags[5], False > }, > { "rxvt", NULL, "start", tags[0], False > }, > { "rxvt", NULL, "sudo", tags[4], False > }, > }; > > /* actions to be performed on startup */ > Start start[] = { > /* function argument */ > { spawn, "exec rxvt -e mutt" }, /* tagged "1" */ > { spawn, "exec rxvt -e screen irssi" }, /* same */ > > { spawn, "exec rxvt -e alsamixer" }, /* tagged "zik" */ > { spawn, "exec rxvt -e sudo su -" }, /* tagged "#" */ > { spawn, "exec firefox" }, /* tagged "www" */ > > /* tagged "zik" and zoomed */ > { spawn, "exec rxvt -e ncmpc" }, > /* tagged "1" and zoomed */ > { spawn, "exec rxvt -ls -title start" }, > /* now select tag 4 to type my password */ > { view, tags[4]}, > }; > > -8<------------------------------------------------------------------- > > This allows me to start my session with 3 terms tagged "1": mutt and > irssi are stacked on the right-hand side and an empty term is readied > on the left-hand side. Timing is important, so the last term is > spawned some time after the first two to be the last term indeed and > get the zoom. Likewise, some applications are launched between the > alsamixer and the ncmpc instances, so that the latter ends up getting > the zoom. Moreover, since I like to start seeing tag 4, which > corresponds to my sudo'd term --otherwise I tend to forget to type my > password-- I force the tagging of the third term I want with tag "1" > by assigning that term a special title (rxvt -title start) which I add > to the rules. This term might otherwise end up being spawned with > tag 4. > > I think this really is a corner case and that you might not need to > be bothered with such a level of details, e.g. if you do not mind > having to re-tag some windows by hand. I think my main point is that > basic usage --for instance launching two terms, a browser and ncmpc at > startup-- is very intuitive and that you can achieve more complex ones > without heroic efforts, the other point being that the patch ended up > being ridiculously simple. > > > Thanks for reading this long email, -p1 patch against 4.9 follows. > Cheers, > > Jules > >
I see your point, but IMHO .xinitrc is a better place to start applications on startup. About tags, for me it would be better a boolean visibleonstartup variable in the tag definition, but I don't find too uncomfortable having to toggle 1 or 2 tag when I start the computer. OTOH your patch is clean and easy to understand. greets, -- - yiyus || JGL .