
/* See LICENSE file for copyright and license details. */

/* appearance */
static const unsigned int borderpx  = 2.5;        /* border pixel of windows */
static const unsigned int gappx     = 14;        /* gaps between windows */
static const unsigned int snap      = 3;       /* snap pixel */
static const int user_bh            = 12;        /* 2 is the default spacing around the bar's font */
static const int showbar            = 1;        /* 0 means no bar */
static const int topbar             = 0;        /* 0 means bottom bar */
static const int vertpad            = 10;       /* vertical padding of bar */
static const int sidepad            = 400;       /* horizontal padding of bar */
static const char *fonts[] = {"CaskaydiaMonoNerdFont-Bold:size=9.2"};
static const char dmenufont[] = "CaskaydiaMonoNerdFont-Bold:size=10.6";
static char normbgcolor[]           = "#222222";
static char normbordercolor[]       = "#444444";
static char normfgcolor[]           = "#bbbbbb";
static char selfgcolor[]            = "#222222";
static char selbordercolor[]        = "#555555";
static char selbgcolor[]            = "#DB940A";
static char *colors[][3] = {
       /*               fg           bg           border   */
       [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
       [SchemeSel]  = { selfgcolor,  selbgcolor,  selbordercolor  },
};

/* tagging */
static const char *tags[] = { "[one]", "[two]", "[three]", "[four]", "[five]", "[six]", "[seven]", "[eight]", "[nine]" };

static const Rule rules[] = {
	/* xprop(1):
	 *	WM_CLASS(STRING) = instance, class
	 *	WM_NAME(STRING) = title
	 */
	/* class      instance    title       tags mask     isfloating   monitor */
	{ NULL,     NULL,       NULL,       0,            0,           -1 },
};

/* layout(s) */
static const float mfact     = 0.50; /* factor of master area size [0.05..0.95] */
static const int nmaster     = 1;    /* number of clients in master area */
static const int resizehints = 0;    /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */

static const Layout layouts[] = {
    /* symbol     arrange function */
    {"[]=", tile},  /* first entry is default */
    {"<#>", NULL}, /* no layout function means floating behavior */
    {"<@>", monocle},
};

static const char *ranger[] = { "st", "-e", "ranger", NULL  };
static const char *firemenu[] = { "firemenu", NULL  };

#include <X11/XF86keysym.h>
//different commands per OS
#ifdef __linux__
        #define VOL_UP "pamixer --allow-boost -i 10; kill -44 $(pidof dwmblocks)"
        #define XK_UP "pamixer --allow-boost -i 5; kill -44 $(pidof dwmblocks)"
        #define VOL_DOWN "pamixer --allow-boost -d 10; kill -44 $(pidof dwmblocks)"
        #define XK_DOWN "pamixer --allow-boost -d 5; kill -44 $(pidof dwmblocks)"
        #define VOL_MUTE "pamixer -t; kill -44 $(pidof dwmblocks)"
        #define VOL_KILL "kill -44 $(pidof dwmblocks)"
#elif __OpenBSD__
        #define VOL_UP "sndioctl output.level=+0.10; pkill -SIGUSR1 dwmblocks"
        #define XK_UP "sndioctl output.level=+0.05; pkill -SIGUSR1 dwmblocks"
        #define VOL_DOWN "sndioctl output.level=-0.10; pkill -SIGUSR1 dwmblocks"
        #define XK_DOWN "sndioctl output.level=-0.05; pkill -SIGUSR1 dwmblocks"
        #define VOL_MUTE "sndioctl output.mute=!; pkill -SIGUSR1 dwmblocks"
        #define VOL_KILL "pkill -SIGUSR1 dwmblocks"
#elif __FreeBSD__
        #define VOL_UP "sndioctl output.level=+0.10"
        #define XK_UP "sndioctl output.level=+0.05"
        #define VOL_DOWN "sndioctl output.level=-0.10"
        #define XK_DOWN "sndioctl output.level=-0.05"
        #define VOL_MUTE "sndioctl output.level=-1"
        #define VOL_KILL "pkill -SIGUSR2 dwmblocks"
#endif

/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", "#222222", "-nf", "#bbbbbb", "-sb", "#DB940A", "-sf", "#222222", NULL };
static const char *termcmd[] = {"zsh", "-c", "st -e zsh  &  walrs -R -q ",NULL};

#include "movestack.c"
static Key keys[] = {
        /*modifierkey                   function                argument */
        { Mod4Mask|ShiftMask,                   XK_r,                   spawn,                                  {.v = firemenu } },
        { MODKEY,                               XK_f,                   spawn,                                  {.v = ranger } },
        { MODKEY,                               XK_r,                   spawn,                                  {.v = dmenucmd } },
        { MODKEY,                               XK_j,                   focusstack,                             {.i = +1 } },
        { MODKEY|ControlMask,                   XK_n,                   focusstack,                             {.i = +1 } },
        { MODKEY|ControlMask,                   XK_p,                   focusstack,                             {.i = -1 } },
        { MODKEY,                               XK_k,                   focusstack,                             {.i = -1 } },
        { MODKEY,                               XK_Tab,                 view,                                   {0} },
        { MODKEY|ShiftMask,                     XK_F5,                  xrdb,                                   {.v = NULL } },
        { MODKEY,                               XK_t,                   setlayout,                              {.v = &layouts[0]} },
        { MODKEY,                               XK_space,               setlayout,                              {0} },

          TAGKEYS(                              XK_1,                                                                   0)
          TAGKEYS(                              XK_2,                                                                   1)
          TAGKEYS(                              XK_3,                                                                   2)
          TAGKEYS(                              XK_4,                                                                   3)
          TAGKEYS(                              XK_5,                                                                   4)
          TAGKEYS(                              XK_6,                                                                   5)
          TAGKEYS(                              XK_7,                                                                   6)
          TAGKEYS(                              XK_8,                                                                   7)
          TAGKEYS(                              XK_9,                                                                   8)

        { MODKEY,                               XK_h,                   setmfact,                               {.f = -0.05} },
        { MODKEY,                               XK_l,                   setmfact,                               {.f = +0.05} },
        { MODKEY|ShiftMask,                     XK_q,                   quit,                                   {0} },
        { MODKEY,                               XK_b,                   spawn,                                  SHCMD("mullvad-browser") },
        { MODKEY,                               XK_m,                   togglebar,                              {0} },
        { MODKEY,                               XK_o,                   incnmaster,                             {.i = +1 } },
        { MODKEY,                               XK_Return,              spawn,                                  {.v = termcmd } },
	{ MODKEY,                               XK_KP_Enter,            spawn,                                  {.v = termcmd } },
	{ MODKEY,                               XK_grave,               spawn,                                  {.v = termcmd } },
//        { MODKEY|ShiftMask,                     XK_o,                   incnmaster                              {.i = -1 } },
        { MODKEY,                               XK_s,                   killclient,                             {0} },
        { MODKEY|ShiftMask,                     XK_j,                   movestack,                              {.i = +1 } },
        { MODKEY|ShiftMask,                     XK_k,                   movestack,                              {.i = -1 } },
        { MODKEY|ControlMask|ShiftMask,         XK_n,                   movestack,                              {.i = +1 } },
        { MODKEY|ControlMask|ShiftMask,         XK_p,                   movestack,                              {.i = -1 } },

        //volume control
        { Mod1Mask,                             XK_equal,               spawn,                                  SHCMD(VOL_UP) },
        { Mod1Mask,                             XK_minus,               spawn,                                  SHCMD(VOL_DOWN) },
        { Mod1Mask,                             XK_minus,               spawn,                                  SHCMD(VOL_DOWN) },
        { 0,                                    XF86XK_AudioMute, spawn,                                SHCMD(VOL_MUTE) },
        { 0,                                    XF86XK_AudioRaiseVolume, spawn,                 SHCMD(XK_UP) },
        { 0,                                    XF86XK_AudioLowerVolume, spawn,                 SHCMD(XK_DOWN) },
        //lock
        { MODKEY|ShiftMask,                             XK_l,                   spawn,                  SHCMD("slock") },
    { 0,           XK_Print,   spawn,      SHCMD("flameshot gui -r | xclip -selection clipboard -t image/png && notify-send 'Screenshot taken!'") },
};


/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static const Button buttons[] = {
	/* click                event mask      button          function        argument */
	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
	{ ClkTagBar,            0,              Button1,        view,           {0} },
	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
};

