dotfiles

personal configuration files and scripts
git clone https://tongong.net/git/dotfiles.git
Log | Files | Refs | README

config.h (11186B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* appearance */
      4 static const unsigned int borderpx  = 2;        /* border pixel of windows */
      5 static const unsigned int snap      = 32;       /* snap pixel */
      6 static const int swallowfloating    = 0;        /* 1 means swallow floating windows by default */
      7 static const unsigned int gappih    = 12;       /* horiz inner gap between windows */
      8 static const unsigned int gappiv    = 12;       /* vert inner gap between windows */
      9 static const unsigned int gappoh    = 12;       /* horiz outer gap between windows and screen edge */
     10 static const unsigned int gappov    = 12;       /* vert outer gap between windows and screen edge */
     11 static const int smartgaps          = 0;        /* 1 means no outer gap when there is only one window */
     12 static const int showbar            = 1;        /* 0 means no bar */
     13 static const int topbar             = 1;        /* 0 means bottom bar */
     14 static const char *fonts[]          = { "FiraCode Nerd Font:size=10" };
     15 static const char col_gray[]        = "#242424";
     16 static const char col_white[]       = "#FFFFFF";
     17 static const char col_green[]       = "#4CAF50";
     18 static const char col1[]            = "#ffffff";
     19 static const char col2[]            = "#ffffff";
     20 static const char col3[]            = "#ffffff";
     21 static const char col4[]            = "#ffffff";
     22 static const char col5[]            = "#ffffff";
     23 static const char col6[]            = "#ffffff";
     24 static const char col7[]            = "#ffffff";
     25 static const char col8[]            = "#ffffff";
     26 static const char col9[]            = "#ffffff";
     27 static const char col10[]           = "#ffffff";
     28 static const char col11[]           = "#ffffff";
     29 static const char col12[]           = "#ffffff";
     30 static const char *colors[][3]      = {
     31 	/*               fg         bg         border   */
     32 	[SchemeNorm] = { col_white, col_gray, col_gray },
     33 	[SchemeSel]  = { col_gray, col_green,  col_green  },
     34 	[SchemeBar]  = { col_green, col_green,  col_green  }, // Dirty workaround lol
     35 	[SchemeCol1]  = { col1,      col_gray, col_gray },
     36 	[SchemeCol2]  = { col2,      col_gray, col_gray },
     37 	[SchemeCol3]  = { col3,      col_gray, col_gray },
     38 	[SchemeCol4]  = { col4,      col_gray, col_gray },
     39 	[SchemeCol5]  = { col5,      col_gray, col_gray },
     40 	[SchemeCol6]  = { col6,      col_gray, col_gray },
     41 	[SchemeCol7]  = { col7,      col_gray, col_gray },
     42 	[SchemeCol8]  = { col8,      col_gray, col_gray },
     43 	[SchemeCol9]  = { col8,      col_gray, col_gray },
     44 	[SchemeCol10] = { col10,     col_gray, col_gray },
     45 	[SchemeCol11] = { col11,     col_gray, col_gray },
     46 	[SchemeCol12] = { col12,     col_gray, col_gray },
     47 };
     48 
     49 /* tagging */
     50 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     51 
     52 static const Rule rules[] = {
     53 	/* xprop(1):
     54 	 *	WM_CLASS(STRING) = instance, class
     55 	 *	WM_NAME(STRING) = title
     56 	 */
     57 	/* class     instance   title   tags mask  isfloating  isterminal  noswallow  monitor */
     58     { "Dragon-drag-and-drop", NULL, NULL, -1,  1,          0,          0,         -1 },
     59 	{ "st-256color", NULL,  NULL,   0,         0,          1,          0,         -1 },
     60 	{ NULL,      NULL,     "Event Tester", 0,  0,          0,          1,         -1 }, /* xev */
     61 };
     62 
     63 /* layouts */
     64 static const float mfact     = 0.5;  /* factor of master area size [0.05..0.95] */
     65 static const int nmaster     = 1;    /* number of clients in master area */
     66 static const int resizehints = 0;    /* 1 means respect size hints in tiled resizals */
     67 
     68 static const Layout layouts[] = {
     69 	/* symbol     arrange function */
     70 	{ "[]=",      tile },    // master-and-stack
     71 	{ "><>",      NULL },    // floating
     72 	{ "[M]",      monocle }, // monocle
     73 };
     74 
     75 /* key definitions */
     76 #define MODKEY Mod4Mask // Super-Key
     77 #define TAGKEYS(KEY,TAG) \
     78 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     79 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} },
     80 // first:  Change active tag
     81 // second: Send window to tag
     82 
     83 /* commands */
     84 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
     85 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
     86 static const char *termcmd[]  = { "st", NULL };
     87 static const char *samedirtermcmd[]  = { "samedir", NULL };
     88 static const char *clipmenucmd[]  = { "clipmenu", NULL };
     89 static const char *browsercmd[]  = { "firefox", NULL };
     90 static const char *editorcmd[]  = { "st", "-e", "nvim", NULL };
     91 static const char *filescmd[]  = { "st", "-e", "ranger", NULL };
     92 static const char *calculatorcmd[]  = { "st", "-e", "calc", NULL };
     93 static const char *screenshotwindowcmd[]  = { "screenshot-current", NULL };
     94 static const char *screenshotselectcmd[]  = { "screenshot-select", NULL };
     95 static const char *screenshotviewcmd[]  = { "sh", "-c", "sxiv ~/screenshots/*", NULL };
     96 static const char *volumeupcmd[]  = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "+5%", NULL };
     97 static const char *volumedowncmd[]  = { "pactl", "set-sink-volume", "@DEFAULT_SINK@", "-5%", NULL };
     98 static const char *volumemutecmd[]  = { "pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL };
     99 static const char *lockcmd[]  = { "slock", NULL };
    100 static const char *passmenucmd[]  = { "passmenu-plus", "--type", "-l", "10", NULL };
    101 static const char *settingscmd[]  = { "dmenu-settings", NULL };
    102 static const char *notificationcmd[]  = { "st", "-e", "less", "/tmp/notification-list", NULL };
    103 static const char *pausemusiccmd[]  = { "playerctl", "play-pause", NULL };
    104 static const char *notescmd[]  = { "st", "-e", "notes", NULL };
    105 static const char *newnotecmd[]  = { "dnote", NULL };
    106 static const char scratchpadname[] = "scratchpad";
    107 static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", "notes", NULL };
    108 
    109 static Key keys[] = {
    110 	/* modifier                     key        function        argument */
    111 	// commands
    112 	{ MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
    113 	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = samedirtermcmd } },
    114 	{ MODKEY,                       XK_r,      spawn,          {.v = dmenucmd } },
    115 	{ MODKEY,                       XK_v,      spawn,          {.v = clipmenucmd } },
    116 	{ MODKEY,                       XK_b,      spawn,          {.v = browsercmd } },
    117 	{ MODKEY,                       XK_e,      spawn,          {.v = editorcmd } },
    118 	{ MODKEY,                       XK_n,      spawn,          {.v = filescmd } },
    119 	{ MODKEY,                       XK_c,      spawn,          {.v = calculatorcmd } },
    120 	{ MODKEY,                       XK_p,      spawn,          {.v = screenshotwindowcmd } },
    121 	{ MODKEY|ShiftMask,             XK_p,      spawn,          {.v = screenshotselectcmd } },
    122 	{ MODKEY|ControlMask,           XK_p,      spawn,          {.v = screenshotviewcmd } },
    123 	{ MODKEY,                       XK_plus,   spawn,          {.v = volumeupcmd } },
    124 	{ MODKEY,                       XK_minus,  spawn,          {.v = volumedowncmd } },
    125 	{ MODKEY,                       XK_period, spawn,          {.v = volumemutecmd } },
    126 	{ MODKEY|ShiftMask,             XK_l,      spawn,          {.v = lockcmd } },
    127 	{ MODKEY|ShiftMask,             XK_d,      spawn,          {.v = passmenucmd } },
    128 	{ MODKEY,                       XK_s,      spawn,          {.v = settingscmd } },
    129 	{ MODKEY,                       XK_m,      spawn,          {.v = pausemusiccmd } },
    130 	{ MODKEY,                       XK_g,      togglescratch,  {.v = scratchpadcmd } },
    131 	{ MODKEY|ShiftMask,             XK_g,      spawn,          {.v = newnotecmd } },
    132 	// Rotate focus through windows
    133 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
    134 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
    135 	// Rotate windows
    136 	{ MODKEY|ShiftMask,             XK_j,      rotatestack,    {.i = +1 } },
    137 	{ MODKEY|ShiftMask,             XK_k,      rotatestack,    {.i = -1 } },
    138 	// Change width of master window
    139 	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    140 	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    141 	// Makes current window master (or first other if current window is master)
    142     //{ MODKEY|ShiftMask,             XK_Return, zoom,           {0} },
    143 	{ MODKEY,                       XK_space,  zoom,           {0} },
    144 	// Go to last active tag at the screen
    145 	{ MODKEY,                       XK_Tab,    view,           {0} },
    146 	// Set layouts
    147 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
    148 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
    149 	// { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
    150 	// Toggle last two layouts
    151 	// { MODKEY,                       XK_space,  setlayout,      {0} },
    152 	// Toggle floating/fullscreen of individual window
    153 	// { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    154 	{ MODKEY|ShiftMask,             XK_f,      togglefullscr,  {0} },
    155 	// show all windows of all tags
    156 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    157 	// Focus other screen
    158 	{ MODKEY,                       XK_u,      focusmon,       {.i = +1 } },
    159 	// Send current window to other screen (focus remains at the first screen)
    160 	{ MODKEY,                       XK_o,      tagmon,         {.i = +1 } },
    161 	// Close window
    162 	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
    163 	// see above
    164 	TAGKEYS(                        XK_1,                      0)
    165 	TAGKEYS(                        XK_2,                      1)
    166 	TAGKEYS(                        XK_3,                      2)
    167 	TAGKEYS(                        XK_4,                      3)
    168 	TAGKEYS(                        XK_5,                      4)
    169 	TAGKEYS(                        XK_6,                      5)
    170 	TAGKEYS(                        XK_7,                      6)
    171 	TAGKEYS(                        XK_8,                      7)
    172 	TAGKEYS(                        XK_9,                      8)
    173 	// Restart dwm
    174 	{ MODKEY|ShiftMask,             XK_q,      quit,           {1} },
    175 };
    176 
    177 /* button definitions */
    178 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    179 static Button buttons[] = {
    180 	/* click                event mask      button          function        argument */
    181 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} }, // Toggle Layout
    182 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} }, // Move window
    183 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} }, // Toggle window floating
    184 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} }, // Resize window
    185 	{ ClkTagBar,            0,              Button1,        view,           {0} }, // Select tag
    186 	{ ClkWinTitle,          0,              Button1,        spawn,          {.v = notificationcmd } }, // open notification history
    187 	// control dwmblocks
    188 	{ ClkStatusText,        0,              Button1,        sigdwmblocks,   {.i = 1} },
    189 	{ ClkStatusText,        0,              Button2,        sigdwmblocks,   {.i = 2} },
    190 	{ ClkStatusText,        0,              Button3,        sigdwmblocks,   {.i = 3} },
    191 };