some changes towards 4.9

new_dwm
Anselm R Garbe 17 years ago
parent dd9ee6d248
commit e237b2a76f

@ -14,24 +14,15 @@
const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
Rule rules[] = { Rule rules[] = {
/* class:instance:title substr tags ref isfloating */ /* class instance title tags ref isfloating */
{ "Firefox", tags[8], False }, { NULL, NULL, "Firefox", tags[8], False },
{ "Gimp", NULL, True }, { NULL, NULL, "Gimp", NULL, True },
{ "MPlayer", NULL, True }, { NULL, NULL, "MPlayer", NULL, True },
{ "Acroread", NULL, True }, { NULL, NULL, "Acroread", NULL, True },
}; };
/* layout(s) */ /* geometry function */
#define RESIZEHINTS True /* False - respect size hints in tiled resizals */ void (*setgeoms)(void) = setdefgeoms;
#define SNAP 32 /* snap pixel */
Layout layouts[] = {
/* symbol function isfloating */
{ "[]|", tileh, False }, /* first entry is default */
{ "[]=", tilev, False },
{ "><>", floating, True },
{ "[M]", monocle, True },
};
void void
setanselmgeoms(void) { setanselmgeoms(void) {
@ -83,12 +74,24 @@ anselmgeoms(const char *arg) {
void void
defgeoms(const char *arg) { defgeoms(const char *arg) {
setgeoms = setdefaultgeoms; setgeoms = setdefgeoms;
setgeoms(); setgeoms();
updatebarpos(); updatebarpos();
setlayout("[]="); setlayout("[]=");
} }
/* layout(s) */
#define RESIZEHINTS True /* False - respect size hints in tiled resizals */
#define SNAP 32 /* snap pixel */
Layout layouts[] = {
/* symbol function isfloating */
{ "[]|", tileh, False }, /* first entry is default */
{ "[]=", tilev, False },
{ "><>", floating, True },
{ "[M]", monocle, True },
};
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
Key keys[] = { Key keys[] = {

@ -14,13 +14,16 @@
const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
Rule rules[] = { Rule rules[] = {
/* class:instance:title substr tags ref isfloating */ /* class instance title tags ref isfloating */
{ "Firefox", tags[8], False }, { NULL, NULL, "Firefox", tags[8], False },
{ "Gimp", NULL, True }, { NULL, NULL, "Gimp", NULL, True },
{ "MPlayer", NULL, True }, { NULL, NULL, "MPlayer", NULL, True },
{ "Acroread", NULL, True }, { NULL, NULL, "Acroread", NULL, True },
}; };
/* geometry function */
void (*setgeoms)(void) = setdefgeoms;
/* layout(s) */ /* layout(s) */
#define RESIZEHINTS True /* False - respect size hints in tiled resizals */ #define RESIZEHINTS True /* False - respect size hints in tiled resizals */
#define SNAP 32 /* snap pixel */ #define SNAP 32 /* snap pixel */

@ -1,5 +1,5 @@
# dwm version # dwm version
VERSION = 4.8 VERSION = 4.9
# Customize below to fit your system # Customize below to fit your system

17
dwm.c

@ -99,7 +99,9 @@ typedef struct {
} Layout; } Layout;
typedef struct { typedef struct {
const char *prop; const char *class;
const char *instance;
const char *title;
const char *tag; const char *tag;
Bool isfloating; Bool isfloating;
} Rule; } Rule;
@ -161,7 +163,7 @@ void restack(void);
void run(void); void run(void);
void scan(void); void scan(void);
void setclientstate(Client *c, long state); void setclientstate(Client *c, long state);
void setdefaultgeoms(void); void setdefgeoms(void);
void setlayout(const char *arg); void setlayout(const char *arg);
void setup(void); void setup(void);
void spawn(const char *arg); void spawn(const char *arg);
@ -224,7 +226,6 @@ Display *dpy;
DC dc = {0}; DC dc = {0};
Layout *lt = NULL; Layout *lt = NULL;
Window root, barwin; Window root, barwin;
void (*setgeoms)(void) = setdefaultgeoms;
/* configuration, allows nested code to access above variables */ /* configuration, allows nested code to access above variables */
#include "config.h" #include "config.h"
@ -244,9 +245,9 @@ applyrules(Client *c) {
XGetClassHint(dpy, c->win, &ch); XGetClassHint(dpy, c->win, &ch);
for(i = 0; i < LENGTH(rules); i++) { for(i = 0; i < LENGTH(rules); i++) {
r = &rules[i]; r = &rules[i];
if(strstr(c->name, r->prop) if(strstr(c->name, r->title)
|| (ch.res_class && strstr(ch.res_class, r->prop)) || (ch.res_class && r->class && strstr(ch.res_class, r->class))
|| (ch.res_name && strstr(ch.res_name, r->prop))) || (ch.res_name && r->instance && strstr(ch.res_name, r->instance)))
{ {
c->isfloating = r->isfloating; c->isfloating = r->isfloating;
if(r->tag) { if(r->tag) {
@ -1051,7 +1052,7 @@ maprequest(XEvent *e) {
} }
void void
monocle(void) { monocle(void) {
Client *c; Client *c;
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
@ -1390,7 +1391,7 @@ setclientstate(Client *c, long state) {
} }
void void
setdefaultgeoms(void) { setdefgeoms(void) {
/* screen dimensions */ /* screen dimensions */
sx = 0; sx = 0;

Loading…
Cancel
Save