dotfiles

My beautiful configs and dotfiles managed by Nix' home-manager
Log | Files | Refs | README | LICENSE

dwm.h (7062B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 #include <X11/XF86keysym.h>
      4 
      5 #include "theme.h"
      6 
      7 /* appearance */
      8 static const unsigned int borderpx = 2; /* border pixel of windows */
      9 static const unsigned int snap = 10;    /* snap pixel */
     10 static const int horizpadbar = 10;      /* horizontal padding for statusbar */
     11 static const int vertpadbar = 10;       /* vertical padding for statusbar */
     12 static const int showbar = 1;           /* 0 means no bar */
     13 static const int topbar = 1;            /* 0 means bottom bar */
     14 static const unsigned int systraypinning =
     15     0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor
     16           X */
     17 static const unsigned int systrayonleft =
     18     0; /* 0: systray in the right corner, >0: systray on left of status text */
     19 static const unsigned int systrayspacing = 2; /* systray spacing */
     20 static const int systraypinningfailfirst =
     21     1; /* 1: if pinning fails, display systray on the first monitor, False:
     22           display systray on the last monitor*/
     23 static const int showsystray = 1; /* 0 means no systray */
     24 static const char *fonts[] = {"Monaco:size=9"};
     25 static const char *colors__[][3] = { // dark
     26     /*               fg         bg         border   */
     27     [SchemeNorm]       = { white,   gray2,   gray2  },
     28     [SchemeSel]        = { blue,     gray3,   blue  },
     29     [SchemeUrg]        = { orange,  gray3,   red    },
     30     [3]                = { gray3, orange, gray2 },
     31     [4]                = { gray3,   green,   gray2  }
     32   };
     33 
     34 
     35 
     36 static const char *colors[][3] = { 
     37     /*               fg         bg         border   */
     38     [SchemeNorm]       = { "#000000", "#eaffea", "#9eeeee" },  // fg = white, bg = gray2, border = gray2
     39     [SchemeSel]        = { "#eaffea", "#448844", "#55aaaa" },  // fg = blue, bg = gray3, border = blue
     40     [SchemeUrg]        = { "#eaffea", "#999999", "#ff0000" },  // fg = orange (light green), bg = gray3, border = red
     41     [3]                = { "#999999", "#eaffea", "#cccccc" },  // fg = gray3, bg = orange (light green), border = gray2
     42     [4]                = { "#999999", "#448844", "#cccccc" }   // fg = gray3, bg = green, border = gray2
     43 };
     44 
     45 static const char dwmrc[] = ".dwmrc";
     46 
     47 /* tagging */
     48 static const char *tags[] = {"1", "2", "3", "4", "5"};
     49 
     50 static const Rule rules[] = {
     51     /* xprop(1):
     52      *	WM_CLASS(STRING) = instance, class
     53      *	WM_NAME(STRING) = title
     54      */
     55     /* class      instance    title       tags mask     isfloating   monitor */
     56     {"Firefox", NULL, NULL, 1 << 5, 0, -1},
     57 };
     58 
     59 /* layout(s) */
     60 static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
     61 static const int nmaster = 1;    /* number of clients in master area */
     62 static const int resizehints =
     63     1; /* 1 means respect size hints in tiled resizals */
     64 static const int lockfullscreen =
     65     1; /* 1 will force focus on the fullscreen window */
     66 
     67 static const Layout layouts[] = {
     68     /* symbol     arrange function */
     69     {"[]=", tile}, /* first entry is default */
     70     {"{ }", NULL}, /* no layout function means floating behavior */
     71     {"[o]", monocle},
     72 };
     73 
     74 /* key definitions */
     75 #define MODKEY Mod4Mask
     76 #define TAGKEYS(KEY, TAG)                                                      \
     77   {MODKEY, KEY, view, {.ui = 1 << TAG}},                                       \
     78       {MODKEY | ControlMask, KEY, toggleview, {.ui = 1 << TAG}},               \
     79       {MODKEY | ShiftMask, KEY, tag, {.ui = 1 << TAG}}, {                      \
     80     MODKEY | ControlMask | ShiftMask, KEY, toggletag, { .ui = 1 << TAG }       \
     81   }
     82 
     83 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     84 #define SHELL(cmd)                                                             \
     85   {                                                                            \
     86     .v = (const char *[]) { "/bin/sh", "-c", cmd, NULL }                       \
     87   }
     88 #define COMMAND(...)                                                           \
     89   {                                                                            \
     90     .v = (const char *[]) { __VA_ARGS__, NULL }                                \
     91   }
     92 #define BACKLIGHT(device, value)                                               \
     93   COMMAND("brightnessctl", "-q", "-d", device, "set", value)
     94 
     95 #define monitor_backlight "acpi_video0"
     96 #define keyboard_backlight "smc::kbd_backlight"
     97 
     98 static const Key keys[] = {
     99     /* modifier                     key        function        argument */
    100     {MODKEY, XK_Return, spawn, COMMAND("st")},
    101     {MODKEY | ShiftMask, XK_w, spawn, COMMAND("surf")},
    102     {MODKEY, XK_w, spawn, COMMAND("firefox")},
    103     {MODKEY, XK_space, spawn, COMMAND("dmenu_run")},
    104     {MODKEY, XK_m, spawn, SHELL("man -k . | dmenu -l 25 | cut -d' ' -f1-2 | sed -E 's/(\\S+) \\((\\S+)\\)/\\2 \\1/' | xargs st -f 'SF Mono' -e man -s")},
    105     {0, XF86XK_MonBrightnessUp, spawn, BACKLIGHT(monitor_backlight, "+5%")},
    106     {0, XF86XK_MonBrightnessDown, spawn, BACKLIGHT(monitor_backlight, "5%-")},
    107     {0, XF86XK_KbdBrightnessUp, spawn, BACKLIGHT(keyboard_backlight, "+5%")},
    108     {0, XF86XK_KbdBrightnessDown, spawn, BACKLIGHT(keyboard_backlight, "5%-")},
    109     {MODKEY, XK_o, spawn, COMMAND("dfm")},
    110     {MODKEY | ShiftMask, XK_o, spawn, COMMAND("dfm", "-c")},
    111     {MODKEY, XK_b, togglebar, {0}},
    112     {MODKEY, XK_j, focusstack, {.i = +1}},
    113     {MODKEY, XK_k, focusstack, {.i = -1}},
    114     {MODKEY, XK_i, incnmaster, {.i = +1}},
    115     {MODKEY, XK_d, incnmaster, {.i = -1}},
    116     {MODKEY, XK_Left, setmfact, {.f = -0.05}},
    117     {MODKEY, XK_Right, setmfact, {.f = +0.05}},
    118     {MODKEY | ShiftMask, XK_Return, zoom, {0}},
    119     {MODKEY, XK_Tab, view, {0}},
    120     {MODKEY, XK_q, killclient, {0}},
    121     {MODKEY | ControlMask, XK_comma, cyclelayout, {.i = -1}},
    122     {MODKEY | ControlMask, XK_period, cyclelayout, {.i = +1}},
    123     {MODKEY | ControlMask, XK_space, setlayout, {0}},
    124     {MODKEY | ShiftMask, XK_space, togglefloating, {0}},
    125     {MODKEY, XK_0, view, {.ui = ~0}},
    126     {MODKEY | ShiftMask, XK_0, tag, {.ui = ~0}},
    127     {MODKEY, XK_comma, focusmon, {.i = -1}},
    128     {MODKEY, XK_period, focusmon, {.i = +1}},
    129     {MODKEY | ShiftMask, XK_comma, tagmon, {.i = -1}},
    130     {MODKEY | ShiftMask, XK_period, tagmon, {.i = +1}},
    131     TAGKEYS(XK_1, 0),
    132     TAGKEYS(XK_2, 1),
    133     TAGKEYS(XK_3, 2),
    134     TAGKEYS(XK_4, 3),
    135     TAGKEYS(XK_5, 4),
    136     {MODKEY | ShiftMask, XK_q, quit, {0}},
    137 };
    138 
    139 /* button definitions */
    140 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
    141  * ClkClientWin, or ClkRootWin */
    142 static const Button buttons[] = {
    143     /* click                event mask      button          function argument */
    144     {ClkLtSymbol, 0, Button1, cyclelayout, {.i = +1}},
    145     {ClkWinTitle, 0, Button2, zoom, {0}},
    146     {ClkStatusText, 0, Button2, spawn, COMMAND("st")},
    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 };