Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
fixing updatetitle
[dwm.git]
/
dwm.c
diff --git
a/dwm.c
b/dwm.c
index
07d0d36
..
bfeae15
100644
(file)
--- a/
dwm.c
+++ b/
dwm.c
@@
-121,8
+121,8
@@
typedef struct {
} Layout;
struct Monitor {
} Layout;
struct Monitor {
- int screen_number;
float mfact;
float mfact;
+ int num;
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
@@
-145,6
+145,7
@@
typedef struct {
const char *title;
unsigned int tags;
Bool isfloating;
const char *title;
unsigned int tags;
Bool isfloating;
+ int monitor;
} Rule;
/* function declarations */
} Rule;
/* function declarations */
@@
-236,9
+237,9
@@
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
/* variables */
static void zoom(const Arg *arg);
/* variables */
-static char stext[256];
+static char stext[256]
, ntext[8]
;
static int screen;
static int screen;
-static int sw, sh; /* X display screen geometry
x, y,
width, height */
+static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
static int bh, blw = 0; /* bar geometry */
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
@@
-276,6
+277,7
@@
void
applyrules(Client *c) {
unsigned int i;
const Rule *r;
applyrules(Client *c) {
unsigned int i;
const Rule *r;
+ Monitor *m;
XClassHint ch = { 0 };
/* rule matching */
XClassHint ch = { 0 };
/* rule matching */
@@
-289,6
+291,9
@@
applyrules(Client *c) {
{
c->isfloating = r->isfloating;
c->tags |= r->tags;
{
c->isfloating = r->isfloating;
c->tags |= r->tags;
+ for(m = mons; m && m->num != r->monitor; m = m->next);
+ if(m)
+ c->mon = m;
}
}
if(ch.res_class)
}
}
if(ch.res_class)
@@
-641,11
+646,13
@@
dirtomon(int dir) {
void
drawbar(Monitor *m) {
int x;
void
drawbar(Monitor *m) {
int x;
- unsigned int i, occ = 0, urg = 0;
+ unsigned int i,
n = 0,
occ = 0, urg = 0;
unsigned long *col;
Client *c;
for(c = m->clients; c; c = c->next) {
unsigned long *col;
Client *c;
for(c = m->clients; c; c = c->next) {
+ if(ISVISIBLE(c))
+ n++;
occ |= c->tags;
if(c->isurgent)
urg |= c->tags;
occ |= c->tags;
if(c->isurgent)
urg |= c->tags;
@@
-662,10
+669,12
@@
drawbar(Monitor *m) {
if(blw > 0) {
dc.w = blw;
drawtext(m->lt[m->sellt]->symbol, dc.norm, False);
if(blw > 0) {
dc.w = blw;
drawtext(m->lt[m->sellt]->symbol, dc.norm, False);
-
x = dc.x +
dc.w;
+
dc.x +=
dc.w;
}
}
- else
- x = dc.x;
+ snprintf(ntext, sizeof ntext, "%u", n);
+ dc.w = TEXTW(ntext);
+ drawtext(ntext, dc.norm, False);
+ x = (dc.x += dc.w);
if(m == selmon) { /* status is only drawn on selected monitor */
dc.w = TEXTW(stext);
dc.x = m->ww - dc.w;
if(m == selmon) { /* status is only drawn on selected monitor */
dc.w = TEXTW(stext);
dc.x = m->ww - dc.w;
@@
-1043,6
+1052,7
@@
manage(Window w, XWindowAttributes *wa) {
die("fatal: could not malloc() %u bytes\n", sizeof(Client));
*c = cz;
c->win = w;
die("fatal: could not malloc() %u bytes\n", sizeof(Client));
*c = cz;
c->win = w;
+ updatetitle(c);
if(XGetTransientForHint(dpy, w, &trans))
t = wintoclient(trans);
if(t) {
if(XGetTransientForHint(dpy, w, &trans))
t = wintoclient(trans);
if(t) {
@@
-1082,7
+1092,6
@@
manage(Window w, XWindowAttributes *wa) {
updatesizehints(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, False);
updatesizehints(c);
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
grabbuttons(c, False);
- updatetitle(c);
if(!c->isfloating)
c->isfloating = trans != None || c->isfixed;
if(c->isfloating)
if(!c->isfloating)
c->isfloating = trans != None || c->isfixed;
if(c->isfloating)
@@
-1675,7
+1684,7
@@
void
updategeom(void) {
int i, n = 1;
Client *c;
updategeom(void) {
int i, n = 1;
Client *c;
- Monitor *newmons = NULL, *m, *tm;
+ Monitor *newmons = NULL, *m
= NULL
, *tm;
#ifdef XINERAMA
XineramaScreenInfo *info = NULL;
#ifdef XINERAMA
XineramaScreenInfo *info = NULL;
@@
-1694,7
+1703,7
@@
updategeom(void) {
#ifdef XINERAMA
if(XineramaIsActive(dpy)) {
for(i = 0, m = newmons; m; m = m->next, i++) {
#ifdef XINERAMA
if(XineramaIsActive(dpy)) {
for(i = 0, m = newmons; m; m = m->next, i++) {
- m->
screen_number
= info[i].screen_number;
+ m->
num
= info[i].screen_number;
m->mx = m->wx = info[i].x_org;
m->my = m->wy = info[i].y_org;
m->mw = m->ww = info[i].width;
m->mx = m->wx = info[i].x_org;
m->my = m->wy = info[i].y_org;
m->mw = m->ww = info[i].width;
@@
-1706,7
+1715,7
@@
updategeom(void) {
#endif /* XINERAMA */
/* default monitor setup */
{
#endif /* XINERAMA */
/* default monitor setup */
{
- m->
screen_number
= 0;
+ m->
num
= 0;
m->mx = m->wx = 0;
m->my = m->wy = 0;
m->mw = m->ww = sw;
m->mx = m->wx = 0;
m->my = m->wy = 0;
m->mw = m->ww = sw;