dwm

Fork of dwm, the best tiling window manager
git clone git://git.laack.co/dwm.git
Log | Files | Refs | README | LICENSE

config.h (13951B)


      1 /* See LICENSE file for copyright and license details. */
      2 // patches in use:
      3 
      4 // columns (make master side by side; nice for ultrawides)
      5 // attachbelow (more like i3; new windows are inserted below the focused one)
      6 // movestack (move windows up and down the stack. This gives better control)
      7 
      8 /* appearance */
      9 static const unsigned int borderpx  = 1;        /* border pixel of windows */
     10 static const unsigned int snap      = 32;       /* snap pixel */
     11 static const int showbar            = 1;        /* 0 means no bar */
     12 static const int topbar             = 1;        /* 0 means bottom bar */
     13 static const char *fonts[] = { "FiraCode:size=10" };
     14 static const char dmenufont[] = "FiraCode:size=10";
     15 
     16 static const char col_black[]       = "#000000";
     17 static const char col_white[]       = "#000000";
     18 static const char col_lg[]          = "#FFFFFF";
     19 static const char col_gray1[]       = "#000000";
     20 static const char col_orange[]       = "#FFFFFF";
     21 
     22 static const char *colors[][3]      = {
     23 	/*               fg         bg         border   */
     24 	[SchemeNorm] = { col_lg, col_black, col_black },
     25     [SchemeSel]  = { col_white, col_orange,  col_orange  },
     26 };
     27 
     28 /* tagging */
     29 static const char *tags[] = { 
     30 	"1",
     31 	"2",
     32 	"3",
     33 	"4",
     34 	"5",
     35     "6",
     36     "7",
     37     "8",
     38     "9",
     39     "10",
     40 };
     41 
     42 static const Rule rules[] = {
     43 	/* xprop(1):
     44 	 *	WM_CLASS(STRING) = instance, class
     45 	 */
     46 	/* class      instance    title       tags mask     isfloating   monitor */
     47 	{ "Gimp",     NULL,       NULL,       0,            1,           -1 },
     48 	//{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1 },
     49 };
     50 
     51 /* layout(s) */
     52 
     53 // I use an odyssey g9 so I like having one full height
     54 // window on the left, one in the center, and then splits on the right side
     55 
     56 static const float mfact     = 0.75; /* factor of master area size [0.05..0.95] */
     57 static const int nmaster     = 3;    /* number of clients in master area */
     58 static const int resizehints = 1;    /* 1 means respect size hints in tiled resizals */
     59 static const int lockfullscreen = 1;
     60 
     61 static const Layout layouts[] = {
     62 	{ "|||",      col},
     63 	{ "[]=",      tile },
     64 };
     65 
     66 /* key definitions */
     67 #define MODKEY Mod4Mask
     68 #define TAGKEYS(KEY,TAG) \
     69 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     70 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     71 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     72 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
     73 
     74 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     75 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/bash", "-c", cmd, NULL } }
     76 
     77 /* commands */
     78 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
     79 
     80 // colors used in dmenu.
     81 //static const char background[]       = "#000000";
     82 //static const char foreground[]       = "#FFFFFF";
     83 //static const char highlight[]        = "#AAAAAA";
     84 
     85 static const char *dmenucmd[] = {"/home/andrew/bin/dmenu.sh", "dwm", NULL};
     86 static const char *endcmd[] = {"/home/andrew/bin/power.sh", "dwm", NULL};
     87 static const char *passcmd[] = {"/home/andrew/bin/pass.sh", "dwm", NULL};
     88 //static const char *tmuxcmd[] = {"/home/andrew/bin/tmux.sh", NULL};
     89 //static const char *emacscmd[] = {"/home/andrew/bin/emacs.sh" , NULL };
     90 
     91 //static const char *attachcmd[] = {"/home/andrew/bin/attach.sh", NULL};
     92 //static const char *tabbedcmd[] = {"/home/andrew/bin/tabbed.sh", NULL};
     93 //static const char *abducocmd[] = {"/home/andrew/bin/abduco.sh", NULL};
     94 //static const char *searchcmd[] = {"/home/andrew/bin/search.sh", NULL};
     95 static const char *zathuracmd[] = {"/home/andrew/bin/zathura.sh", "dwm", NULL};
     96 //static const char *rsynccmd[] = {"/home/andrew/bin/rsync.sh", NULL};
     97 static const char *vmcmd[] = {"/home/andrew/bin/vm-manager.sh", "dwm", NULL};
     98 static const char *musiccmd[] = {"/home/andrew/bin/find-music.sh", "/home/andrew/personal-files/music/" , NULL};
     99 //static const char *rangercmd[] = {"/home/andrew/bin/ranger.sh", "/home/" , NULL};
    100 //static const char *workspacecmd[] = {"/home/andrew/bin/init-screen.sh", NULL};
    101 // copying bookmarks
    102 // static const char *bookmarkscmd[] = {"/home/andrew/bin/bookmarks.sh", NULL};
    103 // static const char *addbookmarkcmd[] = {"/home/andrew/bin/add-bookmark.sh", NULL};
    104 // static const char *openbookmarkcmd[] = {"/home/andrew/bin/open-bookmark.sh", NULL};
    105 // static const char *openlibrewolfcmd[] = {"librewolf", NULL};
    106 
    107 // I had to take this stupid test with honorlock so I decided to bind c-c to 
    108 // make my chromium window opaque. This will ensure the professor has to read my background
    109 // which is a scathing review or proprietary software, and general ill sentiments towards
    110 // honorlock.
    111 //static const char *chromecmd[] = {"/home/andrew/bin/toggle.sh", NULL};
    112 
    113 
    114 static const char *lockcmd[] = {"/home/andrew/bin/lock.sh", NULL};
    115 
    116 static const char *screenshotcmd[] = {"/home/andrew/bin/screenshot.sh", NULL};
    117 static const char *todocmd[] = {"/home/andrew/bin/todo.sh", NULL};
    118 static const char *docscmd[] = {"/home/andrew/bin/docs.sh", NULL};
    119 static const char *webcmd[] = {"/home/andrew/bin/web.sh", NULL};
    120 
    121 // play
    122 static const char *mpvpastecmd[] = {"/home/andrew/bin/mpv.sh", "dwm", NULL};
    123 
    124 //static const char *suspendcmd[] = {"/home/andrew/bin/suspend.sh" , NULL};
    125 
    126 static const char *termcmd[]  = {"/home/andrew/bin/terminal.sh", NULL};
    127 static const char *chatcmd[]  = {"/home/andrew/bin/chat.sh", NULL};
    128 static const char *wiresharkcmd[]  = {"wireshark", NULL};
    129 //static const char *browsercmd[]  = {"xclip -o -sel clipboard | xargs qutebrowser --target window", NULL};
    130 static const char *mullvadcmd[]  = {"mullvad", NULL};
    131 static const char *bravecmd[]  = {"brave", NULL};
    132 static const char *searchcmd[]  = {"/home/andrew/bin/lynx.sh", NULL};
    133 static const char *newsboatcmd[]  = {"/home/andrew/bin/newsboat.sh", NULL};
    134 //static const char *protoncmd[]  = {"protonvpn-app", NULL};
    135 
    136 #include "movestack.c"
    137 
    138 // === KEYBINDING RULES ===
    139 
    140 // 1. All desktop level keybindings start with the modkey
    141 //  - I don't have an alt key and the ctrl key is used for keybindings within programs
    142 // 2. Mod + character bindings are reserved for:
    143 //  - Window Navigation
    144 //  - Dmenu
    145 //  - Termnal programs
    146 //  - Desktop related keybindings
    147 //      - hiding system bar
    148 //      - locking screen
    149 //      - resizing stack proportion
    150 // 3. Mod + shift + character bindings are reserved for:
    151 //  - Keybindings that will result in the creation or rotation of windows on screen,
    152 //      excluding programs that only open a terminal window
    153 //  - desktop level programs that don't feel tightly integrated with standard desktop usage
    154 //      - screenshotting
    155 
    156 // === KEYBINDINGs ===
    157 
    158 // TODO: Make calls to scripts vs path stuff consistent.
    159 
    160 static const Key keys[] = {
    161 	/* modifier                     key        function        argument */
    162 	{ MODKEY,                       XK_o,      spawn,          {.v = dmenucmd } },
    163 	{ MODKEY,                       XK_e,      spawn,          {.v = endcmd } },
    164 	{ MODKEY,                       XK_p,      spawn,          {.v = passcmd } },
    165 	//{ MODKEY,                       XK_a,      spawn,          {.v = abducocmd } },
    166 
    167 	//{ MODKEY,                       XK_t,      spawn,          {.v = tmuxcmd } },
    168 	{ MODKEY,                       XK_d,      spawn,          {.v = docscmd } },
    169 	{ MODKEY,                       XK_w,      spawn,          {.v = webcmd } },
    170 	// I didn't really use this.
    171 	//{ MODKEY,                       XK_a,      spawn,          {.v = attachcmd} },
    172 	//{ MODKEY,                       XK_s,      spawn,          {.v = searchcmd } },
    173 	{ MODKEY,                       XK_z,      spawn,          {.v = zathuracmd } },
    174 	//{ MODKEY,                       XK_r,      spawn,          {.v = rsynccmd } },
    175 	{ MODKEY,                       XK_v,      spawn,          {.v = vmcmd } },
    176 	{ MODKEY,                       XK_m,      spawn,          {.v = musiccmd } },
    177 	//{ MODKEY,                       XK_t,      spawn,          {.v = tabbedcmd } },
    178 	//{ MODKEY,                       XK_r,      spawn,          {.v = rangercmd } },
    179 	//{ MODKEY,                       XK_w,      spawn,          {.v = workspacecmd} },
    180 	
    181 	// copy bookmark
    182 	//{ MODKEY,                       XK_b,      spawn,          {.v = bookmarkscmd} },
    183 	
    184 	//{ MODKEY,						XK_a,      spawn,          {.v = addbookmarkcmd} },
    185 	
    186 	// search the web/open bookmark
    187 	//{ MODKEY,						XK_s,      spawn,          {.v = openbookmarkcmd} },
    188 
    189 	// hide bar
    190 	{ MODKEY,                       XK_h,      togglebar,      {0} },
    191 
    192 
    193 	//{ MODKEY|ShiftMask,             XK_b,      spawn,          {.v = browsercmd} },
    194 	
    195 	// add bookmark
    196 	//{ MODKEY|ShiftMask,             XK_b,      spawn,          {.v = addbookmarkcmd} },
    197 	{ MODKEY|ShiftMask,             XK_s,      spawn,          {.v = screenshotcmd } },
    198 	{ MODKEY,             XK_t,      spawn,          {.v = todocmd} },
    199 	//{ MODKEY|ShiftMask,             XK_l,      spawn,          {.v = openlibrewolfcmd } },
    200 	{ MODKEY,             XK_l,      spawn,          {.v = lockcmd } },
    201 	{ MODKEY|ShiftMask,             XK_p,      spawn,          {.v = mpvpastecmd } },
    202 	{ MODKEY|ShiftMask,             XK_m,      spawn,          {.v = mullvadcmd } },
    203 	{ MODKEY|ShiftMask,             XK_b,      spawn,          {.v = bravecmd } },
    204 	{ MODKEY,             XK_s,      spawn,          {.v = searchcmd } },
    205 	{ MODKEY,             XK_n,      spawn,          {.v = newsboatcmd } },
    206 	{ MODKEY|ShiftMask,             XK_w,      spawn,          {.v = wiresharkcmd } },
    207 	//{ MODKEY|ShiftMask,             XK_e,      spawn,          {.v = emacscmd } },
    208 
    209 	// this shouldn't really be used seriously.
    210 	// there is a definite line number for toggling this, hacky at best.
    211 	//{ MODKEY|ShiftMask,             XK_c,      spawn,          {.v = chromecmd} },
    212 
    213 	{ MODKEY,             			XK_Return, spawn,          {.v = termcmd } },
    214 	{ MODKEY|ShiftMask,             XK_c, spawn,          {.v = chatcmd } },
    215     //This conflicts with play and play is cooler.
    216 	//{ MODKEY|ShiftMask,             XK_p, spawn,          {.v = protoncmd } },
    217 
    218 
    219 	{ MODKEY,                       XK_Down,      focusstack,     {.i = +1 } },
    220 	{ MODKEY,                       XK_Up,      focusstack,     {.i = -1 } },
    221 
    222 	{ MODKEY|ShiftMask,             XK_i,      incnmaster,     {.i = +1 } },
    223 	{ MODKEY|ShiftMask,             XK_d,      incnmaster,     {.i = -1 } },
    224 
    225 	// exit (power off options)
    226 //	{ MODKEY,             XK_e,      spawn,     {.v = endcmd } },
    227 
    228 	{ MODKEY,                       XK_Left,      setmfact,       {.f = -0.05} },
    229 	{ MODKEY,                       XK_Right,      setmfact,       {.f = +0.05} },
    230 	
    231 	// send to top of stack
    232 	{ MODKEY|ShiftMask,				XK_t, zoom,           {0} },
    233 
    234 	//{ MODKEY,                       XK_Tab,    view,           {0} },
    235 	
    236 	{ MODKEY|ShiftMask,             XK_Down,      movestack,      {.i = +1 } },
    237 	{ MODKEY|ShiftMask,             XK_Up,      movestack,      {.i = -1 } },
    238 
    239 	TAGKEYS(                        XK_1,                      0)
    240 	TAGKEYS(                        XK_2,                      1)
    241 	TAGKEYS(                        XK_3,                      2)
    242 	TAGKEYS(                        XK_4,                      3)
    243 	TAGKEYS(                        XK_5,                      4)
    244 	TAGKEYS(                        XK_6,                      5)
    245 	TAGKEYS(                        XK_7,                      6)
    246 	TAGKEYS(                        XK_8,                      7)
    247 	TAGKEYS(                        XK_9,                      8)
    248 	TAGKEYS(                        XK_0,                      9)
    249 
    250 	{ MODKEY|ShiftMask,             XK_q,      killclient,     {0} },
    251 
    252 
    253 	//{ MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
    254 	//{ MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
    255 	//
    256 	
    257 	// stack mode
    258 	{ MODKEY|ShiftMask,                       XK_v,      setlayout,      {.v = &layouts[1]} },
    259 	
    260 	// columnar mode (awesome for odyssey g9)
    261 	{ MODKEY|ShiftMask,                       XK_h,      setlayout,      {.v = &layouts[0]} },
    262 
    263 	//{ MODKEY|ShiftMask,             XK_f,      togglefullscr,  {0} },
    264 
    265 	//{ MODKEY,                       XK_space,  setlayout,      {0} },
    266 
    267 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    268 	//{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    269 	//{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    270 
    271 	{ MODKEY|ShiftMask,                       XK_m,  focusmon,       {.i = -1 } },
    272 	//{ MODKEY|ShiftMask,                       XK_Down, focusmon,       {.i = +1 } },
    273 	
    274 	//{ MODKEY|ShiftMask,             XK_Right,  tagmon,         {.i = +1 } },
    275 	{ MODKEY|ShiftMask,             XK_n, tagmon,         {.i = -1 } },
    276 
    277 	{ MODKEY|ShiftMask,             XK_r,      quit,           {0} },
    278 
    279 };
    280 
    281 /* button definitions */
    282 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    283 static const Button buttons[] = {
    284 	/* click                event mask      button          function        argument */
    285 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    286 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    287 	//{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
    288 	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
    289 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    290 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    291 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    292 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    293 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    294 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    295 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    296 };
    297