1. /* see LICENSE for copyright and license */
  2. #include <X11/XF86keysym.h>
  3.  
  4. #ifndef CONFIG_H
  5. #define CONFIG_H
  6.  
  7. /* Button definitions, nothing to edit for you */
  8. #define MOD1            Mod1Mask    /* ALT key */
  9. #define MOD4            Mod4Mask    /* Super/Windows key */
  10. #define CONTROL         ControlMask /* Control key */
  11. #define SHIFT           ShiftMask   /* Shift key */
  12.  
  13. /* EDIT THIS: general settings */
  14. #define MASTER_SIZE     0.52       /* master-stack ratio */
  15. #define SHOW_PANEL      True     /* show panel by default on exec */
  16. #define TOP_PANEL       True      /* False mean panel is on bottom */
  17. #define PANEL_HEIGHT    14        /* 0 for no space for panel, thus no panel */
  18. #define DEFAULT_MODE    TILE      /* TILE MONOCLE BSTACK GRID FIBONACCI EQUAL */
  19. #define ATTACH_ASIDE    True      /* False means new window is master */
  20. #define FOLLOW_MOUSE    False     /* Focus the window the mouse just entered */
  21. #define FOLLOW_WINDOW   False     /* Follow the window when moved to a different desktop */
  22. #define CLICK_TO_FOCUS  True      /* Focus an unfocused window when clicked */
  23. #define BORDER_WIDTH    2         /* window border width */
  24. #define FOCUS           "#cccccc" /* focused window border color   */
  25. #define UNFOCUS         "#121212" /* unfocused window border color */
  26. #define DESKTOPS        6        /* number of desktops - edit DESKTOPCHANGE keys to suit */
  27. #define DEFAULT_DESKTOP 0         /* the desktop to focus on exec */
  28. #define MINWSZ          50        /* minimum window size in pixels */
  29. #define USELESSGAP      4         /* the size of the useless gap in pixels */
  30. #define GLOBALGAPS      True      /* use the same gap size on all desktops */
  31. #define MONOCLE_BORDERS False     /* display borders in monocle mode */
  32. #define INVERT          False     /* use alternative modes by default */
  33. #define AUTOCENTER      True      /* automatically center windows floating by default */
  34.  
  35. /*
  36.  * EDIT THIS: applicaton specific rules
  37.  * Open applications to specified desktop with specified mode.
  38.  * If desktop is negative, then current is assumed. Desktops are 0-indexed.
  39.  * Sadly, this can not be empty (for now), so enter something non-existent if
  40.  * you do not wish to use this functionality
  41.  */
  42. static const AppRule rules[] = { \
  43.     /*  class     desktop  follow  float */
  44.     { "MPlayer",     3,    True,   False },
  45.     { "surf",        3,    True,   False },
  46.     { "Gimp",        0,    False,  True  },
  47.     { "weechat",     2,    False,   False },    
  48.     { "cmus",        2,    False,   False },    
  49.     { "Dwb",         1,    True,  False },
  50.     { "ranger",     -1,    False,   True },    
  51.     { "sxiv",       -1,    False,   True },    
  52.     { "mpv",        -1,    False,   True },
  53.     { "9menu",      -1,    False,   True },
  54. };
  55.  
  56. /* helper for spawning shell commands, usually you don't edit this */
  57. #define SHCMD(cmd) {.com = (const char*[]){"/bin/sh", "-c", cmd, NULL}}
  58.  
  59. /*
  60.  * EDIT THIS: commands
  61.  * Adjust and add these to the shortcuts below to launch anything you want by
  62.  * pressing a key (combination). The last argument should ALWAYS be a null
  63.  * pointer.
  64.  */
  65. static const char *termcmd[] = { "termite",     NULL };
  66. static const char *webcmd[] = { "dwb",     NULL };
  67. static const char *filecmd[] = { "rclick.menu", NULL };
  68. static const char *menucmd[] = { "dmenu-recent", NULL };
  69. static const char *autostartcmd[]       = { "autostart",  NULL };
  70. static const char *calccmd[] = { "dmenu-calc", NULL };
  71. static const char *twitchcmd[] = { "dmenu-twitch", NULL };
  72. static const char *wallcmd[] = { "dmenu-wall", NULL };
  73. static const char *playcmd[]       = { "cmus-remote", "-u", NULL };
  74. static const char *stopcmd[]       = { "cmus-remote", "-s", NULL };
  75. static const char *pausecmd[]      = { "cmus-remote", "-p", NULL };
  76. static const char *nextcmd[]       = { "cmus-remote", "-n", NULL };
  77. static const char *prevcmd[]       = { "cmus-remote", "-r", NULL };
  78. static const char *volupcmd[]       = { "exec", "amixer", "-q", "set", "PCM", "2dB+", "unmute", NULL };
  79. static const char *voldncmd[]       = { "exec", "amixer", "-q", "set", "PCM", "2dB-", "unmute", NULL };
  80. static const char *volmutecmd[]       = { "exec", "amixer", "-q", "set", "Master", "toggle", NULL };
  81.  
  82. #define DESKTOPCHANGE(K,N) \
  83.     {  MOD4,             K,              change_desktop, {.i = N}}, \
  84.     {  MOD4|ShiftMask,   K,              client_to_desktop, {.i = N}},
  85.  
  86. /*
  87.  * EDIT THIS: shortcuts
  88.  * By default, all shortcuts use only Mod4 (+ Shift/Control), but you can use
  89.  * Mod1 as well if you like to, I just prefer not to. (Update: handling
  90.  * floating windows makes more sense when using Mod1 as well, so there's that)
  91.  */
  92. static key keys[] = {
  93.     /* modifier          key            function           argument */
  94.  
  95.     /* select windows */
  96.     {  MOD4,             XK_j,          next_win,          {NULL}},
  97.     {  MOD4,             XK_k,          prev_win,          {NULL}},
  98.     /* select the master window, or the previously focussed slave */
  99.     {  MOD4|SHIFT,       XK_w,          focusmaster,       {NULL}},
  100.     /* select urgent window */
  101.     {  MOD4,             XK_BackSpace,  focusurgent,       {NULL}},
  102.  
  103.     /* move windows */
  104.     {  MOD4|SHIFT,       XK_j,          move_down,         {NULL}},
  105.     {  MOD4|SHIFT,       XK_k,          move_up,           {NULL}},
  106.     /* swap the current window to master */
  107.     {  MOD4|SHIFT,       XK_Return,     swap_master,       {NULL}},
  108.     /* maximize the current window */
  109.     {  MOD4,             XK_f,          maximize,          {NULL}},
  110.     /* minimize window to queue/pull window from queue */
  111.     {  MOD4,             XK_m,          minimize,          {NULL}},
  112.     {  MOD4,             XK_n,          restore,           {NULL}},
  113.     /* move the current window to the center of the screen, floating */
  114.     {  MOD4|SHIFT,       XK_c,          centerwindow,      {NULL}},
  115.     /* toggles inverted stacking modes (left/top stack) */
  116.     {  MOD4|SHIFT,       XK_i,          invertstack,       {NULL}},
  117.     /* show/hide all windows on all desktops */
  118.     {  MOD4|SHIFT,       XK_s,          showhide,          {NULL}},
  119.  
  120.     /* move floating windows */
  121.     {  MOD4|MOD1,        XK_j,          float_y,           {.i = +10}},
  122.     {  MOD4|MOD1,        XK_k,          float_y,           {.i = -10}},
  123.     {  MOD4|MOD1,        XK_h,          float_x,           {.i = -10}},
  124.     {  MOD4|MOD1,        XK_l,          float_x,           {.i = +10}},
  125.     /* resize floating windows */
  126.     {  MOD4|MOD1|CONTROL,XK_j,          resize_y,          {.i = +10}},
  127.     {  MOD4|MOD1|CONTROL,XK_k,          resize_y,          {.i = -10}},
  128.     {  MOD4|MOD1|CONTROL,XK_h,          resize_x,          {.i = -10}},
  129.     {  MOD4|MOD1|CONTROL,XK_l,          resize_x,          {.i = +10}},
  130.     /* reset the selected floating window to tiling */
  131.     {  MOD4,             XK_t,          tilemize,          {NULL}},
  132.  
  133.     /* mode selection */
  134.     {  MOD4|SHIFT,       XK_t,          switch_mode,       {.i = TILE}},
  135.     {  MOD4|SHIFT,       XK_m,          switch_mode,       {.i = MONOCLE}},
  136.     {  MOD4|SHIFT,       XK_b,          switch_mode,       {.i = BSTACK}},
  137.     {  MOD4|SHIFT,       XK_g,          switch_mode,       {.i = GRID}},
  138.     {  MOD4|SHIFT,       XK_f,          switch_mode,       {.i = FIBONACCI}},
  139.     {  MOD4|SHIFT,       XK_d,          switch_mode,       {.i = DUALSTACK}},
  140.     {  MOD4|SHIFT,       XK_e,          switch_mode,       {.i = EQUAL}},
  141.  
  142.     /* spawn terminal, dmenu, w/e you want to */
  143.     {  MOD4,             XK_Return,     spawn,             {.com = termcmd}},
  144.     {  MOD4,             XK_r,          spawn,             {.com = menucmd}},
  145.     {  MOD4,             XK_a,          spawn,             {.com = autostartcmd}},
  146.     {  MOD4,             XK_q,          spawn,             {.com = menucmd}},
  147.     {  MOD4,             XK_s,          spawn,             {.com = twitchcmd}},
  148.     {  MOD4,             XK_d,          spawn,             {.com = webcmd}},
  149.     {  MOD4,             XK_c,          spawn,             {.com = calccmd}},
  150.     {  MOD4,             XK_w,          spawn,             {.com = wallcmd}},
  151.     {  0,      XF86XK_AudioPlay,        spawn,             {.com = playcmd}},
  152.     {  0,      XF86XK_AudioPause,       spawn,             {.com = pausecmd}},
  153.     {  0,      XF86XK_AudioNext,        spawn,             {.com = nextcmd}},
  154.     {  0,      XF86XK_AudioPrev,        spawn,             {.com = prevcmd}},
  155.     {  0,      XF86XK_AudioStop,        spawn,             {.com = stopcmd}},
  156.     {  0,      XF86XK_AudioRaiseVolume,        spawn,             {.com = volupcmd}},
  157.     {  0,      XF86XK_AudioLowerVolume,        spawn,             {.com = voldncmd}},
  158.     {  0,      XF86XK_AudioMute,        spawn,             {.com = volmutecmd}},
  159.     {  0,      XF86XK_Launch1,        spawn,             {.com = filecmd}},
  160.     /* kill current window */
  161.     {  MOD4|SHIFT,       XK_q,          killclient,        {NULL}},
  162.  
  163.     /* desktop selection */
  164.        DESKTOPCHANGE(    XK_1,                             0)
  165.        DESKTOPCHANGE(    XK_2,                             1)
  166.        DESKTOPCHANGE(    XK_3,                             2)
  167.        DESKTOPCHANGE(    XK_4,                             3)
  168.        DESKTOPCHANGE(    XK_5,                             4)
  169.        DESKTOPCHANGE(    XK_6,                             5)
  170.     /* toggle to last desktop */
  171.     {  MOD4,             XK_Tab,        last_desktop,      {NULL}},
  172.     /* jump to the next/previous desktop */
  173.     {  MOD4|CONTROL,     XK_h,          rotate,            {.i = -1}},
  174.     {  MOD4|CONTROL,     XK_l,          rotate,            {.i = +1}},
  175.     /* jump to the next/previous desktop with windows */
  176.     {  MOD4|CONTROL|SHIFT, XK_h,        rotate_filled,     {.i = -1}},
  177.     {  MOD4|CONTROL|SHIFT, XK_l,        rotate_filled,     {.i = +1}},
  178.  
  179.     /* resize master/first stack window */
  180.     {  MOD4,             XK_h,          resize_master,     {.i = -10}},
  181.     {  MOD4,             XK_l,          resize_master,     {.i = +10}},
  182.     {  MOD4,             XK_o,          resize_stack,      {.i = -10}},
  183.     {  MOD4,             XK_p,          resize_stack,      {.i = +10}},
  184.  
  185.     /* resize the borders */
  186.     {  MOD4|CONTROL,     XK_u,          adjust_borders,    {.i = -1}},
  187.     {  MOD4|CONTROL,     XK_i,          adjust_borders,    {.i = +1}},
  188.     /* resize the useless gaps between the windows */
  189.     {  MOD4|CONTROL,     XK_o,          adjust_gaps,       {.i = -1}},
  190.  
  191.  
  192.  
  193.     {  MOD4|CONTROL,     XK_p,          adjust_gaps,       {.i = +1}},
  194.     /* toggle the panel space */
  195.     {  MOD4|CONTROL,     XK_b,          togglepanel,       {NULL}},
  196.  
  197.     /* exit */
  198.     {  MOD4|CONTROL,     XK_q,          quit,              {.i = 0}},
  199. };
  200.  
  201. /* EDIT THIS: mouse-based shortcuts */
  202. static Button buttons[] = {
  203.     /* move/resize using the mouse */
  204.     {  MOD4,    Button1,     mousemotion,   {.i = MOVE}},
  205.     {  MOD4,    Button3,     mousemotion,   {.i = RESIZE}},
  206. };
  207. #endif