guest@dotshare [~/groups/wms/monster] $ ls Natural-monster/ | cat

Natural monster (scrot)

lucafav Sep 10, 2015 (wms/monster)

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
/* see LICENSE for copyright and license */

#ifndef CONFIG_H
#define CONFIG_H

/** modifiers **/
#define MOD1            Mod1Mask    /* ALT key */
#define MOD4            Mod4Mask    /* Super/Windows key */
#define CONTROL         ControlMask /* Control key */
#define SHIFT           ShiftMask   /* Shift key */

/** generic settings **/
#define MASTER_SIZE     0.52
#define SHOW_PANEL      False     /* show panel by default on exec */
#define TOP_PANEL       True      /* False means panel is on bottom */
#define PANEL_HEIGHT    16        /* 0 for no space for panel, thus no panel */
#define DEFAULT_MODE    TILE      /* initial layout/mode: TILE MONOCLE BSTACK GRID FLOAT */
#define ATTACH_ASIDE    True      /* False means new window is master */
#define FOLLOW_WINDOW   False     /* follow the window when moved to a different desktop */
#define FOLLOW_MOUSE    False     /* focus the window the mouse just entered */
#define CLICK_TO_FOCUS  True      /* focus an unfocused window when clicked  */
#define FOCUS_BUTTON    Button1   /* mouse button to be used along with CLICK_TO_FOCUS */
#define BORDER_WIDTH    4         /* window border width */
#define FOCUS           "#aa964c" /* focused window border color    */
#define UNFOCUS         "#170f0d" /* unfocused window border color  */
#define MINWSZ          50        /* minimum window size in pixels  */
#define DEFAULT_DESKTOP 2         /* the desktop to focus initially */
#define DESKTOPS        10        /* number of desktops - edit DESKTOPCHANGE keys to suit */
#define USELESSGAP      8         /* the size of the useless gap in pixels */

/**
 * open applications to specified desktop with specified mode.
 * if desktop is negative, then current is assumed
 */
static const AppRule rules[] = { \
    /*  class     desktop  follow  float */
    { "GNU Image",-1,      False,  True },
    { "Skype",     3,      False,  True },
    { "Vimperator", 0,      False,  False },
    { "Iceweasel", 0,      False,  False },
    { "Telegram", 1,      False,  False },
 //   { "Spotify", 5,      False,  True},
    { "Steam", -1,      False,  True},
    { "Wine", -1,      False,  True},
    { "mc-chat", 1,      False,  False },
//    { "games.sh", 4,      False,  True},
    { "games-launcher", -1,      False,  True},
    { "wm-change", -1,      False,  True},
    { "LoL Patcher", -1,      False,  True },
    { "LoLClient.exe", -1,      False,  True },
    { "PVP.net Client", -1,      False,  True },
    { "League of Legends (TM) Client", -1,      False,  True }
};

/* helper for spawning shell commands */
#define SHCMD(cmd) {.com = (const char*[]){"/bin/sh", "-c", cmd, NULL}}

/**
 * custom commands
 * must always end with ', NULL };'
 */
static const char *termcmd[] = { "urxvtc",     NULL };
static const char *menucmd[] = { "dmenu_run", NULL };
static const char *browser[] = { "iceweasel", NULL };
static const char *spotify[] = { "spotify", NULL };
static const char *calc[] = { "gnome-calculator", NULL };
static const char *games[] = { "urxvtc", "-name", "games-launcher",  "-e",  "/home/luca/Documenti/games/games-launch", NULL };
static const char *chwm[] = { "urxvtc", "-name", "wm-change",  "-e",  "/home/luca/Documenti/changewm/chwm-launch", NULL };
static const char *vtoggle[] = { "amixer", "sset", "Master", "toggle", NULL };
static const char *vdown[] = { "amixer", "sset", "PCM", "5%-", NULL };
static const char *vup[] = { "amixer", "sset", "PCM", "5%+", NULL };
static const char *mtoggle[] = { "playcontrols", "toggle", NULL };
static const char *mnext[] = { "playcontrols", "next", NULL };
static const char *mprec[] = { "playcontrols", "prev", NULL };
static const char *mstop[] = { "playcontrols", "stop", NULL };
static const char *ttouch[] = { "/home/luca/Documenti/toggletouchpad", NULL };
static const char *mscrot[] = { "/home/luca/Documenti/mscrot", NULL };
//static const char *scrpcmd[] = { "xterm", "-T", "scratchpad", NULL };
static const char *notify[] = { "/home/luca/.config/panel/min3/notify.sh", NULL };
/* static const char *scrpcmd[] = { "urxvt", "-name", "scratchpad",  NULL }; */

