add scalefactor to cwmrc

This commit is contained in:
2024-12-22 17:02:42 -05:00
parent d7c777b1a5
commit ca083f97bd
4 changed files with 12 additions and 2 deletions

View File

@@ -313,6 +313,7 @@ struct conf {
int nameqlen; int nameqlen;
int bwidth; int bwidth;
int mamount; int mamount;
int scalefactor;
int snapdist; int snapdist;
int htile; int htile;
int vtile; int vtile;

1
conf.c
View File

@@ -288,6 +288,7 @@ conf_init(struct conf *c)
c->stickygroups = 0; c->stickygroups = 0;
c->bwidth = 1; c->bwidth = 1;
c->mamount = 1; c->mamount = 1;
c->scalefactor = 10;
c->htile = 50; c->htile = 50;
c->vtile = 50; c->vtile = 50;
c->snapdist = 0; c->snapdist = 0;

View File

@@ -57,7 +57,7 @@ kbfunc_cwm_status(void *ctx, struct cargs *cargs)
static void static void
kbfunc_amount(int flags, int amt, int *mx, int *my) kbfunc_amount(int flags, int amt, int *mx, int *my)
{ {
#define CWM_FACTOR 10 #define CWM_FACTOR Conf.scalefactor
if (flags & CWM_BIGAMOUNT) if (flags & CWM_BIGAMOUNT)
amt *= CWM_FACTOR; amt *= CWM_FACTOR;

10
parse.y
View File

@@ -73,7 +73,7 @@ typedef struct {
%token BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE %token BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE
%token FONTNAME STICKY GAP %token FONTNAME STICKY GAP
%token AUTOGROUP COMMAND IGNORE WM %token AUTOGROUP COMMAND IGNORE WM
%token YES NO BORDERWIDTH MOVEAMOUNT HTILE VTILE %token YES NO BORDERWIDTH MOVEAMOUNT SCALEFACTOR HTILE VTILE
%token COLOR SNAPDIST %token COLOR SNAPDIST
%token ACTIVEBORDER INACTIVEBORDER URGENCYBORDER %token ACTIVEBORDER INACTIVEBORDER URGENCYBORDER
%token GROUPBORDER UNGROUPBORDER %token GROUPBORDER UNGROUPBORDER
@@ -156,6 +156,13 @@ main : FONTNAME STRING {
} }
conf->mamount = $2; conf->mamount = $2;
} }
| SCALEFACTOR NUMBER {
if ($2 < 0 || $2 > INT_MAX) {
yyerror("invalid scalefactor");
YYERROR;
}
conf->scalefactor = $2;
}
| SNAPDIST NUMBER { | SNAPDIST NUMBER {
if ($2 < 0 || $2 > INT_MAX) { if ($2 < 0 || $2 > INT_MAX) {
yyerror("invalid snapdist"); yyerror("invalid snapdist");
@@ -350,6 +357,7 @@ lookup(char *s)
{ "menufg", MENUFG}, { "menufg", MENUFG},
{ "moveamount", MOVEAMOUNT}, { "moveamount", MOVEAMOUNT},
{ "no", NO}, { "no", NO},
{ "scalefactor", SCALEFACTOR},
{ "selfont", FONTSELCOLOR}, { "selfont", FONTSELCOLOR},
{ "snapdist", SNAPDIST}, { "snapdist", SNAPDIST},
{ "sticky", STICKY}, { "sticky", STICKY},