Re: PATCH: cwm move window to {top,bottom}{left,right} corners
On Mon, Dec 4, 2017 at 3:27 PM, Julien Steinhauser wrote: > > Okan Demirmen wrote: > > > A rough cut (no manpage bits yet) would be something like the below; it > > allows one to "snap" to any edge or corner. > > Tested and approved, thanks. > See a proposal for cwmrc.5 below. > I don't have idea for default keybindings so I didn't touch cwm.1 No default bindings - kept it simple. Fixed up the cwmrc(5) bits and committed. Thanks everyone.
Re: PATCH: cwm move window to {top,bottom}{left,right} corners
Okan Demirmen wrote: > A rough cut (no manpage bits yet) would be something like the below; it > allows one to "snap" to any edge or corner. Tested and approved, thanks. See a proposal for cwmrc.5 below. I don't have idea for default keybindings so I didn't touch cwm.1 > Incidentally, I dislike we used up/down/left/right from the beginning, > not sure of the trouble changing to all to cardinal directions or not... Well, it depends on how much you dislike it … It would break everyone's ~/.cwmrc all of a sudden. Index: cwmrc.5 === RCS file: /cvs/xenocara/app/cwm/cwmrc.5,v retrieving revision 1.68 diff -u -p -r1.68 cwmrc.5 --- cwmrc.5 6 Jul 2017 17:09:17 - 1.68 +++ cwmrc.5 4 Dec 2017 20:08:50 - @@ -334,6 +334,8 @@ Other windows in its group share remaini Move current window. .It window-resize Resize current window. +.It window-snap +Snap current window to edge or corner of the screen .It window-move-up Move window .Ar moveamount @@ -398,6 +400,22 @@ pixels right. Resize window 10 times .Ar moveamount pixels left. +.It window-snap-up +Snap window to top edge +.It window-snap-down +Snap window to bottom edge +.It window-snap-right +Snap window to right edge +.It window-snap-left +Snap window to left edge +.It window-snap-up-right +Snap window to top-right corner +.It window-snap-up-left +Snap window to top-left corner +.It window-snap-down-right +Snap window to bottom-right corner +.It window-snap-down-left +Snap window to bottom-left corner .It pointer-move-up Move pointer .Ar moveamount
Re: PATCH: cwm move window to {top,bottom}{left,right} corners
On Thu, Nov 30, 2017 at 09:09:40PM +0100, Thuban wrote: > This feature sounds very useful to me. This feature was in original calmwm and was very useful for me too. > > * Julien Steinhauser le [22-11-2017 21:27:34 +0100]: > > A long time ago sent Dimitris Papastamos a patch to misc which > > let one send X clients to corners.[0] > > > > I think it is useful so thank you Dimitris! > > With some minor editing it still builds on current. > > > > I have no use of window-move-{up,down,right,left}{,-big} but X client > > corner warping is done on a regular basis. > > > > At the time it did not receive the attention it (IMO) deserves. > > Maybe was it because "feature" was written on the first line? ;) > > I know featuritis is considered a disease around here and > > I'm happy it is but here is an updated version anyway. > > > > This version lacks the keybindings from the initial patch, > > it also lacks for now a change in the man pages. > > I use it with the following in ~/.cwmrc: > > > > bind-key 4S-Leftwindow-movebottomleft > > bind-key 4S-Right window-movebottomright > > bind-key 4S-XF86Backwindow-movetopleft > > bind-key 4S-XF86Forward window-movetopright > > > > I know these are not standards keys found on every keyboard, > > but Thinkpads are not exotic beasts in this land so it might > > be an helpful start to some of you and every declinaison of h j k l > > was already in use in the default config. > > > > OK? > > > > [0] https://marc.info/?l=openbsd-misc&m=140344759017419&w=2 > > > > Index: calmwm.h > > === > > RCS file: /cvs/xenocara/app/cwm/calmwm.h,v > > retrieving revision 1.341 > > diff -u -p -r1.341 calmwm.h > > --- calmwm.h14 Jul 2017 17:23:38 - 1.341 > > +++ calmwm.h22 Nov 2017 19:21:47 - > > @@ -54,6 +54,10 @@ > > #define CWM_DOWN 0x0002 > > #define CWM_LEFT 0x0004 > > #define CWM_RIGHT 0x0008 > > +#define CWM_TOP_LEFT0x0100 > > +#define CWM_BOTTOM_LEFT 0x0200 > > +#define CWM_TOP_RIGHT 0x0400 > > +#define CWM_BOTTOM_RIGHT 0x0800 > > #define CWM_BIGAMOUNT 0x0010 > > #define DIRECTIONMASK (CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT) > > > > @@ -476,6 +480,7 @@ void > > kbfunc_client_toggle_hmaximize(v > > voidkbfunc_client_toggle_vmaximize(void *, struct > > cargs *); > > voidkbfunc_client_htile(void *, struct cargs *); > > voidkbfunc_client_vtile(void *, struct cargs *); > > +voidkbfunc_client_move_edge(void *, struct cargs > > *); > > voidkbfunc_client_cycle(void *, struct cargs *); > > voidkbfunc_client_toggle_group(void *, struct > > cargs *); > > voidkbfunc_client_movetogroup(void *, struct cargs > > *); > > Index: conf.c > > === > > RCS file: /cvs/xenocara/app/cwm/conf.c,v > > retrieving revision 1.233 > > diff -u -p -r1.233 conf.c > > --- conf.c 14 Jul 2017 17:23:38 - 1.233 > > +++ conf.c 22 Nov 2017 19:21:48 - > > @@ -67,6 +67,14 @@ static const struct { > > { "window-delete", kbfunc_client_delete, CWM_CONTEXT_CC, 0 }, > > { "window-htile", kbfunc_client_htile, CWM_CONTEXT_CC, 0 }, > > { "window-vtile", kbfunc_client_vtile, CWM_CONTEXT_CC, 0 }, > > + { "window-movetopleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, > > + (CWM_TOP_LEFT) }, > > + { "window-movebottomleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, > > + (CWM_BOTTOM_LEFT) }, > > + { "window-movetopright", kbfunc_client_move_edge, CWM_CONTEXT_CC, > > + (CWM_TOP_RIGHT) }, > > + { "window-movebottomright", kbfunc_client_move_edge, CWM_CONTEXT_CC, > > + (CWM_BOTTOM_RIGHT) }, > > { "window-stick", kbfunc_client_toggle_sticky, CWM_CONTEXT_CC, 0 }, > > { "window-fullscreen", kbfunc_client_toggle_fullscreen, CWM_CONTEXT_CC, > > 0 }, > > { "window-maximize", kbfunc_client_toggle_maximize, CWM_CONTEXT_CC, 0 }, > > @@ -666,6 +674,51 @@ conf_grab_mouse(Window win) > > BUTTONMASK, GrabModeAsync, GrabModeSync, > > None, None); > > } > > + } > > +} > > + > > +void > > +kbfunc_client_move_edge(void *ctx, struct cargs *cargs) > > +{ > > + struct client_ctx *cc = ctx; > > + struct screen_ctx *sc = cc->sc; > > + struct geom xine; > > + int flags; > > + > > + /* > > +* pick screen that the middle of the window is on. > > +* that's probably more fair than if just the origin of > > +* a window is poking over a boundary > > +*/ > > + xine = screen_area(sc, > > + cc->geom.x + cc->geom.w / 2, > > + cc->geom.y + cc->geom.h / 2, CWM_
Re: PATCH: cwm move window to {top,bottom}{left,right} corners
On Thu 2017.11.30 at 13:41 -0500, Okan Demirmen wrote: > Hi, > > On Wed, Nov 22, 2017 at 3:27 PM, Julien Steinhauser wrote: > > > A long time ago sent Dimitris Papastamos a patch to misc which > > let one send X clients to corners.[0] > > > > I think it is useful so thank you Dimitris! > > With some minor editing it still builds on current. > > > > I have no use of window-move-{up,down,right,left}{,-big} but X client > > corner warping is done on a regular basis. > > > > At the time it did not receive the attention it (IMO) deserves. > > Maybe was it because "feature" was written on the first line? ;) > > I know featuritis is considered a disease around here and > > I'm happy it is but here is an updated version anyway. > > ?? > > > > > ???I'm not opposed to this completely...I would in fact consider implementing > this on-top of the snapping we already have allow snap'ing to an edge, > regardless if one wants to snap to one or two edges. > ??? A rough cut (no manpage bits yet) would be something like the below; it allows one to "snap" to any edge or corner. Incidentally, I dislike we used up/down/left/right from the beginning, not sure of the trouble changing to all to cardinal directions or not... Index: calmwm.h === RCS file: /home/open/cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.341 diff -u -p -r1.341 calmwm.h --- calmwm.h14 Jul 2017 17:23:38 - 1.341 +++ calmwm.h30 Nov 2017 20:58:32 - @@ -461,6 +461,7 @@ void screen_assert_clients_within(str voidkbfunc_cwm_status(void *, struct cargs *); voidkbfunc_ptrmove(void *, struct cargs *); +voidkbfunc_client_snap(void *, struct cargs *); voidkbfunc_client_move(void *, struct cargs *); voidkbfunc_client_resize(void *, struct cargs *); voidkbfunc_client_delete(void *, struct cargs *); Index: conf.c === RCS file: /home/open/cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.233 diff -u -p -r1.233 conf.c --- conf.c 14 Jul 2017 17:23:38 - 1.233 +++ conf.c 30 Nov 2017 20:58:17 - @@ -92,6 +92,24 @@ static const struct { { "window-movetogroup-8", kbfunc_client_movetogroup, CWM_CONTEXT_CC, 8 }, { "window-movetogroup-9", kbfunc_client_movetogroup, CWM_CONTEXT_CC, 9 }, + { "window-snap-up", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_UP) }, + { "window-snap-down", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_DOWN) }, + { "window-snap-left", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_LEFT) }, + { "window-snap-right", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_RIGHT) }, + + { "window-snap-up-right", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_UP|CWM_RIGHT) }, + { "window-snap-up-left", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_UP|CWM_LEFT) }, + { "window-snap-down-right", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_DOWN|CWM_RIGHT) }, + { "window-snap-down-left", kbfunc_client_snap, CWM_CONTEXT_CC, + (CWM_DOWN|CWM_LEFT) }, + { "window-move", kbfunc_client_move, CWM_CONTEXT_CC, 0 }, { "window-move-up", kbfunc_client_move, CWM_CONTEXT_CC, (CWM_UP) }, Index: kbfunc.c === RCS file: /home/open/cvs/xenocara/app/cwm/kbfunc.c,v retrieving revision 1.149 diff -u -p -r1.149 kbfunc.c --- kbfunc.c14 Jul 2017 18:01:46 - 1.149 +++ kbfunc.c30 Nov 2017 21:01:12 - @@ -287,6 +287,42 @@ kbfunc_client_resize_mb(void *ctx, struc } void +kbfunc_client_snap(void *ctx, struct cargs *cargs) +{ + struct client_ctx *cc = ctx; + struct screen_ctx *sc = cc->sc; + struct geom area; + int flags; + + area = screen_area(sc, + cc->geom.x + cc->geom.w / 2, + cc->geom.y + cc->geom.h / 2, CWM_GAP); + + flags = cargs->flag; + while (flags) { + if (flags & CWM_UP) { + cc->geom.y = area.y; + flags &= ~CWM_UP; + } + if (flags & CWM_LEFT) { + cc->geom.x = area.x; + flags &= ~CWM_LEFT; + } + if (flags & CWM_RIGHT) { + cc->geom.x = area.x + area.w - cc->geom.w - + (cc->bwidth * 2); + flags &= ~CWM_RIGHT; + } + if (flags & CWM_DOWN) { + cc->geom.y = area.y + area.h - cc->geom.h - + (cc->bwidth * 2); + flags &= ~CWM_DOWN; + } + } + client_move(cc); +} + +void kbfunc_client_
Re: PATCH: cwm move window to {top,bottom}{left,right} corners
This feature sounds very useful to me. * Julien Steinhauser le [22-11-2017 21:27:34 +0100]: > A long time ago sent Dimitris Papastamos a patch to misc which > let one send X clients to corners.[0] > > I think it is useful so thank you Dimitris! > With some minor editing it still builds on current. > > I have no use of window-move-{up,down,right,left}{,-big} but X client > corner warping is done on a regular basis. > > At the time it did not receive the attention it (IMO) deserves. > Maybe was it because "feature" was written on the first line? ;) > I know featuritis is considered a disease around here and > I'm happy it is but here is an updated version anyway. > > This version lacks the keybindings from the initial patch, > it also lacks for now a change in the man pages. > I use it with the following in ~/.cwmrc: > > bind-key 4S-Left window-movebottomleft > bind-key 4S-Right window-movebottomright > bind-key 4S-XF86Back window-movetopleft > bind-key 4S-XF86Forward window-movetopright > > I know these are not standards keys found on every keyboard, > but Thinkpads are not exotic beasts in this land so it might > be an helpful start to some of you and every declinaison of h j k l > was already in use in the default config. > > OK? > > [0] https://marc.info/?l=openbsd-misc&m=140344759017419&w=2 > > Index: calmwm.h > === > RCS file: /cvs/xenocara/app/cwm/calmwm.h,v > retrieving revision 1.341 > diff -u -p -r1.341 calmwm.h > --- calmwm.h 14 Jul 2017 17:23:38 - 1.341 > +++ calmwm.h 22 Nov 2017 19:21:47 - > @@ -54,6 +54,10 @@ > #define CWM_DOWN 0x0002 > #define CWM_LEFT 0x0004 > #define CWM_RIGHT0x0008 > +#define CWM_TOP_LEFT0x0100 > +#define CWM_BOTTOM_LEFT 0x0200 > +#define CWM_TOP_RIGHT0x0400 > +#define CWM_BOTTOM_RIGHT 0x0800 > #define CWM_BIGAMOUNT0x0010 > #define DIRECTIONMASK(CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT) > > @@ -476,6 +480,7 @@ void > kbfunc_client_toggle_hmaximize(v > void kbfunc_client_toggle_vmaximize(void *, struct cargs *); > void kbfunc_client_htile(void *, struct cargs *); > void kbfunc_client_vtile(void *, struct cargs *); > +void kbfunc_client_move_edge(void *, struct cargs *); > void kbfunc_client_cycle(void *, struct cargs *); > void kbfunc_client_toggle_group(void *, struct cargs *); > void kbfunc_client_movetogroup(void *, struct cargs *); > Index: conf.c > === > RCS file: /cvs/xenocara/app/cwm/conf.c,v > retrieving revision 1.233 > diff -u -p -r1.233 conf.c > --- conf.c14 Jul 2017 17:23:38 - 1.233 > +++ conf.c22 Nov 2017 19:21:48 - > @@ -67,6 +67,14 @@ static const struct { > { "window-delete", kbfunc_client_delete, CWM_CONTEXT_CC, 0 }, > { "window-htile", kbfunc_client_htile, CWM_CONTEXT_CC, 0 }, > { "window-vtile", kbfunc_client_vtile, CWM_CONTEXT_CC, 0 }, > + { "window-movetopleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, > + (CWM_TOP_LEFT) }, > + { "window-movebottomleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, > + (CWM_BOTTOM_LEFT) }, > + { "window-movetopright", kbfunc_client_move_edge, CWM_CONTEXT_CC, > + (CWM_TOP_RIGHT) }, > + { "window-movebottomright", kbfunc_client_move_edge, CWM_CONTEXT_CC, > + (CWM_BOTTOM_RIGHT) }, > { "window-stick", kbfunc_client_toggle_sticky, CWM_CONTEXT_CC, 0 }, > { "window-fullscreen", kbfunc_client_toggle_fullscreen, CWM_CONTEXT_CC, > 0 }, > { "window-maximize", kbfunc_client_toggle_maximize, CWM_CONTEXT_CC, 0 }, > @@ -666,6 +674,51 @@ conf_grab_mouse(Window win) > BUTTONMASK, GrabModeAsync, GrabModeSync, > None, None); > } > + } > +} > + > +void > +kbfunc_client_move_edge(void *ctx, struct cargs *cargs) > +{ > + struct client_ctx *cc = ctx; > + struct screen_ctx *sc = cc->sc; > + struct geom xine; > + int flags; > + > + /* > + * pick screen that the middle of the window is on. > + * that's probably more fair than if just the origin of > + * a window is poking over a boundary > + */ > + xine = screen_area(sc, > + cc->geom.x + cc->geom.w / 2, > + cc->geom.y + cc->geom.h / 2, CWM_GAP); > + > + flags = cargs->flag; > + > + switch (flags) { > + case CWM_TOP_LEFT: > + cc->geom.x = xine.x; > + cc->geom.y = xine.y; > + client_move(cc); > + break; > + case CWM_BOTTOM_LEFT: > + cc->geom.x = xine.x; > + cc->g
Re: PATCH: cwm move window to {top,bottom}{left,right} corners
Hi, On Wed, Nov 22, 2017 at 3:27 PM, Julien Steinhauser wrote: > A long time ago sent Dimitris Papastamos a patch to misc which > let one send X clients to corners.[0] > > I think it is useful so thank you Dimitris! > With some minor editing it still builds on current. > > I have no use of window-move-{up,down,right,left}{,-big} but X client > corner warping is done on a regular basis. > > At the time it did not receive the attention it (IMO) deserves. > Maybe was it because "feature" was written on the first line? ;) > I know featuritis is considered a disease around here and > I'm happy it is but here is an updated version anyway. > > > I'm not opposed to this completely...I would in fact consider implementing this on-top of the snapping we already have allow snap'ing to an edge, regardless if one wants to snap to one or two edges. > This version lacks the keybindings from the initial patch, > it also lacks for now a change in the man pages. > I use it with the following in ~/.cwmrc: > > bind-key 4S-Leftwindow-movebottomleft > bind-key 4S-Right window-movebottomright > bind-key 4S-XF86Backwindow-movetopleft > bind-key 4S-XF86Forward window-movetopright > > I know these are not standards keys found on every keyboard, > but Thinkpads are not exotic beasts in this land so it might > be an helpful start to some of you and every declinaison of h j k l > was already in use in the default config. > > OK? > > [0] https://marc.info/?l=openbsd-misc&m=140344759017419&w=2 > > Index: calmwm.h > === > RCS file: /cvs/xenocara/app/cwm/calmwm.h,v > retrieving revision 1.341 > diff -u -p -r1.341 calmwm.h > --- calmwm.h14 Jul 2017 17:23:38 - 1.341 > +++ calmwm.h22 Nov 2017 19:21:47 - > @@ -54,6 +54,10 @@ > #define CWM_DOWN 0x0002 > #define CWM_LEFT 0x0004 > #define CWM_RIGHT 0x0008 > +#define CWM_TOP_LEFT0x0100 > +#define CWM_BOTTOM_LEFT 0x0200 > +#define CWM_TOP_RIGHT 0x0400 > +#define CWM_BOTTOM_RIGHT 0x0800 > #define CWM_BIGAMOUNT 0x0010 > #define DIRECTIONMASK (CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT) > > @@ -476,6 +480,7 @@ void kbfunc_client_toggle_ > hmaximize(v > voidkbfunc_client_toggle_vmaximize(void *, struct > cargs *); > voidkbfunc_client_htile(void *, struct cargs *); > voidkbfunc_client_vtile(void *, struct cargs *); > +voidkbfunc_client_move_edge(void *, struct cargs *); > voidkbfunc_client_cycle(void *, struct cargs *); > voidkbfunc_client_toggle_group(void *, struct cargs > *); > voidkbfunc_client_movetogroup(void *, struct cargs *); > Index: conf.c > === > RCS file: /cvs/xenocara/app/cwm/conf.c,v > retrieving revision 1.233 > diff -u -p -r1.233 conf.c > --- conf.c 14 Jul 2017 17:23:38 - 1.233 > +++ conf.c 22 Nov 2017 19:21:48 - > @@ -67,6 +67,14 @@ static const struct { > { "window-delete", kbfunc_client_delete, CWM_CONTEXT_CC, 0 }, > { "window-htile", kbfunc_client_htile, CWM_CONTEXT_CC, 0 }, > { "window-vtile", kbfunc_client_vtile, CWM_CONTEXT_CC, 0 }, > + { "window-movetopleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, > + (CWM_TOP_LEFT) }, > + { "window-movebottomleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, > + (CWM_BOTTOM_LEFT) }, > + { "window-movetopright", kbfunc_client_move_edge, CWM_CONTEXT_CC, > + (CWM_TOP_RIGHT) }, > + { "window-movebottomright", kbfunc_client_move_edge, > CWM_CONTEXT_CC, > + (CWM_BOTTOM_RIGHT) }, > { "window-stick", kbfunc_client_toggle_sticky, CWM_CONTEXT_CC, 0 }, > { "window-fullscreen", kbfunc_client_toggle_fullscreen, > CWM_CONTEXT_CC, 0 }, > { "window-maximize", kbfunc_client_toggle_maximize, > CWM_CONTEXT_CC, 0 }, > @@ -666,6 +674,51 @@ conf_grab_mouse(Window win) > BUTTONMASK, GrabModeAsync, GrabModeSync, > None, None); > } > + } > +} > + > +void > +kbfunc_client_move_edge(void *ctx, struct cargs *cargs) > +{ > + struct client_ctx *cc = ctx; > + struct screen_ctx *sc = cc->sc; > + struct geom xine; > + int flags; > + > + /* > +* pick screen that the middle of the window is on. > +* that's probably more fair than if just the origin of > +* a window is poking over a boundary > +*/ > + xine = screen_area(sc, > + cc->geom.x + cc->geom.w / 2, > + cc->geom.y + cc->geom.h / 2, CWM_GAP); > + > + flags = cargs->flag; > + > + switch (flags) { > + c
Re: PATCH: cwm move window to {top,bottom}{left,right} corners
A long time ago sent Dimitris Papastamos a patch to misc which let one send X clients to corners.[0] I think it is useful so thank you Dimitris! With some minor editing it still builds on current. I have no use of window-move-{up,down,right,left}{,-big} but X client corner warping is done on a regular basis. At the time it did not receive the attention it (IMO) deserves. Maybe was it because "feature" was written on the first line? ;) I know featuritis is considered a disease around here and I'm happy it is but here is an updated version anyway. This version lacks the keybindings from the initial patch, it also lacks for now a change in the man pages. I use it with the following in ~/.cwmrc: bind-key 4S-Leftwindow-movebottomleft bind-key 4S-Right window-movebottomright bind-key 4S-XF86Backwindow-movetopleft bind-key 4S-XF86Forward window-movetopright I know these are not standards keys found on every keyboard, but Thinkpads are not exotic beasts in this land so it might be an helpful start to some of you and every declinaison of h j k l was already in use in the default config. OK? [0] https://marc.info/?l=openbsd-misc&m=140344759017419&w=2 Index: calmwm.h === RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.341 diff -u -p -r1.341 calmwm.h --- calmwm.h14 Jul 2017 17:23:38 - 1.341 +++ calmwm.h22 Nov 2017 19:21:47 - @@ -54,6 +54,10 @@ #define CWM_DOWN 0x0002 #define CWM_LEFT 0x0004 #define CWM_RIGHT 0x0008 +#define CWM_TOP_LEFT0x0100 +#define CWM_BOTTOM_LEFT 0x0200 +#define CWM_TOP_RIGHT 0x0400 +#define CWM_BOTTOM_RIGHT 0x0800 #define CWM_BIGAMOUNT 0x0010 #define DIRECTIONMASK (CWM_UP | CWM_DOWN | CWM_LEFT | CWM_RIGHT) @@ -476,6 +480,7 @@ void kbfunc_client_toggle_hmaximize(v voidkbfunc_client_toggle_vmaximize(void *, struct cargs *); voidkbfunc_client_htile(void *, struct cargs *); voidkbfunc_client_vtile(void *, struct cargs *); +voidkbfunc_client_move_edge(void *, struct cargs *); voidkbfunc_client_cycle(void *, struct cargs *); voidkbfunc_client_toggle_group(void *, struct cargs *); voidkbfunc_client_movetogroup(void *, struct cargs *); Index: conf.c === RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.233 diff -u -p -r1.233 conf.c --- conf.c 14 Jul 2017 17:23:38 - 1.233 +++ conf.c 22 Nov 2017 19:21:48 - @@ -67,6 +67,14 @@ static const struct { { "window-delete", kbfunc_client_delete, CWM_CONTEXT_CC, 0 }, { "window-htile", kbfunc_client_htile, CWM_CONTEXT_CC, 0 }, { "window-vtile", kbfunc_client_vtile, CWM_CONTEXT_CC, 0 }, + { "window-movetopleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, + (CWM_TOP_LEFT) }, + { "window-movebottomleft", kbfunc_client_move_edge, CWM_CONTEXT_CC, + (CWM_BOTTOM_LEFT) }, + { "window-movetopright", kbfunc_client_move_edge, CWM_CONTEXT_CC, + (CWM_TOP_RIGHT) }, + { "window-movebottomright", kbfunc_client_move_edge, CWM_CONTEXT_CC, + (CWM_BOTTOM_RIGHT) }, { "window-stick", kbfunc_client_toggle_sticky, CWM_CONTEXT_CC, 0 }, { "window-fullscreen", kbfunc_client_toggle_fullscreen, CWM_CONTEXT_CC, 0 }, { "window-maximize", kbfunc_client_toggle_maximize, CWM_CONTEXT_CC, 0 }, @@ -666,6 +674,51 @@ conf_grab_mouse(Window win) BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); } + } +} + +void +kbfunc_client_move_edge(void *ctx, struct cargs *cargs) +{ + struct client_ctx *cc = ctx; + struct screen_ctx *sc = cc->sc; + struct geom xine; + int flags; + + /* +* pick screen that the middle of the window is on. +* that's probably more fair than if just the origin of +* a window is poking over a boundary +*/ + xine = screen_area(sc, + cc->geom.x + cc->geom.w / 2, + cc->geom.y + cc->geom.h / 2, CWM_GAP); + + flags = cargs->flag; + + switch (flags) { + case CWM_TOP_LEFT: +cc->geom.x = xine.x; +cc->geom.y = xine.y; +client_move(cc); +break; + case CWM_BOTTOM_LEFT: +cc->geom.x = xine.x; +cc->geom.y = xine.y + xine.h - cc->geom.h - cc->bwidth * 2; +client_move(cc); +break; + case CWM_TOP_RIGHT: +cc->geom.x = xine.x + xine.w - cc->geom.w - cc->bwidth * 2; +cc->geom.y = xi
PATCH: cwm move window to {top,bottom}{left,right} corners
Hi everyone, This is my first attempt at hacking cwm. This feature allows one to move the current window to the corners of the screen. IIRC, evilwm used to have this feature. Not sure if it is upstream material though. I am also not so sure about the default keybinds, let me know if you have any ideas. === RCS file: /cvs/xenocara/app/cwm/calmwm.h,v retrieving revision 1.259 diff -u -p -r1.259 calmwm.h --- calmwm.h8 Feb 2014 02:49:30 - 1.259 +++ calmwm.h22 Jun 2014 14:27:26 - @@ -60,6 +60,10 @@ #define CWM_DOWN 0x0020 #define CWM_LEFT 0x0040 #define CWM_RIGHT 0x0080 +#define CWM_TOP_LEFT 0x0100 +#define CWM_BOTTOM_LEFT0x0200 +#define CWM_TOP_RIGHT 0x0400 +#define CWM_BOTTOM_RIGHT 0x0800 /* exec */ #defineCWM_EXEC_PROGRAM0x0001 @@ -478,7 +482,8 @@ void kbfunc_menu_cmd(struct client_ct voidkbfunc_ssh(struct client_ctx *, union arg *); voidkbfunc_term(struct client_ctx *, union arg *); voidkbfunc_tile(struct client_ctx *, union arg *); - +voidkbfunc_client_move_edge(struct client_ctx *, +union arg *); voidmousefunc_client_grouptoggle(struct client_ctx *, union arg *); voidmousefunc_client_move(struct client_ctx *, Index: conf.c === RCS file: /cvs/xenocara/app/cwm/conf.c,v retrieving revision 1.173 diff -u -p -r1.173 conf.c --- conf.c 21 Apr 2014 12:52:14 - 1.173 +++ conf.c 22 Jun 2014 14:27:26 - @@ -233,6 +233,10 @@ static const struct { { "CS-Down","bigptrmovedown" }, { "CS-Up", "bigptrmoveup" }, { "CS-Right", "bigptrmoveright" }, + { "CM-t", "movetopleft" }, + { "CM-v", "movebottomleft" }, + { "CM-y", "movetopright" }, + { "CM-b", "movebottomright" }, }, mouse_binds[] = { { "1", "menu_unhide" }, @@ -453,6 +457,14 @@ static const struct { {.i = (CWM_RIGHT|CWM_PTRMOVE|CWM_BIGMOVE)} }, { "htile", kbfunc_tile, CWM_WIN, {.i = CWM_TILE_HORIZ} }, { "vtile", kbfunc_tile, CWM_WIN, {.i = CWM_TILE_VERT} }, + { "movetopleft", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_TOP_LEFT)} }, + { "movebottomleft", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_BOTTOM_LEFT)} }, + { "movetopright", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_TOP_RIGHT)} }, + { "movebottomright", kbfunc_client_move_edge, CWM_WIN, + {.i = (CWM_BOTTOM_RIGHT)} }, }; static const struct { Index: cwm.1 === RCS file: /cvs/xenocara/app/cwm/cwm.1,v retrieving revision 1.50 diff -u -p -r1.50 cwm.1 --- cwm.1 1 Feb 2014 00:25:04 - 1.50 +++ cwm.1 22 Jun 2014 14:27:26 - @@ -98,6 +98,14 @@ Toggle maximization of current window. Toggle vertical maximization of current window. .It Ic CMS-= Toggle horizontal maximization of current window. +.It Ic CM-t +Move window to the top left corner of screen. +.It Ic CM-y +Move window to the top right corner of screen. +.It Ic CM-v +Move window to the bottom left corner of screen. +.It Ic CM-b +Move window to the bottom right corner of screen. .It Ic M-? Spawn .Dq exec program Index: kbfunc.c === RCS file: /cvs/xenocara/app/cwm/kbfunc.c,v retrieving revision 1.95 diff -u -p -r1.95 kbfunc.c --- kbfunc.c30 Jan 2014 15:41:11 - 1.95 +++ kbfunc.c22 Jun 2014 14:27:26 - @@ -480,3 +480,47 @@ kbfunc_tile(struct client_ctx *cc, union break; } } + +void +kbfunc_client_move_edge(struct client_ctx *cc, union arg *arg) +{ + struct screen_ctx *sc = cc->sc; + struct geom xine; + int flags; + + /* +* pick screen that the middle of the window is on. +* that's probably more fair than if just the origin of +* a window is poking over a boundary +*/ + xine = screen_find_xinerama(sc, + cc->geom.x + cc->geom.w / 2, + cc->geom.y + cc->geom.h / 2, CWM_GAP); + + flags = arg->i; + + switch (flags) { + case CWM_TOP_LEFT: + cc->geom.x = xine.x; + cc->geom.y = xine.y; + client_move(cc); + break; + case CWM_BOTTOM_LEFT: + cc->geom.x = xine.x; + cc->geom.y = xine.y + xine.h - cc->geom.h - cc->bwidth * 2; + client_move(cc); + break; + case CWM_TOP_RIGHT: + cc->geom.x = xine.x + xine.w - cc->geom.w - cc->b