#define DESKTOPCHANGE(K,N) \
    {  MOD1,             K,              change_desktop, {.i = N}}, \
    {  MOD1|ShiftMask,   K,              client_to_desktop, {.i = N}},

/**
 * keyboard shortcuts
 */
static Key keys[] = {
    /* modifier          key            function           argument */
//    {  MOD1,             XK_b,          togglepanel,       {NULL}},
//    {  MOD1,             XK_BackSpace,  focusurgent,       {NULL}},
    {  MOD1,             XK_q,          killclient,        {NULL}},
    {  MOD1,             XK_j,          next_win,          {NULL}},
    {  MOD1,             XK_k,          prev_win,          {NULL}},
    {  MOD1,             XK_h,          resize_master,     {.i = -10}}, /* decrease size in px */
    {  MOD1,             XK_l,          resize_master,     {.i = +10}}, /* increase size in px */
    {  MOD1,             XK_o,          resize_stack,      {.i = -10}}, /* shrink   size in px */
    {  MOD1,             XK_p,          resize_stack,      {.i = +10}}, /* grow     size in px */
//    {  MOD1|CONTROL,     XK_h,          rotate,            {.i = -1}},
//    {  MOD1|CONTROL,     XK_l,          rotate,            {.i = +1}},
//    {  MOD1|SHIFT,       XK_h,          rotate_filled,     {.i = -1}},
//    {  MOD1|SHIFT,       XK_l,          rotate_filled,     {.i = +1}},
//    {  MOD1,             XK_Tab,        last_desktop,      {NULL}},
    {  MOD1|SHIFT,       XK_Return,     swap_master,       {NULL}},
    {  MOD1|SHIFT,       XK_j,          move_down,         {NULL}},
    {  MOD1|SHIFT,       XK_k,          move_up,           {NULL}},
    {  MOD1|SHIFT,       XK_t,          switch_mode,       {.i = TILE}},
    {  MOD1|SHIFT,       XK_m,          switch_mode,       {.i = MONOCLE}},
    {  MOD1|SHIFT,       XK_b,          switch_mode,       {.i = BSTACK}},
    {  MOD1|SHIFT,       XK_g,          switch_mode,       {.i = GRID}},
    {  MOD1|SHIFT,       XK_f,          switch_mode,       {.i = FLOAT}},
    {  MOD1|SHIFT,       XK_v,          switch_mode,       {.i = VERTGRID}}, 
    {  MOD1|SHIFT,       XK_e,          quit,              {.i = 0}}, /* quit with exit value 0 */
//    {  MOD1|CONTROL,     XK_q,          quit,              {.i = 1}}, /* quit with exit value 1 */
    
    {  MOD1,             XK_Return,     spawn,             {.com = termcmd}},
//    {  MOD4,             XK_v,          spawn,             {.com = menucmd}},
    {  MOD1|SHIFT,       XK_b,          spawn,             {.com = browser}},
    {  MOD1|SHIFT,       XK_p,          spawn,             {.com = games}},
    {  MOD1|SHIFT,       XK_n,          spawn,             {.com = chwm}},
    {  MOD1|SHIFT,       XK_s,          spawn,             {.com = spotify}},
    {  MOD1,             0xff61,        spawn,             {.com = mscrot}},
    {  MOD1,             XK_n,          spawn,             {.com = notify}},
    /* fn */
    {  0,                0x1008ff12,    spawn,             {.com = vtoggle}},
    {  0,                0x1008ff13,    spawn,             {.com = vup}},
    {  0,                0x1008ff11,    spawn,             {.com = vdown}},
    {  0,                0x1008ff14,    spawn,             {.com = mtoggle}},
    {  0,                0x1008ff17,    spawn,             {.com = mnext}},
    {  0,                0x1008ff16,    spawn,             {.com = mprec}},
    {  0,                0x1008ff15,    spawn,             {.com = mstop}},
    {  0,                0x1008ffa9,    spawn,             {.com = ttouch}},
    {  0,                0x1008ffa9,    spawn,             {.com = ttouch}},
    {  0,                0x1008ff1d,    spawn,             {.com = calc}},
 
    {  MOD4,             XK_j,          moveresize,        {.v = (int []){   0,  25,   0,   0 }}}, /* move down  */
    {  MOD4,             XK_k,          moveresize,        {.v = (int []){   0, -25,   0,   0 }}}, /* move up    */
    {  MOD4,             XK_l,          moveresize,        {.v = (int []){  25,   0,   0,   0 }}}, /* move right */
    {  MOD4,             XK_h,          moveresize,        {.v = (int []){ -25,   0,   0,   0 }}}, /* move left  */
    {  MOD4|SHIFT,       XK_j,          moveresize,        {.v = (int []){   0,   0,   0,  25 }}}, /* height grow   */
    {  MOD4|SHIFT,       XK_k,          moveresize,        {.v = (int []){   0,   0,   0, -25 }}}, /* height shrink */
    {  MOD4|SHIFT,       XK_l,          moveresize,        {.v = (int []){   0,   0,  25,   0 }}}, /* width grow    */
    {  MOD4|SHIFT,       XK_h,          moveresize,        {.v = (int []){   0,   0, -25,   0 }}}, /* width shrink  */
    {  MOD1,             XK_c,          centre,            {NULL}}, 
    {  MOD1,             XK_t,          togglefloat,       {NULL}}, 
    {  MOD1,             XK_f,          fullscreen,        {NULL}}, 

    /* desktop selection */
       DESKTOPCHANGE(    XK_1,                             0)
       DESKTOPCHANGE(    XK_2,                             1)
       DESKTOPCHANGE(    XK_3,                             2)
       DESKTOPCHANGE(    XK_4,                             3)
       DESKTOPCHANGE(    XK_5,                             4)
       DESKTOPCHANGE(    XK_6,                             5)
       DESKTOPCHANGE(    XK_7,                             6)
       DESKTOPCHANGE(    XK_8,                             7)
       DESKTOPCHANGE(    XK_9,                             8)
       DESKTOPCHANGE(    XK_0,                             9)
 
};

