1
0

renamed versatile into untiled

This commit is contained in:
Anselm R. Garbe 2007-02-22 17:43:41 +01:00
parent 27b0595af7
commit 587100873a
9 changed files with 51 additions and 51 deletions

View File

@ -203,8 +203,8 @@ manage(Window w, XWindowAttributes *wa) {
updatetitle(c); updatetitle(c);
for(t = clients; t && t->win != trans; t = t->next); for(t = clients; t && t->win != trans; t = t->next);
settags(c, t); settags(c, t);
if(!c->isversatile) if(!c->isuntiled)
c->isversatile = (t != NULL) || c->isfixed; c->isuntiled = (t != NULL) || c->isfixed;
attach(c); attach(c);
attachstack(c); attachstack(c);
c->isbanned = True; c->isbanned = True;
@ -285,10 +285,10 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
} }
void void
toggleversatile(const char *arg) { toggletiled(const char *arg) {
if(!sel || lt->arrange == versatile) if(!sel || lt->arrange == untile)
return; return;
sel->isversatile = !sel->isversatile; sel->isuntiled = !sel->isuntiled;
lt->arrange(); lt->arrange();
} }

View File

@ -18,7 +18,7 @@
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define RULES \ #define RULES \
static Rule rule[] = { \ static Rule rule[] = { \
/* class:instance:title regex tags regex isversatile */ \ /* class:instance:title regex tags regex isuntiled */ \
{ "Firefox", "3", False }, \ { "Firefox", "3", False }, \
{ "Gimp", NULL, True }, \ { "Gimp", NULL, True }, \
{ "MPlayer", NULL, True }, \ { "MPlayer", NULL, True }, \
@ -30,11 +30,11 @@ static Rule rule[] = { \
static Layout layout[] = { \ static Layout layout[] = { \
/* symbol function */ \ /* symbol function */ \
{ "[]=", tile }, /* first entry is default */ \ { "[]=", tile }, /* first entry is default */ \
{ "><>", versatile }, \ { "><>", untile }, \
}; };
#define MASTERWIDTH 600 /* master width per thousand */ #define MASTERWIDTH 600 /* master width per thousand */
#define NMASTER 1 /* clients in master area */ #define NMASTER 1 /* clients in master area */
#define SNAP 40 /* versatile snap pixel */ #define SNAP 40 /* untiled snap pixel */
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
@ -56,7 +56,7 @@ static Key key[] = { \
{ MODKEY, XK_k, focusclient, "-1" }, \ { MODKEY, XK_k, focusclient, "-1" }, \
{ MODKEY, XK_m, togglemax, NULL }, \ { MODKEY, XK_m, togglemax, NULL }, \
{ MODKEY, XK_Return, zoom, NULL }, \ { MODKEY, XK_Return, zoom, NULL }, \
{ MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \ { MODKEY|ShiftMask, XK_space, toggletiled, NULL }, \
{ MODKEY|ShiftMask, XK_c, killclient, NULL }, \ { MODKEY|ShiftMask, XK_c, killclient, NULL }, \
{ MODKEY, XK_0, view, NULL }, \ { MODKEY, XK_0, view, NULL }, \
{ MODKEY, XK_1, view, "0" }, \ { MODKEY, XK_1, view, "0" }, \

View File

@ -20,7 +20,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
* xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */ * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
#define RULES \ #define RULES \
static Rule rule[] = { \ static Rule rule[] = { \
/* class:instance:title regex tags regex isversatile */ \ /* class:instance:title regex tags regex isuntiled */ \
{ "Gimp", NULL, True }, \ { "Gimp", NULL, True }, \
{ "MPlayer", NULL, True }, \ { "MPlayer", NULL, True }, \
{ "Acroread", NULL, True }, \ { "Acroread", NULL, True }, \
@ -31,11 +31,11 @@ static Rule rule[] = { \
static Layout layout[] = { \ static Layout layout[] = { \
/* symbol function */ \ /* symbol function */ \
{ "[]=", tile }, /* first entry is default */ \ { "[]=", tile }, /* first entry is default */ \
{ "><>", versatile }, \ { "><>", untile }, \
}; };
#define MASTERWIDTH 600 /* master width per thousand */ #define MASTERWIDTH 600 /* master width per thousand */
#define NMASTER 1 /* clients in master area */ #define NMASTER 1 /* clients in master area */
#define SNAP 20 /* versatile snap pixel */ #define SNAP 20 /* untiled snap pixel */
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
@ -52,7 +52,7 @@ static Key key[] = { \
{ MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \ { MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \
{ MODKEY, XK_m, togglemax, NULL }, \ { MODKEY, XK_m, togglemax, NULL }, \
{ MODKEY, XK_Return, zoom, NULL }, \ { MODKEY, XK_Return, zoom, NULL }, \
{ MODKEY|ShiftMask, XK_space, toggleversatile,NULL }, \ { MODKEY|ShiftMask, XK_space, toggletiled, NULL }, \
{ MODKEY|ShiftMask, XK_c, killclient, NULL }, \ { MODKEY|ShiftMask, XK_c, killclient, NULL }, \
{ MODKEY, XK_0, view, NULL }, \ { MODKEY, XK_0, view, NULL }, \
{ MODKEY, XK_1, view, "0" }, \ { MODKEY, XK_1, view, "0" }, \

2
draw.c
View File

@ -81,7 +81,7 @@ drawstatus(void) {
dc.x = x; dc.x = x;
if(sel) { if(sel) {
drawtext(sel->name, dc.sel); drawtext(sel->name, dc.sel);
drawsquare(sel->ismax, sel->isversatile, dc.sel); drawsquare(sel->ismax, sel->isuntiled, dc.sel);
} }
else else
drawtext(NULL, dc.norm); drawtext(NULL, dc.norm);

38
dwm.1
View File

@ -5,14 +5,14 @@ dwm \- dynamic window manager
.B dwm .B dwm
.RB [ \-v ] .RB [ \-v ]
.SH DESCRIPTION .SH DESCRIPTION
dwm is a dynamic window manager for X. It manages windows in tiling and dwm is a dynamic window manager for X. It manages windows in tiled and
versatile layouts. Either layout can be applied dynamically, optimizing the untiled layouts. Either layout can be applied dynamically, optimizing the
environment for the application in use and the task performed. environment for the application in use and the task performed.
.P .P
In tiling layout windows are managed in a master and stacking area. The master In tiled layout windows are managed in a master and stacking area. The master
area contains the windows which currently need most attention, whereas the area contains the windows which currently need most attention, whereas the
stacking area contains all other windows. In versatile layout windows can be stacking area contains all other windows. In untiled layout windows can be
resized and moved freely. Dialog windows are always managed versatile, resized and moved freely. Dialog windows are always managed untiled,
regardless of the layout applied. regardless of the layout applied.
.P .P
Windows are grouped by tags. Each window can be tagged with one or multiple Windows are grouped by tags. Each window can be tagged with one or multiple
@ -20,8 +20,8 @@ tags. Selecting certain tags displays all windows with these tags.
.P .P
dwm contains a small status bar which displays all available tags, the layout, dwm contains a small status bar which displays all available tags, the layout,
the title of the focused window, and the text read from standard input. A the title of the focused window, and the text read from standard input. A
versatile window is indicated with an empty square and a maximized untiled window is indicated with an empty square and a maximized
versatile window is indicated with a filled square before the windows untiled window is indicated with a filled square before the windows
title. The selected tags are indicated with a different color. The tags of title. The selected tags are indicated with a different color. The tags of
the focused window are indicated with a filled square in the top left the focused window are indicated with a filled square in the top left
corner. The tags which are applied to one or more windows are indicated corner. The tags which are applied to one or more windows are indicated
@ -40,7 +40,7 @@ is read and displayed in the status text area.
.TP .TP
.B Button1 .B Button1
click on a tag label to display all windows with that tag, click on the layout click on a tag label to display all windows with that tag, click on the layout
label toggles between tiling and versatile layout. label toggles between tiled and untiled layout.
.TP .TP
.B Button3 .B Button3
click on a tag label adds/removes all windows with that tag to/from the view. click on a tag label adds/removes all windows with that tag to/from the view.
@ -57,7 +57,7 @@ Start
.BR xterm (1). .BR xterm (1).
.TP .TP
.B Mod1-Return .B Mod1-Return
Zooms/cycles current window to/from master area (tiling layout only). Zooms/cycles current window to/from master area (tiled layout only).
.TP .TP
.B Mod1-Tab .B Mod1-Tab
Focus next window. Focus next window.
@ -66,19 +66,19 @@ Focus next window.
Focus previous window. Focus previous window.
.TP .TP
.B Mod1-g .B Mod1-g
Increase master area width (tiling layout only). Increase master area width (tiled layout only).
.TP .TP
.B Mod1-s .B Mod1-s
Decrease master area width (tiling layout only). Decrease master area width (tiled layout only).
.TP .TP
.B Mod1-i .B Mod1-i
Increase the number of windows in the master area (tiling layout only). Increase the number of windows in the master area (tiled layout only).
.TP .TP
.B Mod1-d .B Mod1-d
Decrease the number of windows in the master area (tiling layout only). Decrease the number of windows in the master area (tiled layout only).
.TP .TP
.B Mod1-m .B Mod1-m
Toggles maximization of current window (versatile layout only). Toggles maximization of current window (untiled layout only).
.TP .TP
.B Mod1-Shift-[1..n] .B Mod1-Shift-[1..n]
Apply Apply
@ -97,10 +97,10 @@ tag to/from current window.
Close focused window. Close focused window.
.TP .TP
.B Mod1-space .B Mod1-space
Toggle between tiling and versatile layout (affects all windows). Toggle between tiled and untiled layout (affects all windows).
.TP .TP
.B Mod1-Shift-space .B Mod1-Shift-space
Toggle focused window between versatile and non-versatile state (tiling layout only). Toggle focused window between untiled and non-untiled state (tiled layout only).
.TP .TP
.B Mod1-[1..n] .B Mod1-[1..n]
View all windows with View all windows with
@ -120,13 +120,13 @@ Quit dwm.
.SS Mouse commands .SS Mouse commands
.TP .TP
.B Mod1-Button1 .B Mod1-Button1
Move current window while dragging (versatile layout only). Move current window while dragging (untiled layout only).
.TP .TP
.B Mod1-Button2 .B Mod1-Button2
Zooms/cycles current window to/from master area (tiling layout only). Zooms/cycles current window to/from master area (tiled layout only).
.TP .TP
.B Mod1-Button3 .B Mod1-Button3
Resize current window while dragging (versatile layout only). Resize current window while dragging (untiled layout only).
.SH CUSTOMIZATION .SH CUSTOMIZATION
dwm is customized by creating a custom config.h and (re)compiling the source dwm is customized by creating a custom config.h and (re)compiling the source
code. This keeps it fast, secure and simple. code. This keeps it fast, secure and simple.

8
dwm.h
View File

@ -67,7 +67,7 @@ struct Client {
int minax, minay, maxax, maxay; int minax, minay, maxax, maxay;
long flags; long flags;
unsigned int border; unsigned int border;
Bool isbanned, isfixed, ismax, isversatile; Bool isbanned, isfixed, ismax, isuntiled;
Bool *tags; Bool *tags;
Client *next; Client *next;
Client *prev; Client *prev;
@ -105,7 +105,7 @@ extern void killclient(const char *arg); /* kill c nicely */
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */ extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
extern void resize(Client *c, int x, int y, extern void resize(Client *c, int x, int y,
int w, int h, Bool sizehints); /* resize with given coordinates c*/ int w, int h, Bool sizehints); /* resize with given coordinates c*/
extern void toggleversatile(const char *arg); /* toggles focused client between versatile/and non-versatile state */ extern void toggletiled(const char *arg); /* toggles focused client between tiled/untiled state */
extern void updatesizehints(Client *c); /* update the size hint variables of c */ extern void updatesizehints(Client *c); /* update the size hint variables of c */
extern void updatetitle(Client *c); /* update the name of c */ extern void updatetitle(Client *c); /* update the name of c */
extern void unmanage(Client *c); /* destroy c */ extern void unmanage(Client *c); /* destroy c */
@ -126,8 +126,8 @@ extern void initlayouts(void); /* initialize layout array */
extern Client *nexttiled(Client *c); /* returns tiled successor of c */ extern Client *nexttiled(Client *c); /* returns tiled successor of c */
extern void restack(void); /* restores z layers of all clients */ extern void restack(void); /* restores z layers of all clients */
extern void setlayout(const char *arg); /* sets layout, -1 toggles */ extern void setlayout(const char *arg); /* sets layout, -1 toggles */
extern void togglemax(const char *arg); /* toggles maximization of versatile client */ extern void togglemax(const char *arg); /* toggles maximization of untiled client */
extern void versatile(void); /* arranges all windows versatile */ extern void untile(void); /* arranges all windows untiled */
extern void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */ extern void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */
/* main.c */ /* main.c */

View File

@ -151,14 +151,14 @@ buttonpress(XEvent *e) {
focus(c); focus(c);
if(CLEANMASK(ev->state) != MODKEY) if(CLEANMASK(ev->state) != MODKEY)
return; return;
if(ev->button == Button1 && (lt->arrange == versatile || c->isversatile)) { if(ev->button == Button1 && (lt->arrange == untile || c->isuntiled)) {
restack(); restack();
movemouse(c); movemouse(c);
} }
else if(ev->button == Button2) else if(ev->button == Button2)
zoom(NULL); zoom(NULL);
else if(ev->button == Button3 else if(ev->button == Button3
&& (lt->arrange == versatile || c->isversatile) && !c->isfixed) && (lt->arrange == untile || c->isuntiled) && !c->isfixed)
{ {
restack(); restack();
resizemouse(c); resizemouse(c);
@ -176,7 +176,7 @@ configurerequest(XEvent *e) {
c->ismax = False; c->ismax = False;
if(ev->value_mask & CWBorderWidth) if(ev->value_mask & CWBorderWidth)
c->border = ev->border_width; c->border = ev->border_width;
if(c->isfixed || c->isversatile || (lt->arrange == versatile)) { if(c->isfixed || c->isuntiled || (lt->arrange == untile)) {
if(ev->value_mask & CWX) if(ev->value_mask & CWX)
c->x = ev->x; c->x = ev->x;
if(ev->value_mask & CWY) if(ev->value_mask & CWY)
@ -304,7 +304,7 @@ propertynotify(XEvent *e) {
default: break; default: break;
case XA_WM_TRANSIENT_FOR: case XA_WM_TRANSIENT_FOR:
XGetTransientForHint(dpy, c->win, &trans); XGetTransientForHint(dpy, c->win, &trans);
if(!c->isversatile && (c->isversatile = (getclient(trans) != NULL))) if(!c->isuntiled && (c->isuntiled = (getclient(trans) != NULL)))
lt->arrange(); lt->arrange();
break; break;
case XA_WM_NORMAL_HINTS: case XA_WM_NORMAL_HINTS:

View File

@ -31,7 +31,7 @@ tile(void) {
if(c->isbanned) if(c->isbanned)
XMoveWindow(dpy, c->win, c->x, c->y); XMoveWindow(dpy, c->win, c->x, c->y);
c->isbanned = False; c->isbanned = False;
if(c->isversatile) if(c->isuntiled)
continue; continue;
c->ismax = False; c->ismax = False;
nx = wax; nx = wax;
@ -148,7 +148,7 @@ initlayouts(void) {
Client * Client *
nexttiled(Client *c) { nexttiled(Client *c) {
for(; c && (c->isversatile || !isvisible(c)); c = c->next); for(; c && (c->isuntiled || !isvisible(c)); c = c->next);
return c; return c;
} }
@ -160,10 +160,10 @@ restack(void) {
drawstatus(); drawstatus();
if(!sel) if(!sel)
return; return;
if(sel->isversatile || lt->arrange == versatile) if(sel->isuntiled || lt->arrange == untile)
XRaiseWindow(dpy, sel->win); XRaiseWindow(dpy, sel->win);
if(lt->arrange != versatile) { if(lt->arrange != untile) {
if(!sel->isversatile) if(!sel->isuntiled)
XLowerWindow(dpy, sel->win); XLowerWindow(dpy, sel->win);
for(c = nexttiled(clients); c; c = nexttiled(c->next)) { for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
if(c == sel) if(c == sel)
@ -202,7 +202,7 @@ void
togglemax(const char *arg) { togglemax(const char *arg) {
XEvent ev; XEvent ev;
if(!sel || (lt->arrange != versatile && !sel->isversatile) || sel->isfixed) if(!sel || (lt->arrange != untile && !sel->isuntiled) || sel->isfixed)
return; return;
if((sel->ismax = !sel->ismax)) { if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x; sel->rx = sel->x;
@ -218,7 +218,7 @@ togglemax(const char *arg) {
} }
void void
versatile(void) { untile(void) {
Client *c; Client *c;
for(c = clients; c; c = c->next) { for(c = clients; c; c = c->next) {
@ -245,7 +245,7 @@ zoom(const char *arg) {
unsigned int n; unsigned int n;
Client *c; Client *c;
if(!sel || lt->arrange != tile || sel->isversatile) if(!sel || lt->arrange != tile || sel->isuntiled)
return; return;
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
n++; n++;

4
tag.c
View File

@ -12,7 +12,7 @@
typedef struct { typedef struct {
const char *prop; const char *prop;
const char *tags; const char *tags;
Bool isversatile; Bool isuntiled;
} Rule; } Rule;
typedef struct { typedef struct {
@ -83,7 +83,7 @@ settags(Client *c, Client *trans) {
ch.res_name ? ch.res_name : "", c->name); ch.res_name ? ch.res_name : "", c->name);
for(i = 0; i < nrules; i++) for(i = 0; i < nrules; i++)
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
c->isversatile = rule[i].isversatile; c->isuntiled = rule[i].isuntiled;
for(j = 0; regs[i].tagregex && j < ntags; j++) { for(j = 0; regs[i].tagregex && j < ntags; j++) {
if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
matched = True; matched = True;