cwm quit()

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

cwm quit()

Gleydson Soares-3
hi,
 
i made a simple function to quit/cwm,
 
there two diffs to the same thing,

yesterday, i discussed with jasper@ and simon@ about that, and further comments
and tests are welcome,

cheers,
gsoares
-> FIRST DIFF <-

Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.16
diff -u -r1.16 kbfunc.c
--- kbfunc.c 23 Mar 2008 15:09:21 -0000 1.16
+++ kbfunc.c 1 Apr 2008 20:27:58 -0000
@@ -485,3 +485,11 @@
 {
  client_vertmaximize(cc);
 }
+
+void
+kbfunc_quit_wm(struct client_ctx *cc, void *arg)
+{
+ int p;
+ p = kill(getpid(),SIGKILL);
+ warn("p");
+}
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.23
diff -u -r1.23 conf.c
--- conf.c 23 Mar 2008 15:09:21 -0000 1.23
+++ conf.c 1 Apr 2008 20:28:21 -0000
@@ -119,6 +119,7 @@
  conf_bindname(c, "M-Left", "prevgroup");
  conf_bindname(c, "CM-f", "maximize");
  conf_bindname(c, "CM-equal", "vmaximize");
+ conf_bindname(c, "CS-Q", "quit");
 
  conf_bindname(c, "M-h", "moveleft");
  conf_bindname(c, "M-j", "movedown");
