guest@dotshare [~/groups/wms/dwm] $ ls dwm/ | cat

dwm (scrot) (+3 likes)

ivo Oct 23, 2011 (wms/dwm)

config.h(raw, dl)

SCROT

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/* See LICENSE file for copyright and license details. */
/* All Patches                                         */ 
/* bstack.diff                                         */
/* attachaside.diff                                    */
/* cycle.diff                                          */
/* cyclelayouts.diff                                   */
/* defaultlayout.diff                                  */
/* dwm-5.8.2-pertag.diff                               */
/* statuscolors.diff                                   */
/* uselessgap.diff                                     */ 
/* op.menu.patch                                       */
/* gridmode.diff                                       */
/* dwm-5.9-centred-floating.diff                       */
/* dwm-5.9-xbm_layout_icons.diff                       */
/* add bottom space for Dzen2 and Trayer               */
   
/* appearance */
#define NUMCOLORS 8 // need at least 3
static const char colors[NUMCOLORS][ColLast][8] = { 
 // border foreground background
   { "#111111", "#676767", "#333333" }, // 0 = normal
   { "#395573", "#C0C0C0", "#333333" }, // 1 = selected
   { "#000000", "#8C4665", "#333333" }, // 2 = red
   { "#000000", "#000000", "#287373" }, // 3 = green 
   { "#000000", "#333333", "#395573" }, // 4 = blue
   { "#000000", "#333333", "#8C4665" }, // 5 = normal
   { "#000000", "#000000", "#333333" }, // 6 = cyan
   { "#000000", "#000000", "#333333" }, // 7 = blue
}; 

static const char font[] = "-*-terminus-medium-r-*-*-14-*-*-*-*-*-*-*";
// static const char font[]   = "-*-tamsyn-medium-*-*-*-14-*-*-*-*-*-iso8859-*";
static const unsigned int borderpx = 1;        /* border pixel of windows */ 
static const unsigned int gappx    = 4;       /* gap pixel between windows */
static const unsigned int snap     = 32;     /* snap pixel */
static const Bool showbar          = True;  /* False means no bar */
static const Bool topbar           = True; /* False means bottom bar */
static Bool useicons               = True;// False means use ascii symbols 

/* tagging */
static const char *tags[] = { "null", "web", "misc", "code", "media"};
static const int taglayouts[] = {1, 1, 1, 4, 4};

/* tag definitions for rules */
#define WEB 1 << 1
#define MISC 1 << 2 
#define CODE 1 << 3 
#define MEDIA 1 << 4 

/* rules */
static const Rule rules[] = {
/* class               instance       title       tags     isfloating  monitor */
{ "Chromium",            NULL,        NULL,       WEB,      False,      -1 }, 
{ "surf",                NULL,        NULL,       WEB,      False,      -1 },
{ "Gimp",                NULL,        NULL,       MISC,     False,      -1 }, 
{ "Tabbed",              NULL,        NULL,       WEB,      False,      -1 }, 
{ "Skype",               NULL,        NULL,       MISC,     False,      -1 }, 
{ "Geany",               NULL,        NULL,       CODE,     False,      -1 }, 
{ "Wicd",                NULL,        NULL,       0,        False,      -1 }, 
{ "Trayer",              NULL,        NULL,       ~0,       True,       -1 },     
{ "Audacious",           NULL,        NULL,       MEDIA,    False,      -1 }, 
{ "Xfburn",              NULL,        NULL,       MEDIA,    False,      -1 }, 
{ "Vlc",                 NULL,        NULL,       MEDIA,    False,      -1 }, 
};
 
/* layout(s) */
static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
static const Bool resizehints = False; /* True means respect size hints in tiled resizals */ 
 
/* PATHS */ 
#define HOME "/home/ivo" 
#define ICONS HOME"/.dwm/icons"
static const Layout layouts[] = {
    // icon symbol arrange function
{ ICONS"/tile.xbm", "[]=", tile },
{ ICONS"/bstack.xbm", "[B]", bstack },
{ ICONS"/monocle.xbm", "[M]", monocle },
{ ICONS"/float.xbm", "><>", NULL }, 
{ ICONS"/grid.xbm", "[G]", grid },
{ .symbol = NULL, .arrange = NULL },
};

