Re: cwm reload support
Hey, dude- > This looks really ugly to me. Save argv[] approach below. That's much nicer. I'm running with your diff here; no regressions. Thanks again! Best, Kent
Re: cwm reload support
On Wed 2012.10.31 at 20:40 +0400, Alexander Polakov wrote: > * Kent R. Spillner [121031 01:20]: > > Howdy- > > > > > > > It seems people do really use that. How about this diff? > > > > > In short: do u_exec("cwm") in conf_reload(). This should probably be > > > > > u_exec(somewhere-argv0-is-saved). > > > > > > > > or use __progname ; also rename from 'reload' to 'restart' > > > > > > I like this approach a lot. Here's an update which also preserves > > > Conf.conf_path and display_name. > > > > void > > -kbfunc_reload(struct client_ctx *cc, union arg *arg) > > +kbfunc_restart(struct client_ctx *cc, union arg *arg) > > { > > - conf_reload(&Conf); > > + char*command, *display_name; > > + size_t command_len; > > + > > + display_name = XDisplayName(NULL); > > + > > + /* Need space for: __progname -c Conf.conf_path -d display_name */ > > + command_len = sizeof(__progname) + 4 + sizeof(Conf.conf_path) + 4 + > > sizeof(display_name) + 1; > > + command = malloc(command_len); > > + > > + snprintf(command, command_len, "%s -c %s -d %s", __progname, > > Conf.conf_path, display_name); > > + u_exec(command); > > } > > This looks really ugly to me. Save argv[] approach below. heh, i have the same diff but with a different name, that's all :)
Re: cwm reload support
* Kent R. Spillner [121031 01:20]: > Howdy- > > > > > It seems people do really use that. How about this diff? > > > > In short: do u_exec("cwm") in conf_reload(). This should probably be > > > > u_exec(somewhere-argv0-is-saved). > > > > > > or use __progname ; also rename from 'reload' to 'restart' > > > > I like this approach a lot. Here's an update which also preserves > > Conf.conf_path and display_name. > > void > -kbfunc_reload(struct client_ctx *cc, union arg *arg) > +kbfunc_restart(struct client_ctx *cc, union arg *arg) > { > - conf_reload(&Conf); > + char*command, *display_name; > + size_t command_len; > + > + display_name = XDisplayName(NULL); > + > + /* Need space for: __progname -c Conf.conf_path -d display_name */ > + command_len = sizeof(__progname) + 4 + sizeof(Conf.conf_path) + 4 + > sizeof(display_name) + 1; > + command = malloc(command_len); > + > + snprintf(command, command_len, "%s -c %s -d %s", __progname, > Conf.conf_path, display_name); > + u_exec(command); > } This looks really ugly to me. Save argv[] approach below. Index: calmwm.c === RCS file: /cvs/xenocara/app/cwm/calmwm.c,v retrieving revision 1.65 diff -u -p -u -r1.65 calmwm.c --- calmwm.c7 Aug 2012 14:05:49 - 1.65 +++ calmwm.c31 Oct 2012 16:38:30 - @@ -34,6 +34,7 @@ #include "calmwm.h" +char **saved_argv; Display*X_Dpy; Cursor Cursor_default; @@ -63,6 +64,7 @@ main(int argc, char **argv) char*display_name = NULL; int ch; + saved_argv = argv; if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) warnx("no locale support"); mbtowc(NULL, NULL, MB_CUR_MAX); Index: calmwm.h === RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.153 diff -u -p -u -r1.153 calmwm.h --- calmwm.h9 Sep 2012 19:47:47 - 1.153 +++ calmwm.h31 Oct 2012 16:38:30 - @@ -397,7 +397,7 @@ void kbfunc_lock(struct client_ctx *, voidkbfunc_menu_search(struct client_ctx *, union arg *); voidkbfunc_moveresize(struct client_ctx *, union arg *); voidkbfunc_quit_wm(struct client_ctx *, union arg *); -voidkbfunc_reload(struct client_ctx *, union arg *); +voidkbfunc_restart(struct client_ctx *, union arg *); voidkbfunc_ssh(struct client_ctx *, union arg *); voidkbfunc_term(struct client_ctx *, union arg *); @@ -431,7 +431,6 @@ void conf_grab(struct conf *, struct voidconf_grab_mouse(struct client_ctx *); voidconf_init(struct conf *); voidconf_mousebind(struct conf *, char *, char *); -voidconf_reload(struct conf *); voidconf_setup(struct conf *, const char *); voidconf_ungrab(struct conf *, struct keybinding *); @@ -449,7 +448,6 @@ void xev_loop(void); voidxu_btn_grab(Window, int, u_int); voidxu_btn_ungrab(Window, int, u_int); voidxu_configure(struct client_ctx *); -voidxu_freecolor(struct screen_ctx *, unsigned long); voidxu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); Index: conf.c === RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.100 diff -u -p -u -r1.100 conf.c --- conf.c 29 Oct 2012 19:46:03 - 1.100 +++ conf.c 31 Oct 2012 16:38:30 - @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen { int i; - for (i = 0; i < CWM_COLOR_MAX; i++) { - xu_freecolor(sc, sc->color[i].pixel); + for (i = 0; i < CWM_COLOR_MAX; i++) sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); - } -} - -void -conf_reload(struct conf *c) -{ - struct screen_ctx *sc; - struct client_ctx *cc; - - if (parse_config(c->conf_path, c) == -1) { - warnx("config file %s has errors, not reloading", c->conf_path); - return; - } - - TAILQ_FOREACH(sc, &Screenq, entry) { - conf_gap(c, sc); - conf_color(c, sc); - conf_font(c, sc); - menu_init(sc); - } - TAILQ_FOREACH(cc, &Clientq, entry) { - conf_client(cc); - /* XXX Does not take hmax/vmax into account. */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZ
Re: cwm reload support
I for one will not. Re-exec is simple enough, why maintain two codepaths when only one is regularly used? ok todd@ Thanks, Penned by Okan Demirmen on 20121029 18:32.16, we have: | will anyone miss reload support? one can always re-exec cwm, or any | other wm for a matter of fact. | | Index: calmwm.h | === | RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v | retrieving revision 1.153 | diff -u -p -r1.153 calmwm.h | --- calmwm.h 9 Sep 2012 19:47:47 - 1.153 | +++ calmwm.h 29 Oct 2012 23:31:45 - | @@ -397,7 +397,6 @@ void kbfunc_lock(struct client_ctx *, | void kbfunc_menu_search(struct client_ctx *, union arg *); | void kbfunc_moveresize(struct client_ctx *, union arg *); | void kbfunc_quit_wm(struct client_ctx *, union arg *); | -void kbfunc_reload(struct client_ctx *, union arg *); | void kbfunc_ssh(struct client_ctx *, union arg *); | void kbfunc_term(struct client_ctx *, union arg *); | | @@ -431,7 +430,6 @@ void conf_grab(struct conf *, struct | void conf_grab_mouse(struct client_ctx *); | void conf_init(struct conf *); | void conf_mousebind(struct conf *, char *, char *); | -void conf_reload(struct conf *); | void conf_setup(struct conf *, const char *); | void conf_ungrab(struct conf *, struct keybinding *); | | @@ -449,7 +447,6 @@ void xev_loop(void); | void xu_btn_grab(Window, int, u_int); | void xu_btn_ungrab(Window, int, u_int); | void xu_configure(struct client_ctx *); | -void xu_freecolor(struct screen_ctx *, unsigned long); | void xu_getatoms(void); | unsigned long xu_getcolor(struct screen_ctx *, char *); | int xu_getprop(Window, Atom, Atom, long, u_char **); | Index: conf.c | === | RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v | retrieving revision 1.100 | diff -u -p -r1.100 conf.c | --- conf.c29 Oct 2012 19:46:03 - 1.100 | +++ conf.c29 Oct 2012 23:31:45 - | @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen | { | int i; | | - for (i = 0; i < CWM_COLOR_MAX; i++) { | - xu_freecolor(sc, sc->color[i].pixel); | + for (i = 0; i < CWM_COLOR_MAX; i++) | sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); | - } | -} | - | -void | -conf_reload(struct conf *c) | -{ | - struct screen_ctx *sc; | - struct client_ctx *cc; | - | - if (parse_config(c->conf_path, c) == -1) { | - warnx("config file %s has errors, not reloading", c->conf_path); | - return; | - } | - | - TAILQ_FOREACH(sc, &Screenq, entry) { | - conf_gap(c, sc); | - conf_color(c, sc); | - conf_font(c, sc); | - menu_init(sc); | - } | - TAILQ_FOREACH(cc, &Clientq, entry) { | - conf_client(cc); | - /* XXX Does not take hmax/vmax into account. */ | - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) | - cc->bwidth = 0; | - client_draw_border(cc); | - } | } | | static struct { | @@ -148,7 +120,6 @@ static struct { | { "CM-equal", "vmaximize" }, | { "CMS-equal", "hmaximize" }, | { "CMS-f", "freeze" }, | - { "CMS-r", "reload" }, | { "CMS-q", "quit" }, | { "M-h","moveleft" }, | { "M-j","movedown" }, | @@ -375,7 +346,6 @@ static struct { | { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, | { "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} }, | { "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} }, | - { "reload", kbfunc_reload, 0, {0} }, | { "quit", kbfunc_quit_wm, 0, {0} }, | { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} }, | { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} }, | Index: cwm.1 | === | RCS file: /home/open/cvs/xenocara/app/cwm/cwm.1,v | retrieving revision 1.47 | diff -u -p -r1.47 cwm.1 | --- cwm.1 9 May 2012 18:37:39 - 1.47 | +++ cwm.1 29 Oct 2012 23:31:45 - | @@ -115,8 +115,6 @@ Spawn | dialog; allows you to switch from | .Nm | to another window manager without restarting the X server. | -.It Ic CMS-r | -Reload configuration. | .It Ic CMS-q | Quit | .Nm . | Index: cwmrc.5 | === | RCS file: /home/open/cvs/xenocara/app/cwm/cwmrc.5,v | retrieving revision 1.44 | diff -u -p -r1.44 cwmrc.5 | --- cwmrc.5 28
Re: cwm reload support
Howdy- > > > It seems people do really use that. How about this diff? > > > In short: do u_exec("cwm") in conf_reload(). This should probably be > > > u_exec(somewhere-argv0-is-saved). > > > > or use __progname ; also rename from 'reload' to 'restart' > > I like this approach a lot. Here's an update which also preserves > Conf.conf_path and display_name. Whoops, here's a better diff. I manually removed some unrelated hunks and forgot to fixup the line numbers. Sorry! :( Best, Kent Index: calmwm.h === RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.153 diff -p -u -r1.153 calmwm.h --- calmwm.h9 Sep 2012 19:47:47 - 1.153 +++ calmwm.h30 Oct 2012 16:42:50 - @@ -397,7 +397,7 @@ void kbfunc_lock(struct client_ctx *, voidkbfunc_menu_search(struct client_ctx *, union arg *); voidkbfunc_moveresize(struct client_ctx *, union arg *); voidkbfunc_quit_wm(struct client_ctx *, union arg *); -voidkbfunc_reload(struct client_ctx *, union arg *); +voidkbfunc_restart(struct client_ctx *, union arg *); voidkbfunc_ssh(struct client_ctx *, union arg *); voidkbfunc_term(struct client_ctx *, union arg *); @@ -431,7 +431,6 @@ void conf_grab(struct conf *, struct voidconf_grab_mouse(struct client_ctx *); voidconf_init(struct conf *); voidconf_mousebind(struct conf *, char *, char *); -voidconf_reload(struct conf *); voidconf_setup(struct conf *, const char *); voidconf_ungrab(struct conf *, struct keybinding *); @@ -449,7 +448,6 @@ void xev_loop(void); voidxu_btn_grab(Window, int, u_int); voidxu_btn_ungrab(Window, int, u_int); voidxu_configure(struct client_ctx *); -voidxu_freecolor(struct screen_ctx *, unsigned long); voidxu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); Index: conf.c === RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.100 diff -p -u -r1.100 conf.c --- conf.c 29 Oct 2012 19:46:03 - 1.100 +++ conf.c 30 Oct 2012 16:42:50 - @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen { int i; - for (i = 0; i < CWM_COLOR_MAX; i++) { - xu_freecolor(sc, sc->color[i].pixel); + for (i = 0; i < CWM_COLOR_MAX; i++) sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); - } -} - -void -conf_reload(struct conf *c) -{ - struct screen_ctx *sc; - struct client_ctx *cc; - - if (parse_config(c->conf_path, c) == -1) { - warnx("config file %s has errors, not reloading", c->conf_path); - return; - } - - TAILQ_FOREACH(sc, &Screenq, entry) { - conf_gap(c, sc); - conf_color(c, sc); - conf_font(c, sc); - menu_init(sc); - } - TAILQ_FOREACH(cc, &Clientq, entry) { - conf_client(cc); - /* XXX Does not take hmax/vmax into account. */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) - cc->bwidth = 0; - client_draw_border(cc); - } } static struct { @@ -148,7 +120,7 @@ static struct { { "CM-equal", "vmaximize" }, { "CMS-equal", "hmaximize" }, { "CMS-f", "freeze" }, - { "CMS-r", "reload" }, + { "CMS-r", "restart" }, { "CMS-q", "quit" }, { "M-h","moveleft" }, { "M-j","movedown" }, @@ -375,7 +347,7 @@ static struct { { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, { "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} }, { "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} }, - { "reload", kbfunc_reload, 0, {0} }, + { "restart", kbfunc_restart, 0, {0} }, { "quit", kbfunc_quit_wm, 0, {0} }, { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} }, { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} }, Index: cwm.1 === RCS file: /cvs/xenocara/app/cwm/cwm.1,v retrieving revision 1.47 diff -p -u -r1.47 cwm.1 --- cwm.1 9 May 2012 18:37:39 - 1.47 +++ cwm.1 30 Oct 2012 16:42:50 - @@ -116,7 +116,8 @@ dialog; allows you to switch from .Nm to another window manager without restarting the X server. .It Ic CMS-r -Reload configuration. +Re
Re: cwm reload support
Hey, dude- > > It seems people do really use that. How about this diff? > > In short: do u_exec("cwm") in conf_reload(). This should probably be > > u_exec(somewhere-argv0-is-saved). > > or use __progname ; also rename from 'reload' to 'restart' I like this approach a lot. Here's an update which also preserves Conf.conf_path and display_name. Best, Kent Index: calmwm.h === RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.153 diff -p -u -r1.153 calmwm.h --- calmwm.h9 Sep 2012 19:47:47 - 1.153 +++ calmwm.h30 Oct 2012 16:42:50 - @@ -397,7 +401,7 @@ void kbfunc_lock(struct client_ctx *, voidkbfunc_menu_search(struct client_ctx *, union arg *); voidkbfunc_moveresize(struct client_ctx *, union arg *); voidkbfunc_quit_wm(struct client_ctx *, union arg *); -voidkbfunc_reload(struct client_ctx *, union arg *); +voidkbfunc_restart(struct client_ctx *, union arg *); voidkbfunc_ssh(struct client_ctx *, union arg *); voidkbfunc_term(struct client_ctx *, union arg *); @@ -431,7 +435,6 @@ void conf_grab(struct conf *, struct voidconf_grab_mouse(struct client_ctx *); voidconf_init(struct conf *); voidconf_mousebind(struct conf *, char *, char *); -voidconf_reload(struct conf *); voidconf_setup(struct conf *, const char *); voidconf_ungrab(struct conf *, struct keybinding *); @@ -449,7 +452,6 @@ void xev_loop(void); voidxu_btn_grab(Window, int, u_int); voidxu_btn_ungrab(Window, int, u_int); voidxu_configure(struct client_ctx *); -voidxu_freecolor(struct screen_ctx *, unsigned long); voidxu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); Index: conf.c === RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.100 diff -p -u -r1.100 conf.c --- conf.c 29 Oct 2012 19:46:03 - 1.100 +++ conf.c 30 Oct 2012 16:42:50 - @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen { int i; - for (i = 0; i < CWM_COLOR_MAX; i++) { - xu_freecolor(sc, sc->color[i].pixel); + for (i = 0; i < CWM_COLOR_MAX; i++) sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); - } -} - -void -conf_reload(struct conf *c) -{ - struct screen_ctx *sc; - struct client_ctx *cc; - - if (parse_config(c->conf_path, c) == -1) { - warnx("config file %s has errors, not reloading", c->conf_path); - return; - } - - TAILQ_FOREACH(sc, &Screenq, entry) { - conf_gap(c, sc); - conf_color(c, sc); - conf_font(c, sc); - menu_init(sc); - } - TAILQ_FOREACH(cc, &Clientq, entry) { - conf_client(cc); - /* XXX Does not take hmax/vmax into account. */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) - cc->bwidth = 0; - client_draw_border(cc); - } } static struct { @@ -148,7 +120,7 @@ static struct { { "CM-equal", "vmaximize" }, { "CMS-equal", "hmaximize" }, { "CMS-f", "freeze" }, - { "CMS-r", "reload" }, + { "CMS-r", "restart" }, { "CMS-q", "quit" }, { "M-h","moveleft" }, { "M-j","movedown" }, @@ -375,7 +347,7 @@ static struct { { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, { "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} }, { "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} }, - { "reload", kbfunc_reload, 0, {0} }, + { "restart", kbfunc_restart, 0, {0} }, { "quit", kbfunc_quit_wm, 0, {0} }, { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} }, { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} }, Index: cwm.1 === RCS file: /cvs/xenocara/app/cwm/cwm.1,v retrieving revision 1.47 diff -p -u -r1.47 cwm.1 --- cwm.1 9 May 2012 18:37:39 - 1.47 +++ cwm.1 30 Oct 2012 16:42:50 - @@ -116,7 +116,8 @@ dialog; allows you to switch from .Nm to another window manager without restarting the X server. .It Ic CMS-r -Reload configuration. +Restart the running +.Xr cwm 1 . .It Ic CMS-q Quit .Nm . Index: cwmrc.5
Re: cwm reload support
2012/10/30 Okan Demirmen : > will anyone miss reload support? one can always re-exec cwm, or any > other wm for a matter of fact. > I use cwm and will not miss reload. -- To our sweethearts and wives. May they never meet. -- 19th century toast
Re: cwm reload support
On Tue 2012.10.30 at 18:27 +0400, Alexander Polakov wrote: > * Alexander Polakov [121030 14:40]: > > * Okan Demirmen [121030 04:10]: > > > will anyone miss reload support? one can always re-exec cwm, or any > > > other wm for a matter of fact. > > > > I don't know the keybinding for it. It's useless :-) > > It seems people do really use that. How about this diff? > In short: do u_exec("cwm") in conf_reload(). This should probably be > u_exec(somewhere-argv0-is-saved). or use __progname ; also rename from 'reload' to 'restart' to answer other questions: yes, reload config support requires a lot more scafolding to do it right, and we don't have it - so it's mostly a hack today and just kinda works ok. the current reload hack gets in the way of other things that seem to be more valuable; reload can come back, but only in a complete formso get rid of what we have to encourage that, if anyone really cares that much :) Index: calmwm.h === RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.153 diff -u -p -r1.153 calmwm.h --- calmwm.h9 Sep 2012 19:47:47 - 1.153 +++ calmwm.h30 Oct 2012 14:56:24 - @@ -397,7 +397,7 @@ void kbfunc_lock(struct client_ctx *, voidkbfunc_menu_search(struct client_ctx *, union arg *); voidkbfunc_moveresize(struct client_ctx *, union arg *); voidkbfunc_quit_wm(struct client_ctx *, union arg *); -voidkbfunc_reload(struct client_ctx *, union arg *); +voidkbfunc_restart(struct client_ctx *, union arg *); voidkbfunc_ssh(struct client_ctx *, union arg *); voidkbfunc_term(struct client_ctx *, union arg *); @@ -431,7 +431,6 @@ void conf_grab(struct conf *, struct voidconf_grab_mouse(struct client_ctx *); voidconf_init(struct conf *); voidconf_mousebind(struct conf *, char *, char *); -voidconf_reload(struct conf *); voidconf_setup(struct conf *, const char *); voidconf_ungrab(struct conf *, struct keybinding *); @@ -449,7 +448,6 @@ void xev_loop(void); voidxu_btn_grab(Window, int, u_int); voidxu_btn_ungrab(Window, int, u_int); voidxu_configure(struct client_ctx *); -voidxu_freecolor(struct screen_ctx *, unsigned long); voidxu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); Index: conf.c === RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.100 diff -u -p -r1.100 conf.c --- conf.c 29 Oct 2012 19:46:03 - 1.100 +++ conf.c 30 Oct 2012 14:56:24 - @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen { int i; - for (i = 0; i < CWM_COLOR_MAX; i++) { - xu_freecolor(sc, sc->color[i].pixel); + for (i = 0; i < CWM_COLOR_MAX; i++) sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); - } -} - -void -conf_reload(struct conf *c) -{ - struct screen_ctx *sc; - struct client_ctx *cc; - - if (parse_config(c->conf_path, c) == -1) { - warnx("config file %s has errors, not reloading", c->conf_path); - return; - } - - TAILQ_FOREACH(sc, &Screenq, entry) { - conf_gap(c, sc); - conf_color(c, sc); - conf_font(c, sc); - menu_init(sc); - } - TAILQ_FOREACH(cc, &Clientq, entry) { - conf_client(cc); - /* XXX Does not take hmax/vmax into account. */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) - cc->bwidth = 0; - client_draw_border(cc); - } } static struct { @@ -148,7 +120,7 @@ static struct { { "CM-equal", "vmaximize" }, { "CMS-equal", "hmaximize" }, { "CMS-f", "freeze" }, - { "CMS-r", "reload" }, + { "CMS-r", "restart" }, { "CMS-q", "quit" }, { "M-h","moveleft" }, { "M-j","movedown" }, @@ -375,7 +347,7 @@ static struct { { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, { "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} }, { "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} }, - { "reload", kbfunc_reload, 0, {0} }, + { "restart", kbfunc_restart, 0, {0} }, { "quit", kbfunc_quit_wm, 0, {0} }, { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} }, { "exec_wm",
Re: cwm reload support
* Alexander Polakov [121030 14:40]: > * Okan Demirmen [121030 04:10]: > > will anyone miss reload support? one can always re-exec cwm, or any > > other wm for a matter of fact. > > I don't know the keybinding for it. It's useless :-) It seems people do really use that. How about this diff? In short: do u_exec("cwm") in conf_reload(). This should probably be u_exec(somewhere-argv0-is-saved). Index: calmwm.h === RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.153 diff -u -p -u -r1.153 calmwm.h --- calmwm.h9 Sep 2012 19:47:47 - 1.153 +++ calmwm.h30 Oct 2012 14:24:13 - @@ -397,7 +397,7 @@ void kbfunc_lock(struct client_ctx *, voidkbfunc_menu_search(struct client_ctx *, union arg *); voidkbfunc_moveresize(struct client_ctx *, union arg *); voidkbfunc_quit_wm(struct client_ctx *, union arg *); -voidkbfunc_reload(struct client_ctx *, union arg *); +voidkbfunc_reload(struct client_ctx *, union arg *); voidkbfunc_ssh(struct client_ctx *, union arg *); voidkbfunc_term(struct client_ctx *, union arg *); @@ -431,7 +431,6 @@ void conf_grab(struct conf *, struct voidconf_grab_mouse(struct client_ctx *); voidconf_init(struct conf *); voidconf_mousebind(struct conf *, char *, char *); -voidconf_reload(struct conf *); voidconf_setup(struct conf *, const char *); voidconf_ungrab(struct conf *, struct keybinding *); @@ -449,7 +448,6 @@ void xev_loop(void); voidxu_btn_grab(Window, int, u_int); voidxu_btn_ungrab(Window, int, u_int); voidxu_configure(struct client_ctx *); -voidxu_freecolor(struct screen_ctx *, unsigned long); voidxu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); Index: conf.c === RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.100 diff -u -p -u -r1.100 conf.c --- conf.c 29 Oct 2012 19:46:03 - 1.100 +++ conf.c 30 Oct 2012 14:24:13 - @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen { int i; - for (i = 0; i < CWM_COLOR_MAX; i++) { - xu_freecolor(sc, sc->color[i].pixel); + for (i = 0; i < CWM_COLOR_MAX; i++) sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); - } -} - -void -conf_reload(struct conf *c) -{ - struct screen_ctx *sc; - struct client_ctx *cc; - - if (parse_config(c->conf_path, c) == -1) { - warnx("config file %s has errors, not reloading", c->conf_path); - return; - } - - TAILQ_FOREACH(sc, &Screenq, entry) { - conf_gap(c, sc); - conf_color(c, sc); - conf_font(c, sc); - menu_init(sc); - } - TAILQ_FOREACH(cc, &Clientq, entry) { - conf_client(cc); - /* XXX Does not take hmax/vmax into account. */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) - cc->bwidth = 0; - client_draw_border(cc); - } } static struct { @@ -148,7 +120,7 @@ static struct { { "CM-equal", "vmaximize" }, { "CMS-equal", "hmaximize" }, { "CMS-f", "freeze" }, - { "CMS-r", "reload" }, + { "CMS-r", "reload" }, { "CMS-q", "quit" }, { "M-h","moveleft" }, { "M-j","movedown" }, Index: cwm.1 === RCS file: /cvs/xenocara/app/cwm/cwm.1,v retrieving revision 1.47 diff -u -p -u -r1.47 cwm.1 --- cwm.1 9 May 2012 18:37:39 - 1.47 +++ cwm.1 30 Oct 2012 14:24:13 - @@ -115,8 +115,6 @@ Spawn dialog; allows you to switch from .Nm to another window manager without restarting the X server. -.It Ic CMS-r -Reload configuration. .It Ic CMS-q Quit .Nm . Index: cwmrc.5 === RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v retrieving revision 1.44 diff -u -p -u -r1.44 cwmrc.5 --- cwmrc.5 28 Oct 2012 20:13:02 - 1.44 +++ cwmrc.5 30 Oct 2012 14:24:13 - @@ -269,8 +269,6 @@ mousebind M-3 window_resize .Ed .Sh BIND COMMAND LIST .Bl -tag -width 18n -compact -.It reload -Reload configuration. .It quit Quit .Xr cwm 1 . Index: font.c === RCS file: /cvs/xenocara/app/cwm/f
Re: cwm reload support
On 2012/10/29 19:32, Okan Demirmen wrote: > will anyone miss reload support? one can always re-exec cwm, or any > other wm for a matter of fact. yes - I use this when I've updated the config file - re-exec would be ok because the window groups etc are memorized between instances, but I'd quite like to have a one-hit way of doing this which can be bound to ctrl+shift+alt+R, rather than having to go through the menu to choose a WM. (actually the only time I use CWM_EXEC_WM is when I'm restarting cwm, and when I do that I've usually already tried ctrl+shift+alt+R to restart and then have to look up what the key combination for EXEC_WM is ;)
Re: cwm reload support
* Okan Demirmen [121030 04:10]: > will anyone miss reload support? one can always re-exec cwm, or any > other wm for a matter of fact. I don't know the keybinding for it. It's useless :-) -- Alexander Polakov | plhk.ru
Re: cwm reload support
On Mon, 29 Oct 2012 19:32:16 -0400 Okan Demirmen wrote: > will anyone miss reload support? one can always re-exec cwm, or any > other wm for a matter of fact. I use this function once in a while but sure, I can always restart cwm. You remove a bit of code here which is more important to me than to be able to reload the configuration. > Index: calmwm.h > === > RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v > retrieving revision 1.153 > diff -u -p -r1.153 calmwm.h > --- calmwm.h 9 Sep 2012 19:47:47 - 1.153 > +++ calmwm.h 29 Oct 2012 23:31:45 - > @@ -397,7 +397,6 @@ void kbfunc_lock(struct client_ctx > *, > void kbfunc_menu_search(struct client_ctx *, union arg *); > void kbfunc_moveresize(struct client_ctx *, union arg *); > void kbfunc_quit_wm(struct client_ctx *, union arg *); > -void kbfunc_reload(struct client_ctx *, union arg *); > void kbfunc_ssh(struct client_ctx *, union arg *); > void kbfunc_term(struct client_ctx *, union arg *); [...]
Re: cwm reload support
Hey, dude- > will anyone miss reload support? one can always re-exec cwm, or any > other wm for a matter of fact. I use it every once in a while, but I won't miss it. Out of curiousity, though, what's the motivation? Too many hacks for handling config changes that should be visible on the screen? Anyways, I'm running with your diff now and haven't encountered any regressions. Thanks again! Best, Kent
Re: cwm reload support
On Mon, Oct 29, 2012 at 07:32:16PM -0400, Okan Demirmen wrote: > will anyone miss reload support? one can always re-exec cwm, or any > other wm for a matter of fact. I use it often, but if there is another way to achieve the same thing, I won't cry over it. > > Index: calmwm.h > === > RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v > retrieving revision 1.153 > diff -u -p -r1.153 calmwm.h > --- calmwm.h 9 Sep 2012 19:47:47 - 1.153 > +++ calmwm.h 29 Oct 2012 23:31:45 - > @@ -397,7 +397,6 @@ void kbfunc_lock(struct client_ctx > *, > void kbfunc_menu_search(struct client_ctx *, union arg *); > void kbfunc_moveresize(struct client_ctx *, union arg *); > void kbfunc_quit_wm(struct client_ctx *, union arg *); > -void kbfunc_reload(struct client_ctx *, union arg *); > void kbfunc_ssh(struct client_ctx *, union arg *); > void kbfunc_term(struct client_ctx *, union arg *); > > @@ -431,7 +430,6 @@ void conf_grab(struct conf *, > struct > void conf_grab_mouse(struct client_ctx *); > void conf_init(struct conf *); > void conf_mousebind(struct conf *, char *, char *); > -void conf_reload(struct conf *); > void conf_setup(struct conf *, const char *); > void conf_ungrab(struct conf *, struct keybinding *); > > @@ -449,7 +447,6 @@ void xev_loop(void); > void xu_btn_grab(Window, int, u_int); > void xu_btn_ungrab(Window, int, u_int); > void xu_configure(struct client_ctx *); > -void xu_freecolor(struct screen_ctx *, unsigned long); > void xu_getatoms(void); > unsigned long xu_getcolor(struct screen_ctx *, char *); > int xu_getprop(Window, Atom, Atom, long, u_char **); > Index: conf.c > === > RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v > retrieving revision 1.100 > diff -u -p -r1.100 conf.c > --- conf.c29 Oct 2012 19:46:03 - 1.100 > +++ conf.c29 Oct 2012 23:31:45 - > @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen > { > int i; > > - for (i = 0; i < CWM_COLOR_MAX; i++) { > - xu_freecolor(sc, sc->color[i].pixel); > + for (i = 0; i < CWM_COLOR_MAX; i++) > sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); > - } > -} > - > -void > -conf_reload(struct conf *c) > -{ > - struct screen_ctx *sc; > - struct client_ctx *cc; > - > - if (parse_config(c->conf_path, c) == -1) { > - warnx("config file %s has errors, not reloading", c->conf_path); > - return; > - } > - > - TAILQ_FOREACH(sc, &Screenq, entry) { > - conf_gap(c, sc); > - conf_color(c, sc); > - conf_font(c, sc); > - menu_init(sc); > - } > - TAILQ_FOREACH(cc, &Clientq, entry) { > - conf_client(cc); > - /* XXX Does not take hmax/vmax into account. */ > - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) > - cc->bwidth = 0; > - client_draw_border(cc); > - } > } > > static struct { > @@ -148,7 +120,6 @@ static struct { > { "CM-equal", "vmaximize" }, > { "CMS-equal", "hmaximize" }, > { "CMS-f", "freeze" }, > - { "CMS-r", "reload" }, > { "CMS-q", "quit" }, > { "M-h","moveleft" }, > { "M-j","movedown" }, > @@ -375,7 +346,6 @@ static struct { > { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, > { "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} }, > { "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} }, > - { "reload", kbfunc_reload, 0, {0} }, > { "quit", kbfunc_quit_wm, 0, {0} }, > { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} }, > { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} }, > Index: cwm.1 > === > RCS file: /home/open/cvs/xenocara/app/cwm/cwm.1,v > retrieving revision 1.47 > diff -u -p -r1.47 cwm.1 > --- cwm.1 9 May 2012 18:37:39 - 1.47 > +++ cwm.1 29 Oct 2012 23:31:45 - > @@ -115,8 +115,6 @@ Spawn > dialog; allows you to switch from > .Nm > to another window manager without restarting the X server. > -.It Ic CMS-r > -Reload configuration. > .It Ic CMS-q > Quit > .Nm . > Index: cwmrc.5 > === > RCS file: /home/open/cvs/xenocara/app/cwm/cwmrc.5,v > retrieving revision 1.44 > diff -u -p -r1.44 cwmrc.5 > --- cwmrc.5 28 Oct 2012 20:13:02 -
cwm reload support
will anyone miss reload support? one can always re-exec cwm, or any other wm for a matter of fact. Index: calmwm.h === RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.153 diff -u -p -r1.153 calmwm.h --- calmwm.h9 Sep 2012 19:47:47 - 1.153 +++ calmwm.h29 Oct 2012 23:31:45 - @@ -397,7 +397,6 @@ void kbfunc_lock(struct client_ctx *, voidkbfunc_menu_search(struct client_ctx *, union arg *); voidkbfunc_moveresize(struct client_ctx *, union arg *); voidkbfunc_quit_wm(struct client_ctx *, union arg *); -voidkbfunc_reload(struct client_ctx *, union arg *); voidkbfunc_ssh(struct client_ctx *, union arg *); voidkbfunc_term(struct client_ctx *, union arg *); @@ -431,7 +430,6 @@ void conf_grab(struct conf *, struct voidconf_grab_mouse(struct client_ctx *); voidconf_init(struct conf *); voidconf_mousebind(struct conf *, char *, char *); -voidconf_reload(struct conf *); voidconf_setup(struct conf *, const char *); voidconf_ungrab(struct conf *, struct keybinding *); @@ -449,7 +447,6 @@ void xev_loop(void); voidxu_btn_grab(Window, int, u_int); voidxu_btn_ungrab(Window, int, u_int); voidxu_configure(struct client_ctx *); -voidxu_freecolor(struct screen_ctx *, unsigned long); voidxu_getatoms(void); unsigned long xu_getcolor(struct screen_ctx *, char *); int xu_getprop(Window, Atom, Atom, long, u_char **); Index: conf.c === RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.100 diff -u -p -r1.100 conf.c --- conf.c 29 Oct 2012 19:46:03 - 1.100 +++ conf.c 29 Oct 2012 23:31:45 - @@ -81,36 +81,8 @@ conf_color(struct conf *c, struct screen { int i; - for (i = 0; i < CWM_COLOR_MAX; i++) { - xu_freecolor(sc, sc->color[i].pixel); + for (i = 0; i < CWM_COLOR_MAX; i++) sc->color[i].pixel = xu_getcolor(sc, c->color[i].name); - } -} - -void -conf_reload(struct conf *c) -{ - struct screen_ctx *sc; - struct client_ctx *cc; - - if (parse_config(c->conf_path, c) == -1) { - warnx("config file %s has errors, not reloading", c->conf_path); - return; - } - - TAILQ_FOREACH(sc, &Screenq, entry) { - conf_gap(c, sc); - conf_color(c, sc); - conf_font(c, sc); - menu_init(sc); - } - TAILQ_FOREACH(cc, &Clientq, entry) { - conf_client(cc); - /* XXX Does not take hmax/vmax into account. */ - if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED) - cc->bwidth = 0; - client_draw_border(cc); - } } static struct { @@ -148,7 +120,6 @@ static struct { { "CM-equal", "vmaximize" }, { "CMS-equal", "hmaximize" }, { "CMS-f", "freeze" }, - { "CMS-r", "reload" }, { "CMS-q", "quit" }, { "M-h","moveleft" }, { "M-j","movedown" }, @@ -375,7 +346,6 @@ static struct { { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, { "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} }, { "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} }, - { "reload", kbfunc_reload, 0, {0} }, { "quit", kbfunc_quit_wm, 0, {0} }, { "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} }, { "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} }, Index: cwm.1 === RCS file: /home/open/cvs/xenocara/app/cwm/cwm.1,v retrieving revision 1.47 diff -u -p -r1.47 cwm.1 --- cwm.1 9 May 2012 18:37:39 - 1.47 +++ cwm.1 29 Oct 2012 23:31:45 - @@ -115,8 +115,6 @@ Spawn dialog; allows you to switch from .Nm to another window manager without restarting the X server. -.It Ic CMS-r -Reload configuration. .It Ic CMS-q Quit .Nm . Index: cwmrc.5 === RCS file: /home/open/cvs/xenocara/app/cwm/cwmrc.5,v retrieving revision 1.44 diff -u -p -r1.44 cwmrc.5 --- cwmrc.5 28 Oct 2012 20:13:02 - 1.44 +++ cwmrc.5 29 Oct 2012 23:31:45 - @@ -269,8 +269,6 @@ mousebind M-3 window_resize .Ed .Sh BIND COMMAND LIST .Bl -tag -width 18n -compact -.It reload -Reload configuration. .It quit Quit .Xr cwm 1 . Index: font.c =