Re: [dwm] xprop patch
Hello, It is now useless to close stdin: --- orig/dwm.c 2008-12-13 18:05:32.0 +0100 +++ dwm/dwm.c 2008-12-13 18:09:16.0 +0100 @@ -343,7 +343,6 @@ Arg a = {.ui = ~0}; Layout foo = { , NULL }; - close(STDIN_FILENO); view(a); lt[sellt] = foo; while(stack) Regards Fred
Re: [dwm] xprop patch
Anselm R Garbe dixit (2008-12-09, 19:44): If you consider that Neale's patch makes it upstream, what do you think about: while true do dwm done in .xinitrc to restart dwm? How do I exit back to xdm cleanly then? -- [a]
Re: [dwm] xprop patch
2008/12/9 Anselm R Garbe [EMAIL PROTECTED]: 2008/12/9 Neale Pickett [EMAIL PROTECTED]: I very much like this patch. I realized right away that I would never again need to restart dwm when I work on my status script. When it dies, I can just start it up again without restarting DWM. Someone could even have multiple programs running to update the status text. It removes the need for the readin variable: you either set the property or you don't. I dislike X properties, however I like your patch a lot and consider it making mainstream, since it simplifies dwm a lot and fixes a lot of issues. dwm depends on X anyways, so for the status text mechanism to happen, it's the simpler method. This would be 40 if the property were hard coded to XA_WM_NAME. I left in a comment to use a property named DWM_STATUS instead of XA_WM_NAME, so people could play with it easily, but I think XA_WM_NAME is ultimately the right way to do it. XA_WM_NAME is the way to go. I have the same opinion. Now that I see the patch it looks so clear that I also vote for its inclusion in main. I was completely wrong about this, my apologies to Mr.Pickett ;) -- - yiyus || JGL .
Re: [dwm] xprop patch
On Tue, Dec 09, 2008 at 10:41:35AM -0700, Neale Pickett wrote: I very much like this patch. I realized right away that I would never again need to restart dwm when I work on my status script. When it dies, I can just start it up again without restarting DWM. Someone could even have multiple programs running to update the status text. It removes the need for the readin variable: you either set the property or you don't. The patch removes 39 SLOC: gotta admit Neale has 2 points :) i like the idea of not having to restart dwm when hacking on the status script conversely, when hacking on dwm itself, i like being able to restart dwm without restarting my x session, yet i want the session to exit when dwm exits, ie. dwm xterm in .xsession is not what i want. here is a respawn patch. it is most useful in conjunction with a local install in the makefile, copying the newly built dwm binary over the currently running one, inside my $HOME rather than in /usr/local the patch costs 5 loc in the source + 1 loc in config.h the patch is not completely portable due to use of ``environ''. i hope that even the BSDs have that nowadays, but probably not through defining _GNU_SOURCE, which is glibc specific. cheers -- Benoit Triquet benoit.triquet at gmail.com .''`. : :' : We are debian.org. Lower your prices, surrender your code. `. `' We will add your hardware and software distinctiveness to `-our own. Resistance is futile. diff -ruN orig/dwm-5.3.1/config.def.h dwm-5.3.1/config.def.h --- orig/dwm-5.3.1/config.def.h 2008-12-06 10:33:03.0 +0100 +++ dwm-5.3.1/config.def.h 2008-12-09 20:12:45.0 +0100 @@ -80,7 +80,8 @@ TAGKEYS(XK_7, 6) TAGKEYS(XK_8, 7) TAGKEYS(XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_q, quit, {.i = 0 } }, + { MODKEY|ShiftMask|ControlMask, XK_q, quit, {.i = 1 } }, }; /* button definitions */ diff -ruN orig/dwm-5.3.1/dwm.c dwm-5.3.1/dwm.c --- orig/dwm-5.3.1/dwm.c 2008-12-06 10:33:03.0 +0100 +++ dwm-5.3.1/dwm.c 2008-12-08 20:33:16.0 +0100 @@ -23,6 +23,7 @@ * * To understand everything else, start reading main(). */ +#define _GNU_SOURCE #include errno.h #include locale.h #include stdarg.h @@ -238,6 +240,7 @@ static DC dc; static Layout *lt[] = { NULL, NULL }; static Window root, barwin; +static char **args; /* configuration, allows nested code to access above variables */ #include config.h @@ -1026,6 +1032,8 @@ void quit(const Arg *arg) { + if(arg-i) /* restart dwm, if fails just fall through and exit */ + execve(args[0], args, environ); readin = running = False; } @@ -1733,6 +1741,7 @@ if(!(dpy = XOpenDisplay(0))) die(dwm: cannot open display\n); + args = argv; checkotherwm(); setup(); scan();
Re: [dwm] xprop patch
2008/12/9 Benoit T [EMAIL PROTECTED]: On Tue, Dec 09, 2008 at 10:41:35AM -0700, Neale Pickett wrote: I very much like this patch. I realized right away that I would never again need to restart dwm when I work on my status script. When it dies, I can just start it up again without restarting DWM. Someone could even have multiple programs running to update the status text. It removes the need for the readin variable: you either set the property or you don't. The patch removes 39 SLOC: gotta admit Neale has 2 points :) i like the idea of not having to restart dwm when hacking on the status script conversely, when hacking on dwm itself, i like being able to restart dwm without restarting my x session, yet i want the session to exit when dwm exits, ie. dwm xterm in .xsession is not what i want. here is a respawn patch. it is most useful in conjunction with a local install in the makefile, copying the newly built dwm binary over the currently running one, inside my $HOME rather than in /usr/local the patch costs 5 loc in the source + 1 loc in config.h the patch is not completely portable due to use of ``environ''. i hope that even the BSDs have that nowadays, but probably not through defining _GNU_SOURCE, which is glibc specific. If you consider that Neale's patch makes it upstream, what do you think about: while true do dwm done in .xinitrc to restart dwm? Kind regards, --Anselm
Re: [dwm] xprop patch
On Tue, Dec 09, 2008 at 07:44:21PM +, Anselm R Garbe wrote: 2008/12/9 Benoit T [EMAIL PROTECTED]: conversely, when hacking on dwm itself, i like being able to restart dwm without restarting my x session, yet i want the session to exit when dwm exits, ie. dwm xterm in .xsession is not what i want. If you consider that Neale's patch makes it upstream, what do you think about: while true do dwm done in .xinitrc to restart dwm? One of my requirements above was that quitting dwm should quit the X session. Here you would have to kill .xsession. This can certainly be done by killing dwm's parent in quit() but then the behavior when dwm is launched from an xterm would be counter-intuitive! Also, I initially had the requirement of being able to exec dwm at the end of .xsession (and have a restart function). But you don't do that with dwm reading from stdin, so no way to save one shell process. With Neale's patch I can finally fulfill that requirement :) One might point out that we still want one shell process for the status script, and that shell could be the one interpreting .xsession and thus we do not need exec'ing dwm in the first place. I know of 2 reasons why we still want a separate process for the status script: - I can't think of a way to update the status script if it is sourced by .xsession rather than forked. - the status script might break (after all I am hacking it :) and if sourced by .xsession could prevent the entire X session from starting up. Speaking of a separate process, people should probably check the status from xsetroot and exit when the X connection closes, to make it more robust in case they detach the status script from the parent X process. cheers -- Benoit Triquet benoit.triquet at gmail.com .''`. : :' : We are debian.org. Lower your prices, surrender your code. `. `' We will add your hardware and software distinctiveness to `-our own. Resistance is futile.
Re: [dwm] xprop patch
You can do while true do dwm || exit done This way when you kill dwm correctly (with modkey+shift+q as default) it respawns, but if you kill it any other way, the Xsession finishes. You could even add a key binding that does killall dwm or something of the sort for when you want to end the Xsession. -Evan On Tue, Dec 9, 2008 at 3:44 PM, Benoit T [EMAIL PROTECTED] wrote: On Tue, Dec 09, 2008 at 07:44:21PM +, Anselm R Garbe wrote: 2008/12/9 Benoit T [EMAIL PROTECTED]: conversely, when hacking on dwm itself, i like being able to restart dwm without restarting my x session, yet i want the session to exit when dwm exits, ie. dwm xterm in .xsession is not what i want. If you consider that Neale's patch makes it upstream, what do you think about: while true do dwm done in .xinitrc to restart dwm? One of my requirements above was that quitting dwm should quit the X session. Here you would have to kill .xsession. This can certainly be done by killing dwm's parent in quit() but then the behavior when dwm is launched from an xterm would be counter-intuitive! Also, I initially had the requirement of being able to exec dwm at the end of .xsession (and have a restart function). But you don't do that with dwm reading from stdin, so no way to save one shell process. With Neale's patch I can finally fulfill that requirement :) One might point out that we still want one shell process for the status script, and that shell could be the one interpreting .xsession and thus we do not need exec'ing dwm in the first place. I know of 2 reasons why we still want a separate process for the status script: - I can't think of a way to update the status script if it is sourced by .xsession rather than forked. - the status script might break (after all I am hacking it :) and if sourced by .xsession could prevent the entire X session from starting up. Speaking of a separate process, people should probably check the status from xsetroot and exit when the X connection closes, to make it more robust in case they detach the status script from the parent X process. cheers -- Benoit Triquet benoit.triquet at gmail.com .''`. : :' : We are debian.org. Lower your prices, surrender your code. `. `' We will add your hardware and software distinctiveness to `-our own. Resistance is futile.
Re: [dwm] xprop patch
2008/12/9 Neale Pickett [EMAIL PROTECTED]: I very much like this patch. I realized right away that I would never again need to restart dwm when I work on my status script. When it dies, I can just start it up again without restarting DWM. Someone could even have multiple programs running to update the status text. It removes the need for the readin variable: you either set the property or you don't. I dislike X properties, however I like your patch a lot and consider it making mainstream, since it simplifies dwm a lot and fixes a lot of issues. dwm depends on X anyways, so for the status text mechanism to happen, it's the simpler method. This would be 40 if the property were hard coded to XA_WM_NAME. I left in a comment to use a property named DWM_STATUS instead of XA_WM_NAME, so people could play with it easily, but I think XA_WM_NAME is ultimately the right way to do it. XA_WM_NAME is the way to go. Kind regards, --Anselm
Re: [dwm] xprop patch
Or even simpler =) while dwm do sleep 1 done - Jeremy On Tue 09 Dec 2008 - 04:26PM, Evan Gates wrote: You can do while true do dwm || exit done This way when you kill dwm correctly (with modkey+shift+q as default) it respawns, but if you kill it any other way, the Xsession finishes. You could even add a key binding that does killall dwm or something of the sort for when you want to end the Xsession. -Evan On Tue, Dec 9, 2008 at 3:44 PM, Benoit T [EMAIL PROTECTED] wrote: On Tue, Dec 09, 2008 at 07:44:21PM +, Anselm R Garbe wrote: 2008/12/9 Benoit T [EMAIL PROTECTED]: conversely, when hacking on dwm itself, i like being able to restart dwm without restarting my x session, yet i want the session to exit when dwm exits, ie. dwm xterm in .xsession is not what i want. If you consider that Neale's patch makes it upstream, what do you think about: while true do dwm done in .xinitrc to restart dwm? One of my requirements above was that quitting dwm should quit the X session. Here you would have to kill .xsession. This can certainly be done by killing dwm's parent in quit() but then the behavior when dwm is launched from an xterm would be counter-intuitive! Also, I initially had the requirement of being able to exec dwm at the end of .xsession (and have a restart function). But you don't do that with dwm reading from stdin, so no way to save one shell process. With Neale's patch I can finally fulfill that requirement :) One might point out that we still want one shell process for the status script, and that shell could be the one interpreting .xsession and thus we do not need exec'ing dwm in the first place. I know of 2 reasons why we still want a separate process for the status script: - I can't think of a way to update the status script if it is sourced by .xsession rather than forked. - the status script might break (after all I am hacking it :) and if sourced by .xsession could prevent the entire X session from starting up. Speaking of a separate process, people should probably check the status from xsetroot and exit when the X connection closes, to make it more robust in case they detach the status script from the parent X process. cheers -- Benoit Triquet benoit.triquet at gmail.com .''`. : :' : We are debian.org. Lower your prices, surrender your code. `. `' We will add your hardware and software distinctiveness to `-our own. Resistance is futile.