static void incnmaster(const Arg *arg);
static void keypress(XEvent *e);
static void killclient(const Arg *arg);
+static void layoutmenu(const Arg *arg);
static void manage(Window w, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
+static void keyrelease(XEvent *e);
+static void combotag(const Arg *arg);
+static void comboview(const Arg *arg);
+
+
/* variables */
static const char broken[] = "broken";
static char stext[256];
static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
[ButtonPress] = buttonpress,
+ [ButtonRelease] = keyrelease,
[ClientMessage] = clientmessage,
[ConfigureRequest] = configurerequest,
[ConfigureNotify] = configurenotify,
[EnterNotify] = enternotify,
[Expose] = expose,
[FocusIn] = focusin,
+ [KeyRelease] = keyrelease,
[KeyPress] = keypress,
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
/* function implementations */
+static int combo = 0;
+
+void
+keyrelease(XEvent *e) {
+ combo = 0;
+}
+
+void
+combotag(const Arg *arg) {
+ if(selmon->sel && arg->ui & TAGMASK) {
+ if (combo) {
+ selmon->sel->tags |= arg->ui & TAGMASK;
+ } else {
+ combo = 1;
+ selmon->sel->tags = arg->ui & TAGMASK;
+ }
+ focus(NULL);
+ arrange(selmon);
+ }
+}
+
+void
+comboview(const Arg *arg) {
+ unsigned newtags = arg->ui & TAGMASK;
+ if (combo) {
+ selmon->tagset[selmon->seltags] |= newtags;
+ } else {
+ selmon->seltags ^= 1; /*toggle tagset*/
+ combo = 1;
+ if (newtags)
+ selmon->tagset[selmon->seltags] = newtags;
+ }
+ focus(NULL);
+ arrange(selmon);
+}
+
void
applyrules(Client *c)
{
XFree(ch.res_class);
if (ch.res_name)
XFree(ch.res_name);
- c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
+ if(c->tags & TAGMASK) c->tags = c->tags & TAGMASK;
+ else if(c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags];
+ else c->tags = 1;
}
int
Monitor *m;
m = ecalloc(1, sizeof(Monitor));
- m->tagset[0] = m->tagset[1] = 1;
+ m->tagset[0] = m->tagset[1] = startontag ? 1 : 0;
m->mfact = mfact;
m->nmaster = nmaster;
m->showbar = showbar;
}
}
+void
+layoutmenu(const Arg *arg) {
+ FILE *p;
+ char c[3], *s;
+ int i;
+
+ if (!(p = popen(layoutmenu_cmd, "r")))
+ return;
+ s = fgets(c, sizeof(c), p);
+ pclose(p);
+
+ if (!s || *s == '\0' || c[0] == '\0')
+ return;
+
+ i = atoi(c);
+ setlayout(&((Arg) { .v = &layouts[i] }));
+}
+
void
manage(Window w, XWindowAttributes *wa)
{
detach(c);
detachstack(c);
c->mon = m;
- c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+ c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1);
attach(c);
attachstack(c);
focus(NULL);
{
unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
- if (newtagset) {
- selmon->tagset[selmon->seltags] = newtagset;
- focus(NULL);
- arrange(selmon);
- }
+ selmon->tagset[selmon->seltags] = newtagset;
+ focus(NULL);
+ arrange(selmon);
}
void
void
view(const Arg *arg)
{
- if ((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+ if(arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
selmon->seltags ^= 1; /* toggle sel tagset */
if (arg->ui & TAGMASK)