mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Add "gap" support to .cwmrc. The options put in here make gaps on the edge
of the screen where an application won't be {,vert}maximized over. used for placing a statusbar or something like xclock. Patch from Edd Barrett, with input from myself and okan. Thanks! ok okan@.
This commit is contained in:
parent
4bbb472a25
commit
3a94c57afc
1
calmwm.h
1
calmwm.h
@ -274,6 +274,7 @@ struct conf {
|
||||
|
||||
#define DEFAULTFONTNAME "sans-serif:pixelsize=14:bold"
|
||||
char *DefaultFontName;
|
||||
int gap_top, gap_bottom, gap_left, gap_right;
|
||||
};
|
||||
|
||||
/* Menu stuff */
|
||||
|
19
client.c
19
client.c
@ -339,10 +339,12 @@ client_maximize(struct client_ctx *cc)
|
||||
XGetWindowAttributes(X_Dpy, sc->rootwin, &rootwin_geom);
|
||||
if (!(cc->flags & CLIENT_VMAXIMIZED))
|
||||
cc->savegeom = cc->geom;
|
||||
cc->geom.x = 0;
|
||||
cc->geom.y = 0;
|
||||
cc->geom.height = rootwin_geom.height;
|
||||
cc->geom.width = rootwin_geom.width;
|
||||
cc->geom.x = Conf.gap_left;
|
||||
cc->geom.y = Conf.gap_top;
|
||||
cc->geom.height = rootwin_geom.height -
|
||||
(Conf.gap_top + Conf.gap_bottom);
|
||||
cc->geom.width = rootwin_geom.width -
|
||||
(Conf.gap_left + Conf.gap_right);
|
||||
cc->flags |= CLIENT_DOMAXIMIZE;
|
||||
}
|
||||
|
||||
@ -765,12 +767,9 @@ client_vertmaximize(struct client_ctx *cc)
|
||||
|
||||
if (!(cc->flags & CLIENT_MAXIMIZED))
|
||||
cc->savegeom = cc->geom;
|
||||
cc->geom.y = cc->bwidth;
|
||||
if (cc->geom.min_dx == 0)
|
||||
cc->geom.height = display_height;
|
||||
else
|
||||
cc->geom.height = display_height -
|
||||
(display_height % cc->geom.min_dx);
|
||||
cc->geom.y = cc->bwidth + Conf.gap_top;
|
||||
cc->geom.height = display_height -
|
||||
(Conf.gap_top + Conf.gap_bottom);
|
||||
cc->flags |= CLIENT_DOVMAXIMIZE;
|
||||
}
|
||||
|
||||
|
12
cwmrc.5
12
cwmrc.5
@ -15,7 +15,7 @@
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.\" The following requests are required for all man pages.
|
||||
.Dd $Mdocdate$
|
||||
.Dd $Mdocdate: March 23 2008 $
|
||||
.Dt CWMRC 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -138,6 +138,16 @@ Remove a keybinding for Mod4-o
|
||||
.Bd -literal -offset indent
|
||||
bind 4-o "unmap"
|
||||
.Ed
|
||||
.It Ic gap Ar top bottom left right
|
||||
Define "gaps" at the edge of the screen, so that when a window is maximized it will not overlap this area.
|
||||
This gap can be used for other applications such as
|
||||
.Xr xclock 1 ,
|
||||
which the user may wish to remain visible.
|
||||
.Pp
|
||||
.Pa top bottom left
|
||||
and
|
||||
.Pa right
|
||||
are the sizes of each the gap in pixels.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr cwm 1
|
||||
|
12
parse.y
12
parse.y
@ -65,7 +65,7 @@ typedef struct {
|
||||
|
||||
%}
|
||||
|
||||
%token FONTNAME STICKY
|
||||
%token FONTNAME STICKY GAP
|
||||
%token AUTOGROUP BIND COMMAND IGNORE
|
||||
%token YES NO
|
||||
%token ERROR
|
||||
@ -161,8 +161,13 @@ main : FONTNAME STRING {
|
||||
free($2);
|
||||
free($3);
|
||||
}
|
||||
| GAP NUMBER NUMBER NUMBER NUMBER {
|
||||
conf->gap_top = $2;
|
||||
conf->gap_bottom = $3;
|
||||
conf->gap_left = $4;
|
||||
conf->gap_right = $5;
|
||||
}
|
||||
;
|
||||
|
||||
%%
|
||||
|
||||
struct keywords {
|
||||
@ -199,6 +204,7 @@ lookup(char *s)
|
||||
{ "bind", BIND},
|
||||
{ "command", COMMAND},
|
||||
{ "fontname", FONTNAME},
|
||||
{ "gap", GAP},
|
||||
{ "ignore", IGNORE},
|
||||
{ "no", NO},
|
||||
{ "sticky", STICKY},
|
||||
@ -574,6 +580,8 @@ parse_config(const char *filename, struct conf *xconf)
|
||||
strlcpy(xconf->lockpath, conf->lockpath, sizeof(xconf->lockpath));
|
||||
|
||||
xconf->DefaultFontName = conf->DefaultFontName;
|
||||
|
||||
bcopy(&(conf->gap_top), &(xconf->gap_top), sizeof(int) * 4);
|
||||
}
|
||||
|
||||
free(conf);
|
||||
|
Loading…
Reference in New Issue
Block a user