@@ -260,6 +261,7 @@
  { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
  { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
  { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
+ { "quit", kbfunc_quit_wm, 0, 0 },
  { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
  { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
  { "ssh", kbfunc_ssh, 0, 0 },
Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.26
diff -u -r1.26 calmwm.h
--- calmwm.h 26 Mar 2008 15:45:42 -0000 1.26
+++ calmwm.h 1 Apr 2008 20:28:47 -0000
@@ -451,6 +451,7 @@
 void kbfunc_client_nogroup(struct client_ctx *, void *);
 void kbfunc_client_maximize(struct client_ctx *, void *);
 void kbfunc_client_vmaximize(struct client_ctx *, void *);
+void kbfunc_quit_wm(struct client_ctx *, void *);
 void kbfunc_client_move(struct client_ctx *, void *);
 void kbfunc_client_resize(struct client_ctx *, void *);
 void kbfunc_menu_search(struct client_ctx *, void *);
Index: cwm.1
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.24
diff -u -r1.24 cwm.1
--- cwm.1 23 Mar 2008 15:09:21 -0000 1.24
+++ cwm.1 1 Apr 2008 20:54:20 -0000
@@ -61,6 +61,8 @@
 Spawn a new terminal.
 .It Ic C-M-Delete
 Lock the screen.
+.It Ic C-S-Q
+Quit cwm.
 .It Ic M-Enter
 Hide current window.
 .It Ic M-Down
-> SECOND DIFF <-

Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.16
diff -u -r1.16 kbfunc.c
--- kbfunc.c 23 Mar 2008 15:09:21 -0000 1.16
+++ kbfunc.c 1 Apr 2008 21:34:35 -0000
@@ -254,10 +254,24 @@
 }
 
 void
-kbfunc_lock(struct client_ctx *cc, void *arg)
+kbfunc_lock_quit(struct client_ctx *cc, void *arg)
 {
- conf_reload(&Conf);
- u_spawn(Conf.lockpath);
+ int p;
+ int cmd = (int)arg;
+ switch(cmd) {
+ case CWM_LOCK:
+ conf_reload(&Conf);
+ u_spawn(Conf.lockpath);
+ break;
+ case CWM_QUIT:
+ p = kill(getpid(),SIGKILL);
+ warn("p");
+ break;
+ default:
+ err(1, "kbfunc_lock_quit: invalid cmd %d", cmd);
+ /*NOTREACHED*/
+ }
+
 }
 
 void
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.23
diff -u -r1.23 conf.c
--- conf.c 23 Mar 2008 15:09:21 -0000 1.23
+++ conf.c 1 Apr 2008 21:34:52 -0000
@@ -119,6 +119,7 @@
  conf_bindname(c, "M-Left", "prevgroup");
  conf_bindname(c, "CM-f", "maximize");
  conf_bindname(c, "CM-equal", "vmaximize");
+ conf_bindname(c, "CS-Q", "quit");
 
  conf_bindname(c, "M-h", "moveleft");
  conf_bindname(c, "M-j", "movedown");
@@ -260,11 +261,12 @@
  { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
  { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
  { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
+ { "quit", kbfunc_lock_quit, 0, (void *)CWM_QUIT },
  { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
  { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
  { "ssh", kbfunc_ssh, 0, 0 },
  { "terminal", kbfunc_term, 0, 0 },
- { "lock", kbfunc_lock, 0, 0 },
+ { "lock", kbfunc_lock_quit, 0, (void *)CWM_LOCK },
  { "moveup", kbfunc_client_move, KBFLAG_NEEDCLIENT, (void *)CWM_UP },
  { "movedown", kbfunc_client_move, KBFLAG_NEEDCLIENT, (void *)CWM_DOWN },
  { "moveright", kbfunc_client_move, KBFLAG_NEEDCLIENT, (void *)CWM_RIGHT },
Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.26
diff -u -r1.26 calmwm.h
--- calmwm.h 26 Mar 2008 15:45:42 -0000 1.26
+++ calmwm.h 1 Apr 2008 21:35:15 -0000
@@ -231,6 +231,9 @@
 /* for cwm_exec */
 #define CWM_EXEC_PROGRAM 0x1
 #define CWM_EXEC_WM 0x2
+/* for kbfunc_lock_quit */
+#define CWM_LOCK 0x3
+#define CWM_QUIT 0x4
 
 #define KBFLAG_NEEDCLIENT 0x01
 
@@ -458,7 +461,7 @@
 void kbfunc_ptrmove(struct client_ctx *, void *);
 void kbfunc_ssh(struct client_ctx *, void *);
 void kbfunc_term(struct client_ctx *cc, void *arg);
-void kbfunc_lock(struct client_ctx *cc, void *arg);
+void kbfunc_lock_quit(struct client_ctx *cc, void *arg);
 
 void  search_init(struct screen_ctx *);
 struct menu *search_start(struct menu_q *menuq,
Index: cwm.1
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.24
diff -u -r1.24 cwm.1
--- cwm.1 23 Mar 2008 15:09:21 -0000 1.24
+++ cwm.1 1 Apr 2008 21:35:28 -0000
@@ -61,6 +61,8 @@
 Spawn a new terminal.
 .It Ic C-M-Delete
 Lock the screen.
+.It Ic C-S-Q
+Quit cwm.
 .It Ic M-Enter
 Hide current window.
 .It Ic M-Down

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Owain Ainsworth-2
On Thu, Apr 03, 2008 at 02:57:29PM -0300, Gleydson Soares wrote:
> hi,
>  
> i made a simple function to quit/cwm,
>  
> there two diffs to the same thing,
>
> yesterday, i discussed with jasper@ and simon@ about that, and further comments

Honestly, what's the difference to:

pkill cwm

? Cheers,

-0-
--
Think of it!  With VLSI we can pack 100 ENIACs in 1 sq. cm.!

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Gleydson Soares-3
On Thu, Apr 3, 2008 at 7:22 PM, Owain Ainsworth <[hidden email]> wrote:

> On Thu, Apr 03, 2008 at 02:57:29PM -0300, Gleydson Soares wrote:
>  > hi,
>  >
>  > i made a simple function to quit/cwm,
>  >
>  > there two diffs to the same thing,
>  >
>  > yesterday, i discussed with jasper@ and simon@ about that, and further comments
>
>  Honestly, what's the difference to:
>
>  pkill cwm
>
>  ? Cheers,
>
>  -0-
>  --
>  Think of it!  With VLSI we can pack 100 ENIACs in 1 sq. cm.!
>

perhaps, pkill is a problem when working with Xnest environment

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Gleydson Soares-3
On Thu, Apr 3, 2008 at 8:44 PM, Gleydson Soares <[hidden email]> wrote:

>
> On Thu, Apr 3, 2008 at 7:22 PM, Owain Ainsworth <[hidden email]> wrote:
>  > On Thu, Apr 03, 2008 at 02:57:29PM -0300, Gleydson Soares wrote:
>  >  > hi,
>  >  >
>  >  > i made a simple function to quit/cwm,
>  >  >
>  >  > there two diffs to the same thing,
>  >  >
>  >  > yesterday, i discussed with jasper@ and simon@ about that, and further comments
>  >
>  >  Honestly, what's the difference to:
>  >
>  >  pkill cwm
>  >
>  >  ? Cheers,
>  >
>  >  -0-
>  >  --
>  >  Think of it!  With VLSI we can pack 100 ENIACs in 1 sq. cm.!
>  >
>
>  perhaps, pkill is a problem when working with Xnest environment
>

Owain, Try it following:

$ sudo  Xnest -ac :1
$ export DISPLAY=:1
$ cwm -d :1
$ pgrep cwm
30226
12980
$

if you try "pkill cwm" on cwm -d :1, the cwm on :0 will Terminate,
that is bad if you are running a "make build" for example  ;-)

cheers,
gsoares

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Owain Ainsworth-2
On Thu, Apr 03, 2008 at 08:59:27PM -0300, Gleydson Soares wrote:

> On Thu, Apr 3, 2008 at 8:44 PM, Gleydson Soares <[hidden email]> wrote:
> >
> > On Thu, Apr 3, 2008 at 7:22 PM, Owain Ainsworth <[hidden email]> wrote:
> >  > On Thu, Apr 03, 2008 at 02:57:29PM -0300, Gleydson Soares wrote:
> >  >  > hi,
> >  >  >
> >  >  > i made a simple function to quit/cwm,
> >  >  >
> >  >  > there two diffs to the same thing,
> >  >  >
> >  >  > yesterday, i discussed with jasper@ and simon@ about that, and further comments
> >  >
> >  >  Honestly, what's the difference to:
> >  >
> >  >  pkill cwm
> >  >
> >  >  ? Cheers,
> >  >
> >  >  -0-
> >  >  --
> >  >  Think of it!  With VLSI we can pack 100 ENIACs in 1 sq. cm.!
> >  >
> >
> >  perhaps, pkill is a problem when working with Xnest environment
> >
>
> Owain, Try it following:
>
> $ sudo  Xnest -ac :1
> $ export DISPLAY=:1
> $ cwm -d :1
> $ pgrep cwm
> 30226
> 12980
> $
>
> if you try "pkill cwm" on cwm -d :1, the cwm on :0 will Terminate,
> that is bad if you are running a "make build" for example  ;-)

Point taken.

As to the code:

the second diff (adding a flag to the locking function) is really pretty
ugly. other wise they share no code.

The first one looks alright on a first glance, I dislike the choice of
keybinding though, too easy to hit by accident.

why SIGKILL? why not SIGTERM? kill -9 is always bad manners :)
>
> cheers,
> gsoares

Ta,
-0-
--
There are three ways to get something done: do it yourself, hire
someone, or forbid your kids to do it.

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Gleydson Soares-3
>  The first one looks alright on a first glance, I dislike the choice of
>  keybinding though, too easy to hit by accident.

suggestions ?

>
>  why SIGKILL? why not SIGTERM? kill -9 is always bad manners :)

sure. i'll switch to SIGTERM

cheers,
gsoares

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Simon Bertrang
On Fri, Apr 04, 2008 at 11:45:28AM -0300, Gleydson Soares wrote:
> >  The first one looks alright on a first glance, I dislike the choice of
> >  keybinding though, too easy to hit by accident.
>
> suggestions ?
>

I've bound it to CM-q in my config, maybe that's less accidental to hit.
At least I haven't hit yet - and i'm using screen a lot ;)

> >
> >  why SIGKILL? why not SIGTERM? kill -9 is always bad manners :)
>
> sure. i'll switch to SIGTERM
>

Final diff? :)

Regards,
Simon

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Gleydson Soares-3
In reply to this post by Gleydson Soares-3
On Fri, Apr 4, 2008 at 2:01 PM, Simon Bertrang <[hidden email]> wrote:
>  
>  I've bound it to CM-q in my config, maybe that's less accidental to hit.
>  At least I haven't hit yet - and i'm using screen a lot ;)

CM-q is already used by keybinding "exec_wm()". my suggestion is move the CM-q to CM-p
and to use the CM-q for quit()

>  
>  Final diff? :)
 
below :)
Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.16
diff -u -r1.16 kbfunc.c
--- kbfunc.c 23 Mar 2008 15:09:21 -0000 1.16
+++ kbfunc.c 4 Apr 2008 19:21:30 -0000
@@ -485,3 +485,11 @@
 {
  client_vertmaximize(cc);
 }
