about summary refs log tree commit diff stats
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* reverted dist target in Makefileanselm@anselm12008-05-191-1/+1
|
* removed the exact focus mechanism of next/prev windowAnselm R Garbe2008-05-171-1/+1
|
* this is the correct wayanselm@anselm12008-04-201-0/+1
|
* copyright notice is in LICENSEanselm@anselm12008-04-201-1/+0
|
* some cleanup changesAnselm R Garbe2008-04-031-1/+1
|
* removed all defines of geoms, implemented setgeoms() instead, added ↵Anselm R Garbe2008-03-131-1/+1
| | | | config.anselm.h to show how I'd like to see that people edit their geoms
* thx to Toni Lainsonarg@suckless.org2007-10-191-2/+2
|
* removed dwm.h, just include C-files in config.h if you extend dwm, that's ↵arg@suckless.org2007-10-181-2/+2
| | | | simplier and most flexible than all other possibilities
* recreated dwm.hAnselm R. Garbe2007-10-111-1/+1
|
* renamed config.h into config.def.h, config.h will be created if not present, ↵Anselm R. Garbe2007-09-231-1/+5
| | | | this seems less annoying after all
* made all stuff non-static - so you can choose wether to use dwm the static ↵arg@suckless.org2007-09-171-1/+1
| | | | or the extern way when extending it
* micromizing dwm step 1Anselm R. Garbe2007-09-151-3/+3
|
* moved bar-related stuff to bar.c (merged draw.c into that)Anselm R. Garbe2007-09-151-1/+1
|
* renamed config.default.h into config.hAnselm R. Garbe2007-09-151-5/+1
|
* dist target only needs to add config.default.hAnselm R. Garbe2007-09-151-1/+1
|
* added screen.c, removed layout.c and tag.cAnselm R. Garbe2007-08-191-1/+1
|
* fififiAnselm R. Garbe2007-08-151-1/+1
|
* separated layout-specific stuff into separate .h and .c files which are ↵Anselm R. Garbe2007-08-111-1/+1
| | | | included in config.h resp. config.mk - this allows writing layouts for dwm without any need to patch existing code
* removed strip, added -s to LDFLAGSAnselm R. Garbe2007-05-151-1/+0
|
* yet another fix of copyright compactisitionAnselm R. Garbe2007-04-131-1/+1
|
* fixed quoting and a comment 3.6Anselm R. Garbe2007-02-211-1/+1
|
* added draw.c again (except getcolor and setfont which are helpers in main.c)Anselm R. Garbe2007-02-201-1/+1
|
* split screen.c into layout.c and tag.c (because the view is an implicit ↵Anselm R. Garbe2007-02-201-1/+1
| | | | mixture of both)
* draw.c is useless (belongs to main.c now)Anselm R. Garbe2007-02-191-1/+1
|
* renamed view.c into screen.cAnselm R. Garbe2007-02-191-1/+1
|
* merged tag.c, view.c and tile.c to manage.cAnselm R. Garbe2007-02-191-1/+1
|
* introduced tile.c, some refactoring of functionsAnselm R. Garbe2007-02-191-1/+1
|
* fixed copyright notice in MakefileAnselm R. Garbe2007-02-081-1/+1
|
* got rid of LD (inspired by JGs patch to wmii)Anselm R. Garbe2007-02-051-3/+2
|
* next version will contain updated copyright noticearg@mig292007-01-021-1/+1
|
* separated several functions into view.cAnselm R. Garbe2006-08-221-1/+1
|
* removed finished messageAnselm R.Garbe2006-08-141-1/+0
|
* applied Sanders LD and resize patchesAnselm R.Garbe2006-08-141-1/+2
|
* applied Sanders tiny patchesAnselm R.Garbe2006-08-081-1/+1
|
* typo fixarg@10ksloc.org2006-08-071-1/+1
|
* applied Sanders man page/Makefile patcharg@10ksloc.org2006-08-071-1/+1
|
* added stripping to dwm target in Makefilearg@10ksloc.org2006-08-071-0/+1
|
* removed CONFIGarg@10ksloc.org2006-08-031-3/+2
|
* make config.h not a time dependencearg@10ksloc.org2006-08-031-1/+1
|
* removed rm config.h from cleanarg@10ksloc.org2006-08-031-1/+1
|
* added gmake compliancearg@10ksloc.org2006-08-031-2/+2
|
* applied Jukka's diffarg@10ksloc.org2006-08-031-4/+5
|
* applied Sanders Makefile patcharg@10ksloc.org2006-08-031-26/+20
|
* using SRC instead of *.carg@10ksloc.org2006-08-031-1/+1
|
* changed the files included in make distarg@10ksloc.org2006-08-031-1/+2
|
* pre { line-height: 125%; } td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; } td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } .highlight .hll { background-color: #ffffcc } .highlight .c { color: #888888 } /* Comment */ .highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */ .highlight .k { color: #008800; font-weight: bold } /* Keyword */ .highlight .ch { color: #888888 } /* Comment.Hashbang */ .highlight .cm { color: #888888 } /* Comment.Multiline */ .highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ .highlight .cpf { color: #888888 } /* Comment.PreprocFile */ .highlight .c1 { color: #888888 } /* Comment.Single */ .highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * (C)opyright MMVI Anselm R. Garbe <garbeam at gmail dot com>
 * See LICENSE file for license details.
 */
#include "dwm.h"

#include <string.h>
#include <X11/Xutil.h>

/********** CUSTOMIZE **********/

char *tags[TLast] = {
	[Tscratch] = "scratch",
	[Tdev] = "dev",
	[Twww] = "www",
	[Twork] = "work",
};

static Rule rule[] = {
	/* class			instance	tags						isfloat */
	{ "Firefox-bin",	"Gecko",	{ [Twww] = "www" },			False },
};

/********** CUSTOMIZE **********/

/* extern functions */

void (*arrange)(Arg *) = dotile;

void
appendtag(Arg *arg)
{
	if(!sel)
		return;

	sel->tags[arg->i] = tags[arg->i];
	arrange(NULL);
}

void
dofloat(Arg *arg)
{
	Client *c;

	arrange = dofloat;
	for(c = clients; c; c = c->next) {
		if(c->tags[tsel])
			resize(c, True);
		else
			ban(c);
	}
	if(sel && !sel->tags[tsel]) {
		if((sel = getnext(clients))) {
			higher(sel);
			focus(sel);
		}
	}
	drawall();
}

void
dotile(Arg *arg)
{
	Client *c;
	int n, i, w, h;

	w = sw - mw;
	arrange = dotile;
	for(n = 0, c = clients; c; c = c->next)
		if(c->tags[tsel] && !c->isfloat)
			n++;

	if(n > 1)
		h = (sh - bh) / (n - 1);
	else
		h = sh - bh;

	for(i = 0, c = clients; c; c = c->next) {
		if(c->tags[tsel]) {
			if(c->isfloat) {
				higher(c);
				resize(c, True);
				continue;
			}
			if(n == 1) {
				c->x = sx;
				c->y = sy + bh;
				c->w = sw - 2 * c->border;
				c->h = sh - 2 * c->border - bh;
			}
			else if(i == 0) {
				c->x = sx;
				c->y = sy + bh;
				c->w = mw - 2 * c->border;
				c->h = sh - 2 * c->border - bh;
			}
			else {
				c->x = sx + mw;
				c->y = sy + (i - 1) * h + bh;
				c->w = w - 2 * c->border;
				c->h = h - 2 * c->border;
			}
			resize(c, False);
			i++;
		}
		else
			ban(c);
	}
	if(!sel || (sel && !sel->tags[tsel])) {
		if((sel = getnext(clients))) {
			higher(sel);
			focus(sel);
		}
	}
	drawall();
}

Client *
getnext(Client *c)
{
	for(; c && !c->tags[tsel]; c = c->next);
	return c;
}

void
replacetag(Arg *arg)
{
	int i;
	if(!sel)
		return;

	for(i = 0; i < TLast; i++)
		sel->tags[i] = NULL;
	appendtag(arg);
}

void
settags(Client *c)
{
	XClassHint ch;
	static unsigned int len = rule ? sizeof(rule) / sizeof(rule[0]) : 0;
	unsigned int i, j;
	Bool matched = False;

	if(!len) {
		c->tags[tsel] = tags[tsel];
		return;
	}

	if(XGetClassHint(dpy, c->win, &ch)) {
		if(ch.res_class && ch.res_name) {
			for(i = 0; i < len; i++)
				if(!strncmp(rule[i].class, ch.res_class, sizeof(rule[i].class))
					&& !strncmp(rule[i].instance, ch.res_name, sizeof(rule[i].instance)))
				{
					for(j = 0; j < TLast; j++)
						c->tags[j] = rule[i].tags[j];
					c->isfloat = rule[i].isfloat;
					matched = True;
					break;
				}
		}
		if(ch.res_class)
			XFree(ch.res_class);
		if(ch.res_name)
			XFree(ch.res_name);
	}

	if(!matched)
		c->tags[tsel] = tags[tsel];
}

void
view(Arg *arg)
{
	tsel = arg->i;
	arrange(NULL);
	drawall();
}