/**
 * mouse shortcuts
 */
static Button buttons[] = {
    {  MOD1,    Button1,     mousemotion,   {.i = MOVE}},
    {  MOD1,    Button3,     mousemotion,   {.i = RESIZE}},
    {  MOD4,    Button3,     spawn,         {.com = menucmd}},
};
#endif

/* vim: set expandtab ts=4 sts=4 sw=4 : */

CLICK TO VIEW

x

custom_functions(raw, dl)

 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
/**
 * If the window is not float
 * makes it float and move it
 * to the centre
 */
void centre() {
    Desktop *d = &desktops[currdeskidx];
    XWindowAttributes wa;
    if (!d->curr || !XGetWindowAttributes(dis, d->curr->win, &wa)) return;
    if (!d->curr->isfloat && !d->curr->istrans) { d->curr->isfloat = True; tile(d); focus(d->curr, d); }
    XMoveResizeWindow(dis, d->curr->win, (ww-wa.width)/2 - BORDER_WIDTH,
                                        (wh + PANEL_HEIGHT -wa.height)/2 - BORDER_WIDTH,
                                        wa.width , wa.height ); 
}

/**
 * Makes the window float and takes all 
 * available space 
 */
void fullscreen() {
    Desktop *d = &desktops[currdeskidx];
    XWindowAttributes wa;
    if (!d->curr->isfloat) { d->curr->isfloat=True; tile(d); focus(d->curr, d); }
    wa.width=ww - (USELESSGAP + BORDER_WIDTH)*2;
    wa.height=wh + PANEL_HEIGHT - (USELESSGAP + BORDER_WIDTH)*2;
    XMoveResizeWindow(dis, d->curr->win, (ww-wa.width)/2 - BORDER_WIDTH, 
                           (wh + PANEL_HEIGHT -wa.height)/2 - BORDER_WIDTH,
                            wa.width,
                            wa.height);
}

/**
 * Makes the window float and back tiling
 */
void togglefloat() {
    Desktop *d = &desktops[currdeskidx];
    if (!d->curr->isfloat) 
        d->curr->isfloat=True; 
    else 
        d->curr->isfloat=False; 
    tile(d); 
    focus(d->curr, d); 
}
 

