Permalink
Browse files

updated xbm_layout_icons patch

  • Loading branch information...
1 parent 8079b96 commit 99bc5b8ef99857dadc7a566b9a71da622805ada0 OK committed Apr 29, 2012
Showing with 87 additions and 15 deletions.
  1. +42 −15 04-dwm-6.0-xbm_layout_icons.diff
  2. +9 −0 config.h
  3. +6 −0 icons/monocle0.xbm
  4. +6 −0 icons/monocle1.xbm
  5. +6 −0 icons/monocle2.xbm
  6. +6 −0 icons/monocle3.xbm
  7. +6 −0 icons/monocle4.xbm
  8. +6 −0 icons/monocle5.xbm
@@ -1,41 +1,68 @@
---- dwm.c.orig 2012-03-26 19:07:38.652228022 +0200
-+++ dwm.c 2012-03-26 19:12:56.104395747 +0200
-@@ -120,6 +120,7 @@ typedef struct {
+--- dwm.c.orig 2012-04-29 19:07:00.000000000 +0200
++++ dwm.c 2012-04-29 19:07:40.237787666 +0200
+@@ -120,10 +120,15 @@ typedef struct {
} Key;
typedef struct {
-+ const char *icon;
++ const char *icon;
const char *symbol;
void (*arrange)(Monitor *);
} Layout;
-@@ -188,6 +189,7 @@ static void die(const char *errstr, ...)
+
++typedef struct {
++ const char *icon;
++} MonocleNumberedIcon;
++
+ struct Monitor {
+ char ltsymbol[16];
+ int num;
+@@ -188,6 +193,7 @@ static void die(const char *errstr, ...)
static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m);
static void drawbars(void);
+static void drawicon(const char *file, unsigned long col[ColLast]);
static void drawcoloredtext(char *text);
static void drawsquare(Bool filled, Bool empty, unsigned long col[ColLast]);
static void drawtext(const char *text, unsigned long col[ColLast], Bool pad);
-@@ -767,8 +769,16 @@ drawbar(Monitor *m) {
+@@ -750,7 +756,7 @@ dirtomon(int dir) {
+ void
+ drawbar(Monitor *m) {
+ int x;
+- unsigned int i, occ = 0, urg = 0;
++ unsigned int i, occ = 0, urg = 0, n = 0;
+ unsigned long *col;
+ Client *c;
+
+@@ -767,8 +773,26 @@ drawbar(Monitor *m) {
drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i, col);
dc.x += dc.w;
}
- dc.w = blw = TEXTW(m->ltsymbol);
- drawtext(m->ltsymbol, dc.colors[0], True);
+ blw = TEXTW(m->ltsymbol);
+
-+ if(useicons) {
-+ dc.w = dc.h;
-+ drawicon(m->lt[m->sellt]->icon, dc.colors[0]);
-+ }
-+ else {
-+ dc.w = blw;
-+ drawtext(m->ltsymbol, dc.colors[0], False);
-+ }
++ if(useicons) {
++ dc.w = dc.h;
++ if(selmon->lt[selmon->sellt]->arrange == monocle) {
++ for(c = m->clients; c; c = c->next)
++ if(ISVISIBLE(c))
++ n++;
++ if(n < LENGTH(monoclenumberedicons))
++ drawicon(monoclenumberedicons[n].icon, dc.colors[0]);
++ else
++ drawicon(m->lt[m->sellt]->icon, dc.colors[0]);
++ }
++ else
++ drawicon(m->lt[m->sellt]->icon, dc.colors[0]);
++ }
++ else {
++ dc.w = blw;
++ drawtext(m->ltsymbol, dc.colors[0], False);
++ }
dc.x += dc.w;
x = dc.x;
if(m == selmon) { /* status is only drawn on selected monitor */
-@@ -835,6 +845,20 @@ drawcoloredtext(char *text) {
+@@ -835,6 +859,20 @@ drawcoloredtext(char *text) {
}
void
View
@@ -44,6 +44,15 @@ static const Layout layouts[] = {
{ "/home/ok/build/dwm/icons/grid.xbm", "ú", imgrid },
};
+static const MonocleNumberedIcon monoclenumberedicons[] = {
+ { "/home/ok/build/dwm/icons/monocle0.xbm" },
+ { "/home/ok/build/dwm/icons/monocle1.xbm" },
+ { "/home/ok/build/dwm/icons/monocle2.xbm" },
+ { "/home/ok/build/dwm/icons/monocle3.xbm" },
+ { "/home/ok/build/dwm/icons/monocle4.xbm" },
+ { "/home/ok/build/dwm/icons/monocle5.xbm" },
+};
+
/* tagging */
static const Tag tags[] = {
// name layout mfact nmaster
View
@@ -0,0 +1,6 @@
+#define monocle0_width 12
+#define monocle0_height 13
+static unsigned char monocle0_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03,
+ 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
@@ -0,0 +1,6 @@
+#define monocle1_width 12
+#define monocle1_height 13
+static unsigned char monocle1_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0x9c, 0x03,
+ 0x9c, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
@@ -0,0 +1,6 @@
+#define monocle2_width 12
+#define monocle2_height 13
+static unsigned char monocle2_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x7c, 0x02, 0x7c, 0x02, 0xfc, 0x03,
+ 0xfc, 0x03, 0xe4, 0x03, 0xe4, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
@@ -0,0 +1,6 @@
+#define monocle3_width 12
+#define monocle3_height 13
+static unsigned char monocle3_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x7c, 0x02, 0x7c, 0x02, 0x9c, 0x03,
+ 0x9c, 0x03, 0xe4, 0x03, 0xe4, 0x03, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
@@ -0,0 +1,6 @@
+#define monocle4_width 12
+#define monocle4_height 13
+static unsigned char monocle4_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x64, 0x02, 0x64, 0x02, 0xfc, 0x03,
+ 0xfc, 0x03, 0x64, 0x02, 0x64, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
View
@@ -0,0 +1,6 @@
+#define monocle5_width 12
+#define monocle5_height 13
+static unsigned char monocle5_bits[] = {
+ 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x64, 0x02, 0x64, 0x02, 0x9c, 0x03,
+ 0x9c, 0x03, 0x64, 0x02, 0x64, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };

0 comments on commit 99bc5b8

Please sign in to comment.