/* key definitions */
#define MODKEY Mod4Mask 
#define CTRLKEY ControlMask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* commands */
static const char *dmenucmd[] =  { "dmenu_run", "-fn", font, "-nb", colors[0][ColBG], "-nf", colors[0][ColFG], "-sb", colors[1][ColBG], "-sf", colors[1][ColFG], NULL };
static const char *termcmd[] =   { "urxvtc", NULL };
static const char *chromium[] =  { "chromium", NULL };  
static const char *skype[] =     { "skype", NULL };   
static const char *surf[] =      { "surf", NULL }; 
static const char *thunar[] =    { "thunar", NULL }; 
static const char *lxappearance[] = { "lxappearance", NULL }; 
static const char *vlc[] =       { "vlc", NULL }; 
static const char *xfburn[] =    { "xfburn", NULL }; 
static const char *gimp[] =      { "gimp", NULL };  
static const char *geany[] =     { "geany", NULL }; 
static const char *audacious[] = { "audacious", NULL }; 
static const char *guvcview[] =  { "guvcview", NULL }; 
static const char *oblogout[] =  { "oblogout", NULL };
static const char *tabcmd[] =    { "urxvt", "-e", "tabbed", NULL }; 
static const char *mancmd[] =    { "urxvt", "-e", "ranger", NULL };  
static const char *rtorrent[] =  { "urxvt", "-e", "rtorrent", NULL };      
static const char *voldown[] =   { "amixer", "-q", "-c", "0", "set", "Master", "5-", "unmute", NULL };
static const char *volup[] =     { "amixer", "-q", "-c", "0", "set", "Master", "5+", "unmute", NULL };
static const char *volmute[] =   { "amixer", "-q", "-c", "0", "set", "Master", "toggle", NULL }; 
 
/* menus */
#define MENUEND { NULL, NULL, NULL, {0} }
#define MENUSEP(x) { x, NULL, NULL, {0} }  
/* title, submenu, function, argument */ 
static const menuCtx appsMenu[] = {
   { "thunar", NULL, spawn, {.v = thunar } },  
    MENUSEP("──────────"),  
   { "geany", NULL, spawn, {.v = geany } }, 
    MENUSEP("──────────"), 
   { "Gimp", NULL, spawn, {.v = gimp } }, 
    MENUSEP("──────────"), 
   { "webcam", NULL, spawn, {.v = guvcview } },  
   MENUEND,
}; 
 
static const menuCtx internetMenu[] = {
   { "chromium", NULL, spawn, {.v = chromium } },  
    MENUSEP("──────────"), 
   { "surf", NULL, spawn, {.v = surf } }, 
    MENUSEP("──────────"),
   { "skype ", NULL, spawn, {.v = skype } }, 
    MENUSEP("──────────"),
   { "rtorrent", NULL, spawn, {.v = rtorrent } },
   MENUEND,
}; 
 
static const menuCtx musicMenu[] = {
   { "audacious", NULL, spawn, {.v = audacious } },  
    MENUSEP("──────────"),  
   { "vlc", NULL, spawn, {.v = vlc } }, 
    MENUSEP("──────────"),  
   { "xfburn", NULL, spawn, {.v = xfburn } },    
   MENUEND,
}; 
  
static const menuCtx exitMenu[] = { 
   { "lxappearance", NULL, spawn, {.v = lxappearance } }, 
    MENUSEP("────────────"),  
   { "Exit", NULL, spawn, {.v = oblogout } }, 
  
   MENUEND,
};
   
static const menuCtx rootMenu[] = {
     { "Apps »", &appsMenu[0], NULL, {0} }, 
     { "Internet »", &internetMenu[0], NULL, {0} },  
     { "Music »", &musicMenu[0], NULL, {0} }, 
     { "Exit »", &exitMenu[0], NULL, {0} },  
     MENUEND,
};
 
/* menu key bindings
* only grabbed when menu is alive. */
static Key menu_keys[] = {
   { 0, XK_Up,       menu_up,       {0} },
   { 0, XK_Down,     menu_down,     {0} },
   { 0, XK_Right,    menu_next,     {0} },
   { 0, XK_Left,     menu_prev,     {0} },
   { 0, XK_Return,   menu_accept,   {0} },
   { 0, XK_Escape,   togglemenu,    {0} }
};

