config.h: document GAPSZ should be even; key.c: only use new center ratio; event.c: spawn new terminals with new ratio via kb

This commit is contained in:
Iris Lightshard 2021-02-25 00:37:57 -05:00
parent bc38a1ab32
commit 3a2f736ce5
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 28 additions and 27 deletions

View file

@ -5,6 +5,7 @@
#define GHOSTCOL 0x797979
#define BORDER 4
/* Should be even */
#define GAPSZ 4
#define MENUBORDER 0

View file

@ -292,7 +292,7 @@ newwindow(XCreateWindowEvent *e)
if (kbLaunch)
{
usleep(100000);
quickreshape(c, ra.width/5, ra.height/5, 3*ra.width/5, 3*ra.height/5);
quickreshape(c, ra.width/6, GAPSZ, 2*ra.width/3, ra.height - 2*GAPSZ);
kbLaunch = 0;
}
}

50
key.c
View file

@ -130,44 +130,44 @@ keypress(XKeyEvent *e)
/* basic wm functionality */
if(e->keycode == tabcode && (e->state&Mod1Mask) == (1<<3))
alttab(e->state&ShiftMask);
if(e->keycode == dcode && (e->state&SHORTCUTMOD) == (MODBITS))
else if(e->keycode == dcode && (e->state&SHORTCUTMOD) == (MODBITS))
delete(current, 0);
if (e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS))
else if (e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS))
hide(current);
if (e->keycode == ucode && (e->state&SHORTCUTMOD) == (MODBITS))
else if (e->keycode == ucode && (e->state&SHORTCUTMOD) == (MODBITS))
unhide(0, 1);
if (e->keycode == vcode && (e->state&SHORTCUTMOD) == (MODBITS))
else if (e->keycode == vcode && (e->state&SHORTCUTMOD) == (MODBITS))
move(current, Button3);
if (e->keycode == rcode && (e->state&SHORTCUTMOD) == (MODBITS))
else if (e->keycode == rcode && (e->state&SHORTCUTMOD) == (MODBITS))
reshape(current, Button3, sweep, 0);
if (e->keycode == mcode && (e->state&SHORTCUTMOD) == (MODBITS))
else if (e->keycode == mcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, -BORDER, -BORDER, ra.width + 2*BORDER, ra.height + 2*BORDER);
if (e->keycode == scode && (e->state&SHORTCUTMOD) == (MODBITS))
else if (e->keycode == scode && (e->state&SHORTCUTMOD) == (MODBITS))
stick(current);
/* half snap */
if (e->keycode == hcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height - 2*GAPSZ);
if (e->keycode == lcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height - 2*GAPSZ);
if (e->keycode == jcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, ra.height/2 + GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 2*GAPSZ);
if (e->keycode == kcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 2*GAPSZ);
else if (e->keycode == hcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height - 2*GAPSZ);
else if (e->keycode == lcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + 0.5*GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height - 2*GAPSZ);
else if (e->keycode == jcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 1.5*GAPSZ);
else if (e->keycode == kcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width - 2*GAPSZ, ra.height/2 - 1.5*GAPSZ);
/* quarter snap */
if (e->keycode == qcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ);
if (e->keycode == wcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, ra.height/2 + GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ);
if (e->keycode == ocode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + GAPSZ, ra.height/2 + GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ);
if (e->keycode == pcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + GAPSZ, GAPSZ, ra.width/2 - 2*GAPSZ, ra.height/2 - 2*GAPSZ);
else if (e->keycode == qcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
else if (e->keycode == wcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
else if (e->keycode == ocode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + 0.5*GAPSZ, ra.height/2 + 0.5*GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
else if (e->keycode == pcode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/2 + 0.5*GAPSZ, GAPSZ, ra.width/2 - 1.5*GAPSZ, ra.height/2 - 1.5*GAPSZ);
/* center snap */
if (e->keycode == ccode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/5, ra.height/5, 3*ra.width/5, 3*ra.height/5);
else if (e->keycode == ccode && (e->state&SHORTCUTMOD) == (MODBITS))
quickreshape(current, ra.width/6, GAPSZ, 2*ra.width/3, ra.height - 2*GAPSZ);
#ifdef DEVEL
/* manage autostuck windows */