summaryrefslogtreecommitdiffhomepage
path: root/patch/holdbar.c
blob: 0ea1d417b671939c2c4cc82c33e45f6ac3d5aa2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
void
holdbar(const Arg *arg)
{
	selmon->showbar = 1;
	updateholdbarpos(selmon);
	XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
}

void
keyrelease(XEvent *e)
{
	if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)) {
		selmon->showbar = 0;
		updateholdbarpos(selmon);
		XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
		arrange(selmon);
	}
	#if COMBO_PATCH
	combo = 0;
	#endif // COMBO_PATCH
}

void
updateholdbarpos(Monitor *m)
{
	m->wy = m->my;
	m->wh = m->mh;
	if (m->showbar) {
		m->by = m->topbar ? m->wy : m->wy + m->wh - bh;
		m->wy = m->topbar ? m->wy - bh + bh : m->wy;
	} else {
		m->by = -bh;
	}
}