author | Anselm R. Garbe <garbeam@gmail.com> |
Sat, 18 Aug 2007 14:20:56 +0200 | |
changeset 964 | 777a9d9ce70b |
parent 963 | 7416c26a14db |
permissions | -rw-r--r-- |
910
c13cb8c6b7a5
referred to LICENSE file
Anselm R. Garbe <arg@suckless.org>
parents:
909
diff
changeset
|
1 |
/* See LICENSE file for copyright and license details. */ |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
2 |
#include "dwm.h" |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
3 |
#include <regex.h> |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
4 |
#include <stdio.h> |
791 | 5 |
#include <stdlib.h> |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
6 |
#include <X11/Xutil.h> |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
7 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
8 |
/* static */ |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
9 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
10 |
typedef struct { |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
11 |
const char *prop; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
12 |
const char *tags; |
837
123231b9eb87
renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
Anselm R. Garbe <arg@suckless.org>
parents:
830
diff
changeset
|
13 |
Bool isfloating; |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
14 |
} Rule; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
15 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
16 |
typedef struct { |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
17 |
regex_t *propregex; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
18 |
regex_t *tagregex; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
19 |
} Regs; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
20 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
21 |
TAGS |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
22 |
RULES |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
23 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
24 |
static Regs *regs = NULL; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
25 |
static unsigned int nrules = 0; |
949
99ee5c370f94
tags should be persistent now during X server run
Anselm R. Garbe <garbeam@gmail.com>
parents:
946
diff
changeset
|
26 |
static char prop[512]; |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
27 |
|
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
28 |
static unsigned int |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
29 |
idxoftag(const char *tag) { |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
30 |
unsigned int i; |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
31 |
|
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
32 |
for(i = 0; i < ntags; i++) |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
33 |
if(tags[i] == tag) |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
34 |
return i; |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
35 |
return 0; |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
36 |
} |
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
37 |
|
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
38 |
/* extern */ |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
39 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
40 |
void |
963
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
41 |
applyrules(Client *c) { |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
42 |
unsigned int i, j; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
43 |
regmatch_t tmp; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
44 |
Bool matched = False; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
45 |
XClassHint ch = { 0 }; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
46 |
|
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
47 |
/* rule matching */ |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
48 |
XGetClassHint(dpy, c->win, &ch); |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
49 |
snprintf(prop, sizeof prop, "%s:%s:%s", |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
50 |
ch.res_class ? ch.res_class : "", |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
51 |
ch.res_name ? ch.res_name : "", c->name); |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
52 |
for(i = 0; i < nrules; i++) |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
53 |
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
54 |
c->isfloating = rules[i].isfloating; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
55 |
for(j = 0; regs[i].tagregex && j < ntags; j++) { |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
56 |
if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
57 |
matched = True; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
58 |
c->tags[j] = True; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
59 |
} |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
60 |
} |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
61 |
} |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
62 |
if(ch.res_class) |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
63 |
XFree(ch.res_class); |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
64 |
if(ch.res_name) |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
65 |
XFree(ch.res_name); |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
66 |
if(!matched) |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
67 |
for(i = 0; i < ntags; i++) |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
68 |
c->tags[i] = seltags[i]; |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
69 |
} |
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
70 |
|
7416c26a14db
cleaned up settags-handling
Anselm R. Garbe <garbeam@gmail.com>
parents:
960
diff
changeset
|
71 |
void |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
72 |
compileregs(void) { |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
73 |
unsigned int i; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
74 |
regex_t *reg; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
75 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
76 |
if(regs) |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
77 |
return; |
958 | 78 |
nrules = sizeof rules / sizeof rules[0]; |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
79 |
regs = emallocz(nrules * sizeof(Regs)); |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
80 |
for(i = 0; i < nrules; i++) { |
958 | 81 |
if(rules[i].prop) { |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
82 |
reg = emallocz(sizeof(regex_t)); |
958 | 83 |
if(regcomp(reg, rules[i].prop, REG_EXTENDED)) |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
84 |
free(reg); |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
85 |
else |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
86 |
regs[i].propregex = reg; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
87 |
} |
958 | 88 |
if(rules[i].tags) { |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
89 |
reg = emallocz(sizeof(regex_t)); |
958 | 90 |
if(regcomp(reg, rules[i].tags, REG_EXTENDED)) |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
91 |
free(reg); |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
92 |
else |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
93 |
regs[i].tagregex = reg; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
94 |
} |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
95 |
} |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
96 |
} |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
97 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
98 |
Bool |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
99 |
isvisible(Client *c) { |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
100 |
unsigned int i; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
101 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
102 |
for(i = 0; i < ntags; i++) |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
103 |
if(c->tags[i] && seltags[i]) |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
104 |
return True; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
105 |
return False; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
106 |
} |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
107 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
108 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
109 |
tag(const char *arg) { |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
110 |
unsigned int i; |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
111 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
112 |
if(!sel) |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
113 |
return; |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
114 |
for(i = 0; i < ntags; i++) |
827 | 115 |
sel->tags[i] = arg == NULL; |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
116 |
i = idxoftag(arg); |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
117 |
if(i >= 0 && i < ntags) |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
118 |
sel->tags[i] = True; |
964
777a9d9ce70b
hmm I doubt the usefulness of storing this information...
Anselm R. Garbe <garbeam@gmail.com>
parents:
963
diff
changeset
|
119 |
saveprops(sel); |
953 | 120 |
arrange(); |
121 |
} |
|
122 |
||
123 |
void |
|
124 |
togglefloating(const char *arg) { |
|
125 |
if(!sel || isfloating()) |
|
126 |
return; |
|
127 |
sel->isfloating = !sel->isfloating; |
|
954
18381a2cda42
fixed _DWM_CONFIG persistation, fixed the client disapperance bug during restarts
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
128 |
if(sel->isfloating) { |
953 | 129 |
resize(sel, sel->x, sel->y, sel->w, sel->h, True); |
964
777a9d9ce70b
hmm I doubt the usefulness of storing this information...
Anselm R. Garbe <garbeam@gmail.com>
parents:
963
diff
changeset
|
130 |
saveprops(sel); |
954
18381a2cda42
fixed _DWM_CONFIG persistation, fixed the client disapperance bug during restarts
Anselm R. Garbe <garbeam@gmail.com>
parents:
953
diff
changeset
|
131 |
} |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
132 |
arrange(); |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
133 |
} |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
134 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
135 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
136 |
toggletag(const char *arg) { |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
137 |
unsigned int i, j; |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
138 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
139 |
if(!sel) |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
140 |
return; |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
141 |
i = idxoftag(arg); |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
142 |
sel->tags[i] = !sel->tags[i]; |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
143 |
for(j = 0; j < ntags && !sel->tags[j]; j++); |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
144 |
if(j == ntags) |
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
145 |
sel->tags[i] = True; |
964
777a9d9ce70b
hmm I doubt the usefulness of storing this information...
Anselm R. Garbe <garbeam@gmail.com>
parents:
963
diff
changeset
|
146 |
saveprops(sel); |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
147 |
arrange(); |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
148 |
} |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
149 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
150 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
151 |
toggleview(const char *arg) { |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
152 |
unsigned int i, j; |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
153 |
|
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
154 |
i = idxoftag(arg); |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
155 |
seltags[i] = !seltags[i]; |
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
156 |
for(j = 0; j < ntags && !seltags[j]; j++); |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
157 |
if(j == ntags) |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
158 |
seltags[i] = True; /* cannot toggle last view */ |
964
777a9d9ce70b
hmm I doubt the usefulness of storing this information...
Anselm R. Garbe <garbeam@gmail.com>
parents:
963
diff
changeset
|
159 |
savedwmprops(); |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
160 |
arrange(); |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
161 |
} |
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
162 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
163 |
void |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
164 |
view(const char *arg) { |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
165 |
unsigned int i; |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
166 |
|
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
167 |
for(i = 0; i < ntags; i++) |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
168 |
seltags[i] = arg == NULL; |
956
484245788760
made tag/view/toggle{tag,view} work on pointer to tags-array, there was the need to define Key key[] not static to do this. split focusclient into focusnext/prev, fixed config.*.h's
Anselm R. Garbe <garbeam@gmail.com>
parents:
954
diff
changeset
|
169 |
i = idxoftag(arg); |
823
fb5cbf0bd923
replaced Arg union with const char *arg, seems cleaner to me, even if we need atoi() in some places
Anselm R. Garbe <arg@suckless.org>
parents:
813
diff
changeset
|
170 |
if(i >= 0 && i < ntags) |
960
b5f856fcef4c
renamed seltag into seltags
Anselm R. Garbe <garbeam@gmail.com>
parents:
958
diff
changeset
|
171 |
seltags[i] = True; |
964
777a9d9ce70b
hmm I doubt the usefulness of storing this information...
Anselm R. Garbe <garbeam@gmail.com>
parents:
963
diff
changeset
|
172 |
savedwmprops(); |
946
b938876de936
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Anselm R. Garbe <garbeam@gmail.com>
parents:
941
diff
changeset
|
173 |
arrange(); |
790
48e7c3b45250
split screen.c into layout.c and tag.c (because the view is an implicit mixture of both)
Anselm R. Garbe <arg@suckless.org>
parents:
diff
changeset
|
174 |
} |