add alwayscenter

This commit is contained in:
horhik 2020-10-07 23:08:52 +03:00
parent 599d7cfd06
commit 4f542cdc69
6 changed files with 28 additions and 3 deletions

View File

@ -52,7 +52,7 @@ static const Rule rules[] = {
*/
/* class instance title tags mask isfloating monitor scratch key */
{ "Gimp", NULL, NULL, 0, 1, -1, 0 },
{ "firefox", NULL, NULL, 0 << 2, 0, -1, 0 },
{ "firefox", NULL, NULL, 1 << 1, 0, -1, 0 },
{ NULL, NULL, "scratchpad", 0, 1, -1, 's' },
{ NULL, NULL, "sp_volume", 0, 1, -1, 'v' },

Binary file not shown.

View File

@ -1138,6 +1138,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)

View File

@ -132,6 +132,7 @@ struct Monitor {
Monitor *next;
Window barwin;
const Layout *lt[2];
unsigned int alttag;
};
typedef struct {
@ -221,6 +222,7 @@ static void spawnscratch(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *);
static void togglealttag();
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void togglescratch(const Arg *arg);
@ -756,7 +758,7 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
int x, w, tw = 0;
int x, w, wdelta, sw, tw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@ -777,8 +779,9 @@ drawbar(Monitor *m)
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
drw_text(drw, x, 0, w, bh, wdelta + lrpad / 2, (selmon->alttag ? tagsalt[i] : tags[i]), urg & 1 << i);
if (occ & 1 << i)
drw_rect(drw, x + boxs, boxs, boxw, boxw,
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
@ -1691,6 +1694,14 @@ seturgent(Client *c, int urg)
XFree(wmh);
}
void
togglealttag()
{
selmon->alttag = !selmon->alttag;
drawbar(selmon);
}
void
showhide(Client *c)
{

Binary file not shown.

View File

@ -0,0 +1,12 @@
diff -up dwm/dwm.c dwmmod/dwm.c
--- dwm/dwm.c 2020-06-25 00:21:30.383692180 -0300
+++ dwmmod/dwm.c 2020-06-25 00:20:35.643692330 -0300
@@ -1057,6 +1057,8 @@ manage(Window w, XWindowAttributes *wa)
updatewindowtype(c);
updatesizehints(c);
updatewmhints(c);
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, 0);
if (!c->isfloating)