Re: [dwm] patch to not reparent children to init

2008-11-05 Thread Anselm R Garbe
Well, catching all zombies is a tricky task. AFAIK the SIGCHILD
handler on its own is no reliable solution on all systems. There were
several iterations regarding spawn() during the time, most of them
happened at wmii times and the old double-fork() was the most reliable
and simple solution, which was the reason I chose it and keep it.

Kind regards,
Anselm

2008/11/4 Neale Pickett [EMAIL PROTECTED]:
 Reparenting everything to init with the double-fork is a nightmare on a
 many-user machine, especially when I'm logged in more than once.  pstree
 becomes useless.  This sets up a SIGCHLD handler and only forks once.
 Adds 2 SLOC, but surely there's some reason the double-fork is there that
 I'm just missing...

 void
 sigchld(int signal)
 {
  while (0  waitpid(-1, NULL, WNOHANG));
 }

 void
 spawn(const Arg *arg)
 {
  signal(SIGCHLD, sigchld);
  if (fork() == 0) {
if (dpy) close(ConnectionNumber(dpy));
setsid();
execvp(((char **)arg-v)[0], (char **)arg-v);
fprintf(stderr, dwm: execvp %s, ((char **)arg-v)[0]);
perror( failed);
exit(0);
  }
 }



Re: [dwm] make setlayout toggle

2008-11-05 Thread Anselm R Garbe
2008/11/4 Neale Pickett [EMAIL PROTECTED]:
 yy [EMAIL PROTECTED] writes:

 After a quick look, I think the last check in the first if should be
 arg-v != lt[sellt^1]

 Yes, that's what it should have said.  I wonder how it was working for
 me before, when I sent the code to the list.  [cue twilight zone music]

 Here's what it should have said:

 void
 setlayout(const Arg *arg)
 {
  sellt ^= 1;
  if(arg  arg-v  (arg-v != lt[sellt^1]))
lt[sellt] = (Layout *)arg-v;
  if(sel)
arrange();
  else
drawbar();
 }

Ok, are there any concerns making this upstream again? (Yes I know, we
had this already in earlier versions, by that time it was called
togglelayout())... There were reasons for not toggling, basically it
was confusing to toggle the layout after a long period of time,
because one forgets about what the previous layout was.

Kind regards,
--Anselm



Re: [dwm] make setlayout toggle

2008-11-05 Thread Thayer Williams
On Wed, Nov 5, 2008 at 1:39 AM, Anselm R Garbe [EMAIL PROTECTED] wrote:
 Ok, are there any concerns making this upstream again? (Yes I know, we
 had this already in earlier versions, by that time it was called
 togglelayout())... There were reasons for not toggling, basically it
 was confusing to toggle the layout after a long period of time,
 because one forgets about what the previous layout was.

I would love to see this upstream, but I don't know the history behind
its removal from earlier versions so I'll defer to the long-time
users.



Re: [dwm] make setlayout toggle

2008-11-05 Thread Donald Chai
On Wed, Nov 5, 2008 at 1:39 AM, Anselm R Garbe [EMAIL PROTECTED] wrote:
 Ok, are there any concerns making this upstream again? (Yes I know, we
 had this already in earlier versions, by that time it was called
 togglelayout())... There were reasons for not toggling, basically it
 was confusing to toggle the layout after a long period of time,
 because one forgets about what the previous layout was.

I think the behavior in vanilla dwm sucks less:
   - press MOD+1 to view tag 1
   - press MOD+1 again = no-op
   - press MOD+TAB to view previously selected tag
   - press MOD+m to set monocle layout
   - press MOD+m again = no-op
   - press MOD+space to use previously selected layout

The proposed change would add inconsistency, unless if people want the
second MOD+1 to jump to the previously selected set of tags or do some
other weird thing.

Then again, I only ever switch between two layouts, and only use MOD+space.



Re: [dwm] make setlayout toggle

2008-11-05 Thread Neale Pickett
Donald Chai [EMAIL PROTECTED] writes:

 The proposed change would add inconsistency, unless if people want the
 second MOD+1 to jump to the previously selected set of tags or do some
 other weird thing.

I think that would make more sense if all available layouts were shown
at the top like the tags are.  As it is they're two different beasts.

Having said that, this is such a minor issue that I don't care at all
what the default behavior is.  It's just a 5 line addition to my
config.h and I'm happy to put it on the wiki or whatever.

I'm way more interested in not reparenting child processes to init,
which is getting way less discussion ;)

Neale




Re: [dwm] make setlayout toggle

2008-11-05 Thread Thayer Williams
On Wed, Nov 5, 2008 at 6:39 PM, Neale Pickett [EMAIL PROTECTED] wrote:
 Donald Chai [EMAIL PROTECTED] writes:

 The proposed change would add inconsistency, unless if people want the
 second MOD+1 to jump to the previously selected set of tags or do some
 other weird thing.

 I think that would make more sense if all available layouts were shown
 at the top like the tags are.  As it is they're two different beasts.

I agree, to me it's comparing apples with oranges. Tags are locations
(albeit virtual) and layouts are styles.

 Having said that, this is such a minor issue that I don't care at all
 what the default behavior is.  It's just a 5 line addition to my
 config.h and I'm happy to put it on the wiki or whatever.

Agreed as well, I'm fine with keeping this a separate function in
config.h if the consensus is against it.



Re: [dwm] patch to not reparent children to init

2008-11-05 Thread Donald Chai
On Tue, Nov 4, 2008 at 9:09 AM, Neale Pickett [EMAIL PROTECTED] wrote:
 Reparenting everything to init with the double-fork is a nightmare on a
 many-user machine, especially when I'm logged in more than once.  pstree
 becomes useless.  This sets up a SIGCHLD handler and only forks once.
 Adds 2 SLOC, but surely there's some reason the double-fork is there that
 I'm just missing...

If you quit dwm, what happens to any programs that you've launched?
Are they killed?  What happens if you suddenly decide to manage all
your windows with a different window manager?