apoorv569

Config.h (DWM)

Jun 5th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 9.25 KB | None | 0 0
  1. /* See LICENSE file for copyright and license details. */
  2.  
  3. /* appearance */
  4. static const unsigned int borderpx  = 3;        /* border pixel of windows */
  5. static const unsigned int gappx     = 5;        /* gaps between windows */
  6. static const unsigned int snap      = 32;       /* snap pixel */
  7. static const unsigned int systraypinning = 0;   /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */
  8. static const unsigned int systrayspacing = 2;   /* systray spacing */
  9. static const int systraypinningfailfirst = 1;   /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/
  10. static const int showsystray        = 1;     /* 0 means no systray */
  11. static const int showbar            = 1;        /* 0 means no bar */
  12. static const int topbar             = 1;        /* 0 means bottom bar */
  13. static const int user_bh            = 26;        /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
  14. static const char *fonts[]          = { "monospace:size=10" };
  15. static const char dmenufont[]       = "monospace:size=10";
  16. static const char col_gray1[]       = "#222222";
  17. static const char col_gray2[]       = "#444444";
  18. static const char col_gray3[]       = "#bbbbbb";
  19. static const char col_gray4[]       = "#eeeeee";
  20. static const char col_cyan[]        = "#23685B";        // active window border and title on statusbar
  21. static const char *colors[][3]      = {
  22.     /*               fg         bg         border   */
  23.     [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
  24.     [SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
  25. };
  26.  
  27. /* tagging */
  28. static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
  29.  
  30. static const Rule rules[] = {
  31.     /* xprop(1):
  32.      *  WM_CLASS(STRING) = instance, class
  33.      *  WM_NAME(STRING) = title
  34.      */
  35.     /* class      instance    title       tags mask     isfloating   monitor */
  36.     { "Gimp",     NULL,       NULL,       0,            1,           -1 },
  37.     { "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
  38. };
  39.  
  40. /* layout(s) */
  41. static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
  42. static const int nmaster     = 1;    /* number of clients in master area */
  43. static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
  44.  
  45. static const Layout layouts[] = {
  46.     /* symbol     arrange function */
  47.     { "[]=",      tile },    /* first entry is default */
  48.     { "><>",      NULL },    /* no layout function means floating behavior */
  49.     { "[M]",      monocle },
  50.     { "|M|",      centeredmaster },
  51.     { ">M>",      centeredfloatingmaster },
  52. };
  53.  
  54. /* key definitions */
  55. #define MODKEY Mod4Mask
  56. #define ALT Mod1Mask
  57. #define TAGKEYS(KEY,TAG) \
  58.     { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
  59.     { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
  60.     { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
  61.     { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
  62.  
  63. /* helper for spawning shell commands in the pre dwm-5.0 fashion */
  64. #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
  65.  
  66. /* commands */
  67. static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
  68. static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
  69. static const char *termcmd[]  = { "st", NULL };
  70.  
  71. /* commands spawned when clicking statusbar, the mouse button pressed is exported as BUTTON */
  72. static char *statuscmds[] = { "notify-send Mouse$BUTTON" };
  73. static char *statuscmd[] = { "/bin/sh", "-c", NULL, NULL };
  74.  
  75. #include <X11/XF86keysym.h>
  76.  
  77. static Key keys[] = {
  78.     /* modifier                     key        function        argument */
  79.     { ALT,                          XK_Return, spawn,          {.v = dmenucmd } },
  80.     { MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
  81.     { MODKEY,                       XK_b,      togglebar,      {0} },
  82.     { MODKEY|ShiftMask,             XK_j,      rotatestack,    {.i = +1 } },
  83.     { MODKEY|ShiftMask,             XK_k,      rotatestack,    {.i = -1 } },
  84.     { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
  85.     { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
  86.     { MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
  87.     { MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
  88.     { MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
  89.     { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
  90.     { MODKEY|ShiftMask,             XK_Return, zoom,           {0} },
  91.     { MODKEY,                       XK_Tab,    view,           {0} },
  92.     { MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
  93.     { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
  94.     { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
  95.     { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
  96.     { MODKEY,                       XK_u,      setlayout,      {.v = &layouts[3]} },
  97.     { MODKEY,                       XK_o,      setlayout,      {.v = &layouts[4]} },
  98.     { MODKEY,                       XK_space,  setlayout,      {0} },
  99.     { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
  100.     { MODKEY,                       XK_s,      togglesticky,   {0} },
  101.     { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
  102.     { MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
  103.     { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
  104.     { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
  105.     { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
  106.     { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
  107.     { MODKEY,                       XK_minus,  setgaps,        {.i = -1 } },
  108.     { MODKEY,                       XK_equal,  setgaps,        {.i = +1 } },
  109.     { MODKEY|ShiftMask,             XK_equal,  setgaps,        {.i = 0  } },
  110.     TAGKEYS(                        XK_1,                      0)
  111.     TAGKEYS(                        XK_2,                      1)
  112.     TAGKEYS(                        XK_3,                      2)
  113.     TAGKEYS(                        XK_4,                      3)
  114.     TAGKEYS(                        XK_5,                      4)
  115.     TAGKEYS(                        XK_6,                      5)
  116.     TAGKEYS(                        XK_7,                      6)
  117.     TAGKEYS(                        XK_8,                      7)
  118.     TAGKEYS(                        XK_9,                      8)
  119.     { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
  120.     { MODKEY|ControlMask|ShiftMask, XK_q,      quit,           {1} },
  121.  
  122. ///////////////////////////////////////////////// LAPTOP Fn KEYS ///////////////////////////////////////////////    
  123.    
  124.     { 0 ,XF86XK_AudioMute,                     spawn,          SHCMD("pactl set-sink-mute @DEFAULT_SINK@ toggle && pkill -RTMIN+10 dwmblocks") },
  125.     { 0 ,XF86XK_AudioRaiseVolume,              spawn,          SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +2% && pkill -RTMIN+10 dwmblocks") },
  126.     { 0 ,XF86XK_AudioLowerVolume,              spawn,          SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -2% && pkill -RTMIN+10 dwmblocks") },
  127.     { 0 ,XF86XK_MonBrightnessUp,               spawn,          SHCMD("xbacklight -inc 10 && pkill -RTMIN+11 dwmblocks") },
  128.     { 0 ,XF86XK_MonBrightnessDown,             spawn,          SHCMD("xbacklight -dec 10 && pkill -RTMIN+11 dwmblocks") },
  129.     { 0 ,XF86XK_AudioPlay,                     spawn,          SHCMD("playerctl -a play") },
  130.     { 0 ,XF86XK_AudioPause,                    spawn,          SHCMD("playerctl -a pause") },
  131.  
  132. };
  133.  
  134. /* button definitions */
  135. /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
  136. static Button buttons[] = {
  137.     /* click                event mask      button          function        argument */
  138.     { ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
  139.     { ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
  140.     { ClkWinTitle,          0,              Button2,        zoom,           {0} },
  141.     { ClkStatusText,        0,              Button1,        spawn,          {.v = statuscmd } },
  142.     { ClkStatusText,        0,              Button2,        spawn,          {.v = statuscmd } },
  143.     { ClkStatusText,        0,              Button3,        spawn,          {.v = statuscmd } },
  144.     { ClkStatusText,        0,              Button1,        sigdwmblocks,   {.i = 1} },
  145.     { ClkStatusText,        0,              Button2,        sigdwmblocks,   {.i = 2} },
  146.     { ClkStatusText,        0,              Button3,        sigdwmblocks,   {.i = 3} },
  147.     { ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
  148.     { ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
  149.     { ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
  150.     { ClkTagBar,            0,              Button1,        view,           {0} },
  151.     { ClkTagBar,            0,              Button3,        toggleview,     {0} },
  152.     { ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
  153.     { ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
  154. };
Add Comment
Please, Sign In to add comment