renamed untiled into floating, keeping tiled instead of tiling (afaik tiled sounds more correct) - English speakers convinced me
This commit is contained in:
parent
671442e89d
commit
338c083858
10
client.c
10
client.c
|
@ -203,8 +203,8 @@ manage(Window w, XWindowAttributes *wa) {
|
|||
updatetitle(c);
|
||||
for(t = clients; t && t->win != trans; t = t->next);
|
||||
settags(c, t);
|
||||
if(!c->isuntiled)
|
||||
c->isuntiled = (t != NULL) || c->isfixed;
|
||||
if(!c->isfloating)
|
||||
c->isfloating = (t != NULL) || c->isfixed;
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
c->isbanned = True;
|
||||
|
@ -285,10 +285,10 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
|
|||
}
|
||||
|
||||
void
|
||||
toggletiled(const char *arg) {
|
||||
if(!sel || lt->arrange == untile)
|
||||
togglefloating(const char *arg) {
|
||||
if(!sel || lt->arrange == floating)
|
||||
return;
|
||||
sel->isuntiled = !sel->isuntiled;
|
||||
sel->isfloating = !sel->isfloating;
|
||||
lt->arrange();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
|
||||
#define RULES \
|
||||
static Rule rule[] = { \
|
||||
/* class:instance:title regex tags regex isuntiled */ \
|
||||
/* class:instance:title regex tags regex isfloating */ \
|
||||
{ "Firefox", "3", False }, \
|
||||
{ "Gimp", NULL, True }, \
|
||||
{ "MPlayer", NULL, True }, \
|
||||
|
@ -30,7 +30,7 @@ static Rule rule[] = { \
|
|||
static Layout layout[] = { \
|
||||
/* symbol function */ \
|
||||
{ "[]=", tile }, /* first entry is default */ \
|
||||
{ "><>", untile }, \
|
||||
{ "><>", floating }, \
|
||||
};
|
||||
#define MASTERWIDTH 600 /* master width per thousand */
|
||||
#define NMASTER 1 /* clients in master area */
|
||||
|
@ -56,7 +56,7 @@ static Key key[] = { \
|
|||
{ MODKEY, XK_k, focusclient, "-1" }, \
|
||||
{ MODKEY, XK_m, togglemax, NULL }, \
|
||||
{ MODKEY, XK_Return, zoom, NULL }, \
|
||||
{ MODKEY|ShiftMask, XK_space, toggletiled, NULL }, \
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, NULL }, \
|
||||
{ MODKEY, XK_0, view, NULL }, \
|
||||
{ MODKEY, XK_1, view, "0" }, \
|
||||
|
|
|
@ -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) }' */
|
||||
#define RULES \
|
||||
static Rule rule[] = { \
|
||||
/* class:instance:title regex tags regex isuntiled */ \
|
||||
/* class:instance:title regex tags regex isfloating */ \
|
||||
{ "Gimp", NULL, True }, \
|
||||
{ "MPlayer", NULL, True }, \
|
||||
{ "Acroread", NULL, True }, \
|
||||
|
@ -31,7 +31,7 @@ static Rule rule[] = { \
|
|||
static Layout layout[] = { \
|
||||
/* symbol function */ \
|
||||
{ "[]=", tile }, /* first entry is default */ \
|
||||
{ "><>", untile }, \
|
||||
{ "><>", floating }, \
|
||||
};
|
||||
#define MASTERWIDTH 640 /* master width per thousand */
|
||||
#define NMASTER 1 /* clients in master area */
|
||||
|
@ -52,7 +52,7 @@ static Key key[] = { \
|
|||
{ MODKEY|ShiftMask, XK_Tab, focusclient, "-1" }, \
|
||||
{ MODKEY, XK_m, togglemax, NULL }, \
|
||||
{ MODKEY, XK_Return, zoom, NULL }, \
|
||||
{ MODKEY|ShiftMask, XK_space, toggletiled, NULL }, \
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, NULL }, \
|
||||
{ MODKEY, XK_0, view, NULL }, \
|
||||
{ MODKEY, XK_1, view, "0" }, \
|
||||
|
|
2
draw.c
2
draw.c
|
@ -81,7 +81,7 @@ drawstatus(void) {
|
|||
dc.x = x;
|
||||
if(sel) {
|
||||
drawtext(sel->name, dc.sel);
|
||||
drawsquare(sel->ismax, sel->isuntiled, dc.sel);
|
||||
drawsquare(sel->ismax, sel->isfloating, dc.sel);
|
||||
}
|
||||
else
|
||||
drawtext(NULL, dc.norm);
|
||||
|
|
22
dwm.1
22
dwm.1
|
@ -6,13 +6,13 @@ dwm \- dynamic window manager
|
|||
.RB [ \-v ]
|
||||
.SH DESCRIPTION
|
||||
dwm is a dynamic window manager for X. It manages windows in tiled and
|
||||
untiled layouts. Either layout can be applied dynamically, optimizing the
|
||||
floating layouts. Either layout can be applied dynamically, optimizing the
|
||||
environment for the application in use and the task performed.
|
||||
.P
|
||||
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
|
||||
stacking area contains all other windows. In untiled layout windows can be
|
||||
resized and moved freely. Dialog windows are always managed untiled,
|
||||
stacking area contains all other windows. In floating layout windows can be
|
||||
resized and moved freely. Dialog windows are always managed floating,
|
||||
regardless of the layout applied.
|
||||
.P
|
||||
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
|
||||
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
|
||||
untiled window is indicated with an empty square and a maximized
|
||||
untiled window is indicated with a filled square before the windows
|
||||
floating window is indicated with an empty square and a maximized
|
||||
floating window is indicated with a filled square before the windows
|
||||
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
|
||||
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
|
||||
.B Button1
|
||||
click on a tag label to display all windows with that tag, click on the layout
|
||||
label toggles between tiled and untiled layout.
|
||||
label toggles between tiled and floating layout.
|
||||
.TP
|
||||
.B Button3
|
||||
click on a tag label adds/removes all windows with that tag to/from the view.
|
||||
|
@ -78,7 +78,7 @@ Increase the number of windows in the master area (tiled layout only).
|
|||
Decrease the number of windows in the master area (tiled layout only).
|
||||
.TP
|
||||
.B Mod1-m
|
||||
Toggles maximization of current window (untiled layout only).
|
||||
Toggles maximization of current window (floating layout only).
|
||||
.TP
|
||||
.B Mod1-Shift-[1..n]
|
||||
Apply
|
||||
|
@ -97,10 +97,10 @@ tag to/from current window.
|
|||
Close focused window.
|
||||
.TP
|
||||
.B Mod1-space
|
||||
Toggle between tiled and untiled layout (affects all windows).
|
||||
Toggle between tiled and floating layout (affects all windows).
|
||||
.TP
|
||||
.B Mod1-Shift-space
|
||||
Toggle focused window between tiled and untiled state (tiled layout only).
|
||||
Toggle focused window between tiled and floating state (tiled layout only).
|
||||
.TP
|
||||
.B Mod1-[1..n]
|
||||
View all windows with
|
||||
|
@ -120,13 +120,13 @@ Quit dwm.
|
|||
.SS Mouse commands
|
||||
.TP
|
||||
.B Mod1-Button1
|
||||
Move current window while dragging (untiled layout only).
|
||||
Move current window while dragging (floating layout only).
|
||||
.TP
|
||||
.B Mod1-Button2
|
||||
Zooms/cycles current window to/from master area (tiled layout only).
|
||||
.TP
|
||||
.B Mod1-Button3
|
||||
Resize current window while dragging (untiled layout only).
|
||||
Resize current window while dragging (floating layout only).
|
||||
.SH CUSTOMIZATION
|
||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||
code. This keeps it fast, secure and simple.
|
||||
|
|
8
dwm.h
8
dwm.h
|
@ -50,7 +50,7 @@ struct Client {
|
|||
int minax, minay, maxax, maxay;
|
||||
long flags;
|
||||
unsigned int border;
|
||||
Bool isbanned, isfixed, ismax, isuntiled;
|
||||
Bool isbanned, isfixed, ismax, isfloating;
|
||||
Bool *tags;
|
||||
Client *next;
|
||||
Client *prev;
|
||||
|
@ -103,7 +103,7 @@ extern void killclient(const char *arg); /* kill c nicely */
|
|||
extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
|
||||
extern void resize(Client *c, int x, int y,
|
||||
int w, int h, Bool sizehints); /* resize with given coordinates c*/
|
||||
extern void toggletiled(const char *arg); /* toggles focused client between tiled/untiled state */
|
||||
extern void togglefloating(const char *arg); /* toggles focused client between floating/tiled state */
|
||||
extern void updatesizehints(Client *c); /* update the size hint variables of c */
|
||||
extern void updatetitle(Client *c); /* update the name of c */
|
||||
extern void unmanage(Client *c); /* destroy c */
|
||||
|
@ -117,6 +117,7 @@ extern unsigned int textw(const char *text); /* return the width of text in px*/
|
|||
extern void grabkeys(void); /* grab all keys defined in config.h */
|
||||
|
||||
/* layout.c */
|
||||
extern void floating(void); /* arranges all windows floating */
|
||||
extern void focusclient(const char *arg); /* focuses next(1)/previous(-1) visible client */
|
||||
extern void incmasterw(const char *arg); /* increments the master width with arg's index value */
|
||||
extern void incnmaster(const char *arg); /* increments nmaster with arg's index value */
|
||||
|
@ -124,8 +125,7 @@ extern void initlayouts(void); /* initialize layout array */
|
|||
extern Client *nexttiled(Client *c); /* returns tiled successor of c */
|
||||
extern void restack(void); /* restores z layers of all clients */
|
||||
extern void setlayout(const char *arg); /* sets layout, -1 toggles */
|
||||
extern void togglemax(const char *arg); /* toggles maximization of untiled client */
|
||||
extern void untile(void); /* arranges all windows untiled */
|
||||
extern void togglemax(const char *arg); /* toggles maximization of floating client */
|
||||
extern void zoom(const char *arg); /* zooms the focused client to master area, arg is ignored */
|
||||
|
||||
/* main.c */
|
||||
|
|
8
event.c
8
event.c
|
@ -151,14 +151,14 @@ buttonpress(XEvent *e) {
|
|||
focus(c);
|
||||
if(CLEANMASK(ev->state) != MODKEY)
|
||||
return;
|
||||
if(ev->button == Button1 && (lt->arrange == untile || c->isuntiled)) {
|
||||
if(ev->button == Button1 && (lt->arrange == floating || c->isfloating)) {
|
||||
restack();
|
||||
movemouse(c);
|
||||
}
|
||||
else if(ev->button == Button2)
|
||||
zoom(NULL);
|
||||
else if(ev->button == Button3
|
||||
&& (lt->arrange == untile || c->isuntiled) && !c->isfixed)
|
||||
&& (lt->arrange == floating || c->isfloating) && !c->isfixed)
|
||||
{
|
||||
restack();
|
||||
resizemouse(c);
|
||||
|
@ -176,7 +176,7 @@ configurerequest(XEvent *e) {
|
|||
c->ismax = False;
|
||||
if(ev->value_mask & CWBorderWidth)
|
||||
c->border = ev->border_width;
|
||||
if(c->isfixed || c->isuntiled || (lt->arrange == untile)) {
|
||||
if(c->isfixed || c->isfloating || (lt->arrange == floating)) {
|
||||
if(ev->value_mask & CWX)
|
||||
c->x = ev->x;
|
||||
if(ev->value_mask & CWY)
|
||||
|
@ -304,7 +304,7 @@ propertynotify(XEvent *e) {
|
|||
default: break;
|
||||
case XA_WM_TRANSIENT_FOR:
|
||||
XGetTransientForHint(dpy, c->win, &trans);
|
||||
if(!c->isuntiled && (c->isuntiled = (getclient(trans) != NULL)))
|
||||
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
|
||||
lt->arrange();
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
|
|
60
layout.c
60
layout.c
|
@ -31,7 +31,7 @@ tile(void) {
|
|||
if(c->isbanned)
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
c->isbanned = False;
|
||||
if(c->isuntiled)
|
||||
if(c->isfloating)
|
||||
continue;
|
||||
c->ismax = False;
|
||||
nx = wax;
|
||||
|
@ -69,6 +69,29 @@ LAYOUTS
|
|||
|
||||
/* extern */
|
||||
|
||||
void
|
||||
floating(void) {
|
||||
Client *c;
|
||||
|
||||
for(c = clients; c; c = c->next) {
|
||||
if(isvisible(c)) {
|
||||
if(c->isbanned)
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
c->isbanned = False;
|
||||
resize(c, c->x, c->y, c->w, c->h, True);
|
||||
}
|
||||
else {
|
||||
c->isbanned = True;
|
||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||
}
|
||||
}
|
||||
if(!sel || !isvisible(sel)) {
|
||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
||||
focus(c);
|
||||
}
|
||||
restack();
|
||||
}
|
||||
|
||||
void
|
||||
focusclient(const char *arg) {
|
||||
Client *c;
|
||||
|
@ -144,7 +167,7 @@ initlayouts(void) {
|
|||
|
||||
Client *
|
||||
nexttiled(Client *c) {
|
||||
for(; c && (c->isuntiled || !isvisible(c)); c = c->next);
|
||||
for(; c && (c->isfloating || !isvisible(c)); c = c->next);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -156,10 +179,10 @@ restack(void) {
|
|||
drawstatus();
|
||||
if(!sel)
|
||||
return;
|
||||
if(sel->isuntiled || lt->arrange == untile)
|
||||
if(sel->isfloating || lt->arrange == floating)
|
||||
XRaiseWindow(dpy, sel->win);
|
||||
if(lt->arrange != untile) {
|
||||
if(!sel->isuntiled)
|
||||
if(lt->arrange != floating) {
|
||||
if(!sel->isfloating)
|
||||
XLowerWindow(dpy, sel->win);
|
||||
for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
|
||||
if(c == sel)
|
||||
|
@ -198,7 +221,7 @@ void
|
|||
togglemax(const char *arg) {
|
||||
XEvent ev;
|
||||
|
||||
if(!sel || (lt->arrange != untile && !sel->isuntiled) || sel->isfixed)
|
||||
if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
|
||||
return;
|
||||
if((sel->ismax = !sel->ismax)) {
|
||||
sel->rx = sel->x;
|
||||
|
@ -213,35 +236,12 @@ togglemax(const char *arg) {
|
|||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||
}
|
||||
|
||||
void
|
||||
untile(void) {
|
||||
Client *c;
|
||||
|
||||
for(c = clients; c; c = c->next) {
|
||||
if(isvisible(c)) {
|
||||
if(c->isbanned)
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
c->isbanned = False;
|
||||
resize(c, c->x, c->y, c->w, c->h, True);
|
||||
}
|
||||
else {
|
||||
c->isbanned = True;
|
||||
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
|
||||
}
|
||||
}
|
||||
if(!sel || !isvisible(sel)) {
|
||||
for(c = stack; c && !isvisible(c); c = c->snext);
|
||||
focus(c);
|
||||
}
|
||||
restack();
|
||||
}
|
||||
|
||||
void
|
||||
zoom(const char *arg) {
|
||||
unsigned int n;
|
||||
Client *c;
|
||||
|
||||
if(!sel || lt->arrange != tile || sel->isuntiled)
|
||||
if(!sel || lt->arrange != tile || sel->isfloating)
|
||||
return;
|
||||
for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
|
||||
n++;
|
||||
|
|
4
tag.c
4
tag.c
|
@ -12,7 +12,7 @@
|
|||
typedef struct {
|
||||
const char *prop;
|
||||
const char *tags;
|
||||
Bool isuntiled;
|
||||
Bool isfloating;
|
||||
} Rule;
|
||||
|
||||
typedef struct {
|
||||
|
@ -83,7 +83,7 @@ settags(Client *c, Client *trans) {
|
|||
ch.res_name ? ch.res_name : "", c->name);
|
||||
for(i = 0; i < nrules; i++)
|
||||
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
|
||||
c->isuntiled = rule[i].isuntiled;
|
||||
c->isfloating = rule[i].isfloating;
|
||||
for(j = 0; regs[i].tagregex && j < ntags; j++) {
|
||||
if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
|
||||
matched = True;
|
||||
|
|
Loading…
Reference in a new issue