implemented nmaster appearance in mode label (using %u)
This commit is contained in:
parent
a768ea93fd
commit
1d4a24dae0
|
@ -7,7 +7,7 @@ const char *tags[] = { "home", "net", "www", "mon", "fnord", NULL };
|
||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define FLOATSYMBOL "><>"
|
#define FLOATSYMBOL "><>"
|
||||||
#define TILESYMBOL "[]="
|
#define TILESYMBOL "[%u]="
|
||||||
|
|
||||||
#define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*"
|
#define FONT "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*"
|
||||||
#define NORMBGCOLOR "#111111"
|
#define NORMBGCOLOR "#111111"
|
||||||
|
|
|
@ -7,7 +7,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
|
||||||
|
|
||||||
#define DEFMODE dotile /* dofloat */
|
#define DEFMODE dotile /* dofloat */
|
||||||
#define FLOATSYMBOL "><>"
|
#define FLOATSYMBOL "><>"
|
||||||
#define TILESYMBOL "[]="
|
#define TILESYMBOL "[%u]="
|
||||||
|
|
||||||
#define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
|
#define FONT "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"
|
||||||
#define NORMBGCOLOR "#333366"
|
#define NORMBGCOLOR "#333366"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 2.9
|
VERSION = 3.0
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
|
2
draw.c
2
draw.c
|
@ -120,7 +120,7 @@ drawstatus(void) {
|
||||||
dc.x += dc.w;
|
dc.x += dc.w;
|
||||||
}
|
}
|
||||||
dc.w = bmw;
|
dc.w = bmw;
|
||||||
drawtext(arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, dc.status, False, False);
|
drawtext(mtext, dc.status, False, False);
|
||||||
x = dc.x + dc.w;
|
x = dc.x + dc.w;
|
||||||
dc.w = textw(stext);
|
dc.w = textw(stext);
|
||||||
dc.x = bw - dc.w;
|
dc.x = bw - dc.w;
|
||||||
|
|
1
dwm.h
1
dwm.h
|
@ -93,6 +93,7 @@ struct Client {
|
||||||
|
|
||||||
extern const char *tags[]; /* all tags */
|
extern const char *tags[]; /* all tags */
|
||||||
extern char stext[1024]; /* status text */
|
extern char stext[1024]; /* status text */
|
||||||
|
extern char mtext[32]; /* mode text */
|
||||||
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
|
extern int bx, by, bw, bh, bmw; /* bar geometry, bar mode label width */
|
||||||
extern int screen, sx, sy, sw, sh; /* screen geometry */
|
extern int screen, sx, sy, sw, sh; /* screen geometry */
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
extern int wax, way, wah, waw; /* windowarea geometry */
|
||||||
|
|
5
main.c
5
main.c
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
char stext[1024];
|
char stext[1024], mtext[32];
|
||||||
Bool *seltag;
|
Bool *seltag;
|
||||||
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah;
|
int bx, by, bw, bh, bmw, masterd, screen, sx, sy, sw, sh, wax, way, waw, wah;
|
||||||
unsigned int master, nmaster, ntags, numlockmask;
|
unsigned int master, nmaster, ntags, numlockmask;
|
||||||
|
@ -128,12 +128,13 @@ setup(void) {
|
||||||
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
|
dc.status[ColFG] = getcolor(STATUSFGCOLOR);
|
||||||
setfont(FONT);
|
setfont(FONT);
|
||||||
/* geometry */
|
/* geometry */
|
||||||
bmw = textw(TILESYMBOL) > textw(FLOATSYMBOL) ? textw(TILESYMBOL) : textw(FLOATSYMBOL);
|
|
||||||
sx = sy = 0;
|
sx = sy = 0;
|
||||||
sw = DisplayWidth(dpy, screen);
|
sw = DisplayWidth(dpy, screen);
|
||||||
sh = DisplayHeight(dpy, screen);
|
sh = DisplayHeight(dpy, screen);
|
||||||
master = MASTER;
|
master = MASTER;
|
||||||
nmaster = NMASTER;
|
nmaster = NMASTER;
|
||||||
|
snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
|
||||||
|
bmw = textw(mtext);
|
||||||
/* bar */
|
/* bar */
|
||||||
bx = sx;
|
bx = sx;
|
||||||
by = sy;
|
by = sy;
|
||||||
|
|
12
view.c
12
view.c
|
@ -2,6 +2,7 @@
|
||||||
* See LICENSE file for license details.
|
* See LICENSE file for license details.
|
||||||
*/
|
*/
|
||||||
#include "dwm.h"
|
#include "dwm.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
||||||
|
@ -149,10 +150,15 @@ focusprev(Arg *arg) {
|
||||||
|
|
||||||
void
|
void
|
||||||
incnmaster(Arg *arg) {
|
incnmaster(Arg *arg) {
|
||||||
if((nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
|
if((arrange == dofloat) || (nmaster + arg->i < 1) || (wah / (nmaster + arg->i) < bh))
|
||||||
return;
|
return;
|
||||||
nmaster += arg->i;
|
nmaster += arg->i;
|
||||||
arrange();
|
snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
|
||||||
|
bmw = textw(mtext);
|
||||||
|
if(sel)
|
||||||
|
arrange();
|
||||||
|
else
|
||||||
|
drawstatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
|
@ -218,6 +224,8 @@ togglefloat(Arg *arg) {
|
||||||
void
|
void
|
||||||
togglemode(Arg *arg) {
|
togglemode(Arg *arg) {
|
||||||
arrange = (arrange == dofloat) ? dotile : dofloat;
|
arrange = (arrange == dofloat) ? dotile : dofloat;
|
||||||
|
snprintf(mtext, sizeof mtext, arrange == dofloat ? FLOATSYMBOL : TILESYMBOL, nmaster);
|
||||||
|
bmw = textw(mtext);
|
||||||
if(sel)
|
if(sel)
|
||||||
arrange();
|
arrange();
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue