dwm

dynamic window manager
git clone https://git.parazyd.org/dwm
Log | Files | Refs | README | LICENSE

config.h (9534B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #include <X11/XF86keysym.h>
      4 
      5 /* appearance */
      6 static const unsigned int borderpx  = 1;        /* border pixel of windows */
      7 static const unsigned int snap      = 32;       /* snap pixel */
      8 static const unsigned int systraypinning = 0;
      9 static const unsigned int systrayonleft = 0;
     10 static const unsigned int systrayspacing = 2;
     11 static const int systraypinningfailfirst = 1;
     12 static const int showsystray = 1;
     13 static const int showbar            = 1;        /* 0 means no bar */
     14 static const int topbar             = 1;        /* 0 means bottom bar */
     15 static const char *fonts[] = { "Iosevka Term:size=8" };
     16 static const char dmenufont[]       = "Iosevka Term:size=12";
     17 static const char col_gray1[]       = "#222222";
     18 static const char col_gray2[]       = "#444444";
     19 static const char col_gray3[]       = "#bbbbbb";
     20 static const char col_gray4[]       = "#eeeeee";
     21 static const char col_cyan[]        = "#007791";
     22 static const char *colors[][3]      = {
     23 	/*               fg         bg         border   */
     24 	[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
     25 	[SchemeSel]  = { col_gray4, col_cyan,  col_cyan  },
     26 };
     27 
     28 /* tagging */
     29 static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
     30 
     31 static const Rule rules[] = {
     32 	/* xprop(1):
     33 	 *	WM_CLASS(STRING) = instance, class
     34 	 *	WM_NAME(STRING) = title
     35 	 */
     36 	/* class      instance    title       tags mask     isfloating   monitor */
     37 	{ "feh",          NULL,       NULL,       0,            1,           -1 },
     38 	{ "mpv",          NULL,       NULL,       0,            1,           -1 },
     39 	{ "pinentry-qt5", NULL,       NULL,       0,            1,           -1 },
     40 	{ "pinentry",     NULL,       NULL,       0,            1,           -1 },
     41 };
     42 
     43 /* layout(s) */
     44 static const float mfact     = 0.55; /* factor of master area size [0.05..0.95] */
     45 static const int nmaster     = 1;    /* number of clients in master area */
     46 static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
     47 static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
     48 
     49 static const Layout layouts[] = {
     50 	/* symbol     arrange function */
     51 	{ "[t]",      tile },    /* first entry is default */
     52 	{ "[f]",      NULL },    /* no layout function means floating behavior */
     53 	{ "[m]",      monocle },
     54 	{ "|||",      col },
     55 };
     56 
     57 /* key definitions */
     58 #define MODKEY Mod4Mask
     59 #define TAGKEYS(KEY,TAG) \
     60 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     61 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     62 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     63 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
     64 
     65 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     66 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
     67 
     68 /* commands */
     69 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
     70 static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
     71 static const char *termcmd[]  = { "st", NULL };
     72 static const char *termcmdbig[]  = { "st", "-f", "Iosevka Term:size=17:antialias=true:autohint=true", NULL };
     73 static const char scratchpadname[] = "scratchpad";
     74 static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL };
     75 
     76 static const char *uskeycmd[] = { "setxkbmap", "-layout", "us", NULL };
     77 static const char *rskeycmd[] = { "setxkbmap", "-layout", "rs", NULL };
     78 static const char *hrkeycmd[] = { "setxkbmap", "-layout", "hr", NULL };
     79 
     80 static const char *dmenupasscmd[] = { "dmenupass", NULL };
     81 static const char *glyphcmd[] = { "rofi", "-modi", "emoji", "-show", "emoji", "-dpi", "300", "-emoji-mode", "copy", NULL };
     82 static const char *mathglyphcmd[] = { "mathglyph", NULL };
     83 static const char *texglyphcmd[] = { "texglyph", NULL };
     84 static const char *dunstclosecmd[] = { "dunstctl", "close", NULL };
     85 
     86 static const char *wpvolup[] = { "alsavol", "+", NULL };
     87 static const char *wpvoldn[] = { "alsavol", "-", NULL };
     88 static const char *wpspkmt[] = { "alsavol", "spk-toggle", NULL };
     89 static const char *wpmicmt[] = { "alsavol", "mic-toggle", NULL };
     90 
     91 #include "focusurgent.c"
     92 #include "movestack.c"
     93 
     94 static const Key keys[] = {
     95 	/* modifier                     key        function        argument */
     96 	{ MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
     97 	{ MODKEY,                       XK_Return, spawn,          {.v = termcmd } },
     98 	{ MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmdbig } },
     99 	{ MODKEY,                       XK_F1,     spawn,          {.v = uskeycmd } },
    100 	{ MODKEY,                       XK_F2,     spawn,          {.v = rskeycmd } },
    101 	{ MODKEY,                       XK_F3,     spawn,          {.v = hrkeycmd } },
    102 	{ MODKEY,                       XK_F8,     spawn,          {.v = glyphcmd } },
    103 	{ MODKEY,                       XK_F9,     spawn,          {.v = mathglyphcmd } },
    104 	{ MODKEY|ShiftMask,             XK_F9,     spawn,          {.v = texglyphcmd } },
    105 	{ MODKEY,                       XK_F10,    spawn,          {.v = dmenupasscmd } },
    106 	{ MODKEY,                       XK_grave,  togglescratch,  {.v = scratchpadcmd } },
    107 	{ MODKEY,                       XK_space,  spawn,          {.v = dunstclosecmd } },
    108 
    109 	{ 0,                            XF86XK_AudioLowerVolume, spawn, {.v = wpvoldn } },
    110 	{ 0,                            XF86XK_AudioRaiseVolume, spawn, {.v = wpvolup } },
    111 	{ 0,                            XF86XK_AudioMute,        spawn, {.v = wpspkmt } },
    112 	{ 0,                            XF86XK_AudioMicMute,     spawn, {.v = wpmicmt } },
    113 
    114 	{ MODKEY,                       XK_b,      togglebar,      {0} },
    115 	{ MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
    116 	{ MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
    117 	{ MODKEY,                       XK_i,      incnmaster,     {.i = +1 } },
    118 	{ MODKEY,                       XK_d,      incnmaster,     {.i = -1 } },
    119 	{ MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    120 	{ MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    121 	{ MODKEY|ShiftMask,             XK_j,      movestack,      {.i = +1 } },
    122 	{ MODKEY|ShiftMask,             XK_k,      movestack,      {.i = -1 } },
    123 	// { MODKEY,                       XK_Return, zoom,           {0} },
    124 	{ MODKEY,                       XK_Tab,    view,           {0} },
    125 	{ MODKEY|ShiftMask,             XK_c,      killclient,     {0} },
    126 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
    127 	{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
    128 	{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
    129 	{ MODKEY,                       XK_c,      setlayout,      {.v = &layouts[3]} },
    130 	// { MODKEY,                       XK_space,  setlayout,      {0} },
    131 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    132 	// { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    133 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    134 	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    135 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    136 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    137 	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    138 	{ MODKEY,                       XK_Left,   viewtoleft,     {0} },
    139 	{ MODKEY,                       XK_Right,  viewtoright,    {0} },
    140 	TAGKEYS(                        XK_1,                      0)
    141 	TAGKEYS(                        XK_2,                      1)
    142 	TAGKEYS(                        XK_3,                      2)
    143 	TAGKEYS(                        XK_4,                      3)
    144 	TAGKEYS(                        XK_5,                      4)
    145 	TAGKEYS(                        XK_6,                      5)
    146 	TAGKEYS(                        XK_7,                      6)
    147 	TAGKEYS(                        XK_8,                      7)
    148 	TAGKEYS(                        XK_9,                      8)
    149 	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
    150 	{ MODKEY,                       XK_u,      focusurgent,    {0} },
    151 };
    152 
    153 /* button definitions */
    154 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    155 static Button buttons[] = {
    156 	/* click                event mask      button          function        argument */
    157 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    158 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    159 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
    160 	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
    161 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    162 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    163 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    164 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    165 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    166 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    167 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    168 };
    169