+
+void
+kbfunc_quit_wm(struct client_ctx *cc, void *arg)
+{
+ int p;
+ p = kill(getpid(),SIGKILL);
+ warn("p");
+}
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.23
diff -u -r1.23 conf.c
--- conf.c 23 Mar 2008 15:09:21 -0000 1.23
+++ conf.c 4 Apr 2008 19:22:03 -0000
@@ -94,7 +94,7 @@
  conf_bindname(c, "CM-Return", "terminal");
  conf_bindname(c, "CM-Delete", "lock");
  conf_bindname(c, "M-question", "exec");
- conf_bindname(c, "CM-q", "exec_wm");
+ conf_bindname(c, "CM-p", "exec_wm");
  conf_bindname(c, "M-period", "ssh");
  conf_bindname(c, "M-Return", "hide");
  conf_bindname(c, "M-Down", "lower");
@@ -119,6 +119,7 @@
  conf_bindname(c, "M-Left", "prevgroup");
  conf_bindname(c, "CM-f", "maximize");
  conf_bindname(c, "CM-equal", "vmaximize");
+ conf_bindname(c, "CM-q", "quit");
 
  conf_bindname(c, "M-h", "moveleft");
  conf_bindname(c, "M-j", "movedown");
@@ -260,6 +261,7 @@
  { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
  { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
  { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
+ { "quit", kbfunc_quit_wm, 0, 0 },
  { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
  { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
  { "ssh", kbfunc_ssh, 0, 0 },
Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.26
diff -u -r1.26 calmwm.h
--- calmwm.h 26 Mar 2008 15:45:42 -0000 1.26
+++ calmwm.h 4 Apr 2008 19:22:39 -0000
@@ -451,6 +451,7 @@
 void kbfunc_client_nogroup(struct client_ctx *, void *);
 void kbfunc_client_maximize(struct client_ctx *, void *);
 void kbfunc_client_vmaximize(struct client_ctx *, void *);
+void kbfunc_quit_wm(struct client_ctx *, void *);
 void kbfunc_client_move(struct client_ctx *, void *);
 void kbfunc_client_resize(struct client_ctx *, void *);
 void kbfunc_menu_search(struct client_ctx *, void *);
Index: cwm.1
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.24
diff -u -r1.24 cwm.1
--- cwm.1 23 Mar 2008 15:09:21 -0000 1.24
+++ cwm.1 4 Apr 2008 19:24:46 -0000
@@ -61,6 +61,8 @@
 Spawn a new terminal.
 .It Ic C-M-Delete
 Lock the screen.
+.It Ic C-M-q
+Quit cwm.
 .It Ic M-Enter
 Hide current window.
 .It Ic M-Down
@@ -104,7 +106,7 @@
 to provide host auto-completion.
 .Xr ssh 1
 will be executed via the configured terminal emulator.
-.It Ic C-M-q
+.It Ic C-M-p
 Spawn
 .Dq Exec WindowManager
 dialog; allows you to switch from

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Gleydson Soares-3
In reply to this post by Gleydson Soares-3
hi again,

i forgot -> switch SIGKILL to SIGTERM, sorry. diff bellow

cheers,
gsoares
Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.16
diff -u -r1.16 kbfunc.c
--- kbfunc.c 23 Mar 2008 15:09:21 -0000 1.16
+++ kbfunc.c 4 Apr 2008 20:01:26 -0000
@@ -485,3 +485,11 @@
 {
  client_vertmaximize(cc);
 }
+
+void
+kbfunc_quit_wm(struct client_ctx *cc, void *arg)
+{
+ int p;
+ p = kill(getpid(),SIGTERM);
+ warn("p");
+}
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.23
diff -u -r1.23 conf.c
--- conf.c 23 Mar 2008 15:09:21 -0000 1.23
+++ conf.c 4 Apr 2008 20:01:40 -0000
@@ -94,7 +94,7 @@
  conf_bindname(c, "CM-Return", "terminal");
  conf_bindname(c, "CM-Delete", "lock");
  conf_bindname(c, "M-question", "exec");
- conf_bindname(c, "CM-q", "exec_wm");
+ conf_bindname(c, "CM-p", "exec_wm");
  conf_bindname(c, "M-period", "ssh");
  conf_bindname(c, "M-Return", "hide");
  conf_bindname(c, "M-Down", "lower");
@@ -119,6 +119,7 @@
  conf_bindname(c, "M-Left", "prevgroup");
  conf_bindname(c, "CM-f", "maximize");
  conf_bindname(c, "CM-equal", "vmaximize");
+ conf_bindname(c, "CM-q", "quit");
 
  conf_bindname(c, "M-h", "moveleft");
  conf_bindname(c, "M-j", "movedown");
@@ -260,6 +261,7 @@
  { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
  { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
  { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
+ { "quit", kbfunc_quit_wm, 0, 0 },
  { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
  { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
  { "ssh", kbfunc_ssh, 0, 0 },
Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.26
diff -u -r1.26 calmwm.h
--- calmwm.h 26 Mar 2008 15:45:42 -0000 1.26
+++ calmwm.h 4 Apr 2008 20:02:07 -0000
@@ -451,6 +451,7 @@
 void kbfunc_client_nogroup(struct client_ctx *, void *);
 void kbfunc_client_maximize(struct client_ctx *, void *);
 void kbfunc_client_vmaximize(struct client_ctx *, void *);
+void kbfunc_quit_wm(struct client_ctx *, void *);
 void kbfunc_client_move(struct client_ctx *, void *);
 void kbfunc_client_resize(struct client_ctx *, void *);
 void kbfunc_menu_search(struct client_ctx *, void *);
Index: cwm.1
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.24
diff -u -r1.24 cwm.1
--- cwm.1 23 Mar 2008 15:09:21 -0000 1.24
+++ cwm.1 4 Apr 2008 20:02:36 -0000
@@ -61,6 +61,8 @@
 Spawn a new terminal.
 .It Ic C-M-Delete
 Lock the screen.
+.It Ic C-M-q
+Quit cwm.
 .It Ic M-Enter
 Hide current window.
 .It Ic M-Down
@@ -104,7 +106,7 @@
 to provide host auto-completion.
 .Xr ssh 1
 will be executed via the configured terminal emulator.
-.It Ic C-M-q
+.It Ic C-M-p
 Spawn
 .Dq Exec WindowManager
 dialog; allows you to switch from

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Simon Bertrang
On Fri, Apr 04, 2008 at 05:06:48PM -0300, Gleydson Soares wrote:
> hi again,
>
> i forgot -> switch SIGKILL to SIGTERM, sorry. diff bellow
>

Diff is working for me.  As you might have noticed i wasn't aware of the
bind clash.  After spending some more thoughts on this i think CM-w
could be better.  At least a bit closer to the meaning of ``exec_wm''.
C-w is used by various apps to close the currently opened window - add
in a Meta to close the currently running WM, and start a new one.

I'd like to get it in with CM-w.  Any objections, feedback and/or oks
for that?

Kind regards,
Simon

P.S.: BTW, binary growth on amd64:
-r-xr-xr-x  1 simon  simon  71520 Apr  5 17:00 cwm.orig
-r-xr-xr-x  1 simon  simon  71904 Apr  5 18:58 cwm


> Index: kbfunc.c
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
> retrieving revision 1.16
> diff -u -r1.16 kbfunc.c
> --- kbfunc.c 23 Mar 2008 15:09:21 -0000 1.16
> +++ kbfunc.c 4 Apr 2008 20:01:26 -0000
> @@ -485,3 +485,11 @@
>  {
>   client_vertmaximize(cc);
>  }
> +
> +void
> +kbfunc_quit_wm(struct client_ctx *cc, void *arg)
> +{
> + int p;
> + p = kill(getpid(),SIGTERM);
> + warn("p");
> +}
> Index: conf.c
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/conf.c,v
> retrieving revision 1.23
> diff -u -r1.23 conf.c
> --- conf.c 23 Mar 2008 15:09:21 -0000 1.23
> +++ conf.c 4 Apr 2008 20:01:40 -0000
> @@ -94,7 +94,7 @@
>   conf_bindname(c, "CM-Return", "terminal");
>   conf_bindname(c, "CM-Delete", "lock");
>   conf_bindname(c, "M-question", "exec");
> - conf_bindname(c, "CM-q", "exec_wm");
> + conf_bindname(c, "CM-p", "exec_wm");
>   conf_bindname(c, "M-period", "ssh");
>   conf_bindname(c, "M-Return", "hide");
>   conf_bindname(c, "M-Down", "lower");
> @@ -119,6 +119,7 @@
>   conf_bindname(c, "M-Left", "prevgroup");
>   conf_bindname(c, "CM-f", "maximize");
>   conf_bindname(c, "CM-equal", "vmaximize");
> + conf_bindname(c, "CM-q", "quit");
>  
>   conf_bindname(c, "M-h", "moveleft");
>   conf_bindname(c, "M-j", "movedown");
> @@ -260,6 +261,7 @@
>   { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
>   { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
>   { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
> + { "quit", kbfunc_quit_wm, 0, 0 },
>   { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
>   { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
>   { "ssh", kbfunc_ssh, 0, 0 },
> Index: calmwm.h
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
> retrieving revision 1.26
> diff -u -r1.26 calmwm.h
> --- calmwm.h 26 Mar 2008 15:45:42 -0000 1.26
> +++ calmwm.h 4 Apr 2008 20:02:07 -0000
> @@ -451,6 +451,7 @@
>  void kbfunc_client_nogroup(struct client_ctx *, void *);
>  void kbfunc_client_maximize(struct client_ctx *, void *);
>  void kbfunc_client_vmaximize(struct client_ctx *, void *);
> +void kbfunc_quit_wm(struct client_ctx *, void *);
>  void kbfunc_client_move(struct client_ctx *, void *);
>  void kbfunc_client_resize(struct client_ctx *, void *);
>  void kbfunc_menu_search(struct client_ctx *, void *);
> Index: cwm.1
> ===================================================================
> RCS file: /cvs/xenocara/app/cwm/cwm.1,v
> retrieving revision 1.24
> diff -u -r1.24 cwm.1
> --- cwm.1 23 Mar 2008 15:09:21 -0000 1.24
> +++ cwm.1 4 Apr 2008 20:02:36 -0000
> @@ -61,6 +61,8 @@
>  Spawn a new terminal.
>  .It Ic C-M-Delete
>  Lock the screen.
> +.It Ic C-M-q
> +Quit cwm.
>  .It Ic M-Enter
>  Hide current window.
>  .It Ic M-Down
> @@ -104,7 +106,7 @@
>  to provide host auto-completion.
>  .Xr ssh 1
>  will be executed via the configured terminal emulator.
> -.It Ic C-M-q
> +.It Ic C-M-p
>  Spawn
>  .Dq Exec WindowManager
>  dialog; allows you to switch from

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Simon Bertrang
On Sat, Apr 05, 2008 at 07:03:43PM +0200, Simon Bertrang wrote:

> On Fri, Apr 04, 2008 at 05:06:48PM -0300, Gleydson Soares wrote:
> > hi again,
> >
> > i forgot -> switch SIGKILL to SIGTERM, sorry. diff bellow
> >
>
> Diff is working for me.  As you might have noticed i wasn't aware of the
> bind clash.  After spending some more thoughts on this i think CM-w
> could be better.  At least a bit closer to the meaning of ``exec_wm''.
> C-w is used by various apps to close the currently opened window - add
> in a Meta to close the currently running WM, and start a new one.
>
> I'd like to get it in with CM-w.  Any objections, feedback and/or oks
> for that?
>
> Kind regards,
> Simon
>
> P.S.: BTW, binary growth on amd64:
> -r-xr-xr-x  1 simon  simon  71520 Apr  5 17:00 cwm.orig
> -r-xr-xr-x  1 simon  simon  71904 Apr  5 18:58 cwm

With some feedback from okan@, a new diff that quits by changing the
for (;;) in xev_loop() to while (_xev_quit == 0) and sets _xev_quit
via kbfunc_quit_wm accordingly.

No killing anymore and a smaller binary
  -r-xr-xr-x  1 simon  simon  71808 Apr  7 23:35 cwm

Comments or other feedback?

Regards,
Simon


Index: calmwm.h
===================================================================
RCS file: /cvs/xenocara/app/cwm/calmwm.h,v
retrieving revision 1.26
diff -u -p -r1.26 calmwm.h
--- calmwm.h 26 Mar 2008 15:45:42 -0000 1.26
+++ calmwm.h 7 Apr 2008 21:43:22 -0000
@@ -451,6 +451,7 @@ void kbfunc_client_prevgroup(struct clie
 void kbfunc_client_nogroup(struct client_ctx *, void *);
 void kbfunc_client_maximize(struct client_ctx *, void *);
 void kbfunc_client_vmaximize(struct client_ctx *, void *);
+void kbfunc_quit_wm(struct client_ctx *, void *);
 void kbfunc_client_move(struct client_ctx *, void *);
 void kbfunc_client_resize(struct client_ctx *, void *);
 void kbfunc_menu_search(struct client_ctx *, void *);
Index: conf.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/conf.c,v
retrieving revision 1.23
diff -u -p -r1.23 conf.c
--- conf.c 23 Mar 2008 15:09:21 -0000 1.23
+++ conf.c 7 Apr 2008 21:43:22 -0000
@@ -94,7 +94,7 @@ conf_init(struct conf *c)
  conf_bindname(c, "CM-Return", "terminal");
  conf_bindname(c, "CM-Delete", "lock");
  conf_bindname(c, "M-question", "exec");
- conf_bindname(c, "CM-q", "exec_wm");
+ conf_bindname(c, "CM-w", "exec_wm");
  conf_bindname(c, "M-period", "ssh");
  conf_bindname(c, "M-Return", "hide");
  conf_bindname(c, "M-Down", "lower");
@@ -119,6 +119,7 @@ conf_init(struct conf *c)
  conf_bindname(c, "M-Left", "prevgroup");
  conf_bindname(c, "CM-f", "maximize");
  conf_bindname(c, "CM-equal", "vmaximize");
+ conf_bindname(c, "CM-q", "quit");
 
  conf_bindname(c, "M-h", "moveleft");
  conf_bindname(c, "M-j", "movedown");
@@ -260,6 +261,7 @@ struct {
  { "prevgroup", kbfunc_client_prevgroup, 0, 0 },
  { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, 0 },
  { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, 0 },
+ { "quit", kbfunc_quit_wm, 0, 0 },
  { "exec", kbfunc_exec, 0, (void *)CWM_EXEC_PROGRAM },
  { "exec_wm", kbfunc_exec, 0, (void *)CWM_EXEC_WM },
  { "ssh", kbfunc_ssh, 0, 0 },
Index: cwm.1
===================================================================
RCS file: /cvs/xenocara/app/cwm/cwm.1,v
retrieving revision 1.24
diff -u -p -r1.24 cwm.1
--- cwm.1 23 Mar 2008 15:09:21 -0000 1.24
+++ cwm.1 7 Apr 2008 21:43:23 -0000
@@ -61,6 +61,8 @@ their functionality is described in more
 Spawn a new terminal.
 .It Ic C-M-Delete
 Lock the screen.
+.It Ic C-M-q
+Quit cwm.
 .It Ic M-Enter
 Hide current window.
 .It Ic M-Down
@@ -104,7 +106,7 @@ This parses
 to provide host auto-completion.
 .Xr ssh 1
 will be executed via the configured terminal emulator.
-.It Ic C-M-q
+.It Ic C-M-w
 Spawn
 .Dq Exec WindowManager
 dialog; allows you to switch from
Index: kbfunc.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v
retrieving revision 1.17
diff -u -p -r1.17 kbfunc.c
--- kbfunc.c 5 Apr 2008 21:09:19 -0000 1.17
+++ kbfunc.c 7 Apr 2008 21:43:23 -0000
@@ -27,6 +27,8 @@
 #define HASH_MARKER "|1|"
 #define MOVE_AMOUNT 1
 
+extern int _xev_quit;
+
 void
 kbfunc_client_lower(struct client_ctx *cc, void *arg)
 {
@@ -487,4 +489,10 @@ void
 kbfunc_client_vmaximize(struct client_ctx *cc, void *arg)
 {
  client_vertmaximize(cc);
+}
+
+void
+kbfunc_quit_wm(struct client_ctx *cc, void *arg)
+{
+ _xev_quit = 1;
 }
Index: xevents.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/xevents.c,v
retrieving revision 1.8
diff -u -p -r1.8 xevents.c
--- xevents.c 23 Mar 2008 15:09:21 -0000 1.8
+++ xevents.c 7 Apr 2008 21:43:23 -0000
@@ -451,6 +451,7 @@ out:
 
 static struct xevent_q _xevq, _xevq_putaway;
 static short _xev_q_lock = 0;
+int _xev_quit = 0;
 
 void
 xev_init(void)
@@ -524,7 +525,7 @@ xev_loop(void)
  XEvent e;
  struct xevent *xev, *nextxev;
 
- for (;;) {
+ while (_xev_quit == 0) {
 #ifdef DIAGNOSTIC
  if (TAILQ_EMPTY(&_xevq))
  errx(1, "X event queue empty");

Reply | Threaded
Open this post in threaded view
|

Re: cwm quit()

Gleydson Soares-3
>  With some feedback from okan@, a new diff that quits by changing the
>  for (;;) in xev_loop() to while (_xev_quit == 0) and sets _xev_quit
>  via kbfunc_quit_wm accordingly.
>
>  No killing anymore and a smaller binary
>   -r-xr-xr-x  1 simon  simon  71808 Apr  7 23:35 cwm
>
>  Comments or other feedback?
>

  hi,
  Okan, awesome way to quit, ;-)


  thanks a lot simon and Oga, by comments and feedback,