x

Custom_layout(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**  
 * Vertical grid with cols = given number of colons 
 * n -      num window 
 * rows -   num rows 
 * cols -   num cols (works with 2, more who knows?) 
 * ch -     available height without top gap 
 * cw -     available width without left gap 
 */ 
void vertgrid(int x, int y, int w, int h, const Desktop *d) {
    int n = 0, cols = 2, cn = 0, rn = 0, i = -1;
    for (Client *c = d->head; c; c = c->next) if (!ISFFT(c)) ++n;
    if (n == 0) return; //else if (n == 5) cols = 2;

    int rows = (n%cols)? n/cols+1: n/cols, ch = h - USELESSGAP, cw = (w - USELESSGAP)/cols;
    for (Client *c = d->head; c; c = c->next) {
        if (ISFFT(c)) continue; else ++i;
        if (i==n-1 && n%cols) XMoveResizeWindow(dis, c->win, x + cn*cw + USELESSGAP, y + rn*ch/rows + USELESSGAP,
                   cw * cols - 2*BORDER_WIDTH - USELESSGAP, ch/rows - 2*BORDER_WIDTH - USELESSGAP);
        else XMoveResizeWindow(dis, c->win, x + cn*cw + USELESSGAP, y + rn*ch/rows + USELESSGAP,
                   cw - 2*BORDER_WIDTH - USELESSGAP, ch/rows - 2*BORDER_WIDTH - USELESSGAP);
        if (++cn >= cols) { cn = 0; rn++; }
    }
}
 

x

Colorinfo.sh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/sh

. ~/Documenti/colors.sh

echo "\033[0;30m ██\033[1;30m██\033[0m $(whoami)@$(uname -n)"
echo "\033[0;31m ██\033[1;31m██\033[0m $(cat /usr/lib/os-release | sed '/PRETTY_NAME/!d;s/[^=]*=//;s/"//g')"
echo "\033[0;32m ██\033[1;32m██\033[0m $(uname -r)"
echo "\033[0;33m ██\033[1;33m██\033[0m $(cat /proc/cpuinfo | grep 'model name' | sed '1!d;s/.*: //')"
echo "\033[0;34m ██\033[1;34m██\033[0m $(glxinfo | sed '/OpenGL renderer/!d;s/.*: //')"
echo "\033[0;35m ██\033[1;35m██\033[0m $(xrandr | sed '/current/!d;s/.*current \([0-9x\ ]*\).*/\1/;s/ //g')"
echo "\033[0;36m ██\033[1;36m██\033[0m $(cat ~/.Xresources | sed '/font/!d;s/.*:[\ ]*-[a-z0-9]*-\([a-z0-9]*\).*/\1/' | sed '1!d')"  # Works only with the bitmap fonts format (xlsonts)
echo "\033[0;37m ██\033[1;37m██\033[0m $(cat $HOME/.mywm)" # this is generated by a script to choose the wm
 

x

Fix_to_moveresize(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
/**
 * move and resize a window with the keyboard
 */
void moveresize(const Arg *arg) {
    Desktop *d = &desktops[currdeskidx];
    XWindowAttributes wa;
    if (!d->curr || !XGetWindowAttributes(dis, d->curr->win, &wa)) return;
    if (!d->curr->isfloat && !d->curr->istrans) { d->curr->isfloat = True; tile(d); focus(d->curr, d); }
    XMoveResizeWindow(dis, d->curr->win, wa.x + ((int *)arg->v)[0], wa.y + ((int *)arg->v)[1],
                                (wa.width + ((int *)arg->v)[2] <= MINWSZ)?wa.width:wa.width + ((int *)arg->v)[2], /* I edited this line */                        
                                (wa.height + ((int *)arg->v)[3] <= MINWSZ)?wa.height:wa.height + ((int *)arg->v)[3]); /* and this one because wm 
* closed when shrinking a window too small. 
* I've just added the check for MINWSZ which was missing
*/
}
 

x

Notes

Trying a setup without the bar but with thick borders and gaps. I love monsterwm, it’s so light, functional and easy to customize! If you want a config file just ask :)

tty-clock, ncmpcpp (music), rtv (reddit viewer), vim, feh (image viewer) and a custom info script

Colorscheme here -> http://dotshare.it/dots/1034/