static Key keys[] = {
/* modifier key function argument */
{ MODKEY,                               XK_p,      spawn,              {.v = dmenucmd } },
{ MODKEY,                               XK_x,      spawn,              {.v = termcmd } }, 
{ MODKEY,		                XK_c,	   spawn,	       {.v = chromium } }, 
{ MODKEY|ShiftMask,		        XK_c,	   spawn,	       {.v = tabcmd } }, 
{ MODKEY,                               XK_e,      spawn,              {.v = mancmd } },   
{ 0,                                    0xffc7,    spawn,              {.v = voldown } }, 
{ 0,                                    0xffc8,    spawn,              {.v = volup } }, 
{ 0,                                    0xffc9,    spawn,              {.v = volmute } }, 
{ CTRLKEY,                              XK_space,  togglemenu,         {0} },
{ MODKEY|ShiftMask,                     XK_b,                          togglebar, {0} },
{ MODKEY,                               XK_q,                          killclient, {0} },
{ MODKEY|ShiftMask,                     XK_q,                          quit, {0} },
{ MODKEY,                               XK_comma,                      focusmon, {.i = -1 } },
{ MODKEY,                               XK_period,                     focusmon, {.i = +1 } },
{ MODKEY|ShiftMask,                     XK_comma,                      tagmon, {.i = -1 } },
{ MODKEY|ShiftMask,                     XK_period,                     tagmon, {.i = +1 } },
{ MODKEY,                               XK_j,                          focusstack, {.i = +1 } },
{ MODKEY,                               XK_k,                          focusstack, {.i = -1 } }, 
{ MODKEY,                               XK_h,                          setmfact, {.f = -0.05} },
{ MODKEY,                               XK_l,                          setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask,                     XK_Return,                     zoom, {0} },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
{ MODKEY,                               XK_Tab,                        view, {0} },
{ MODKEY,                               XK_0,                          view, {.ui = ~0 } },
{ MODKEY|ShiftMask,                     XK_0,                          tag, {.ui = ~0 } },
{ MODKEY,                               XK_Left,                       cycle, {.i = -1} },
{ MODKEY,                               XK_Right,                      cycle, {.i = +1} },
{ MODKEY|ShiftMask,                     XK_Left,                       tagcycle, {.i = -1} },
{ MODKEY|ShiftMask,                     XK_Right,                      tagcycle, {.i = +1} },
{ MODKEY,                               XK_t,       setlayout,         {.v = &layouts[0]} },
{ MODKEY,                               XK_d,       setlayout,         {.v = &layouts[1]} },
{ MODKEY,                               XK_m,       setlayout,         {.v = &layouts[2]} }, 
{ MODKEY,                               XK_f,       setlayout,         {.v = &layouts[3]} },     
{ MODKEY,                               XK_g,       setlayout,         {.v = &layouts[4]} },
{ MODKEY,                               XK_space,   nextlayout,        {0} },
{ MODKEY|ShiftMask,                     XK_space,   togglefloating,    {0} },
    
};

/* mouse binds */
/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol,           0,             Button1,        nextlayout,         {0} },
{ ClkLtSymbol,           0,             Button3,        prevlayout,         {0} },
{ ClkWinTitle,           0,             Button2,        zoom,               {0} },
{ ClkStatusText,         0,             Button2,        spawn,              {.v = termcmd } },
{ ClkClientWin, MODKEY,                 Button1,        movemouse,          {0} },
{ ClkClientWin, MODKEY,                 Button2,        togglefloating,     {0} },
{ ClkClientWin, MODKEY,                 Button3,        resizemouse,        {0} },
{ ClkTagBar,             0,             Button1,        view,               {0} },
{ ClkTagBar,             0,             Button3,        toggleview,         {0} },
{ ClkTagBar,    MODKEY,                 Button1,        tag,                {0} },
{ ClkTagBar,    MODKEY,                 Button3,        toggletag,          {0} }, 
{ ClkRootWin,            0,             Button3,        togglemenu,         {0} },
};

CLICK TO VIEW

x

dwmstat(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
#dwm status script
# 

# SKB 
getSkb() { 
    if [ "`skb -1`" = "USA" ]; then
echo -en "\x05EN"
    else
echo -en "\x04BG"
    fi
} 
 
# Time: 

dte(){
dte="$(date +"%a/%b/%e  %H:%M:%S/%Z")"
echo -e "\x06$dte"
}
 
xsetroot -name "$(getSkb) $(dte)"
 

x

Comments

Beastie said about 12 years ago

nice !

but how did you get colored layout icons and the right click menu

ivo said about 12 years ago