Add shortcut to scrsht and other fixes

This commit is contained in:
Linux User 2022-08-18 22:11:19 +00:00
parent 5426ab59dd
commit 5ee385461b
5 changed files with 84 additions and 74 deletions

View File

@ -54,49 +54,54 @@ static const Layout layouts[] = {
}; };
/* key definitions */ /* key definitions */
#define MODKEY Mod4Mask #define SUPERKEY Mod4Mask
#define MODKEY2 Mod1Mask #define ALTKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \ #define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { SUPERKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ { SUPERKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ { SUPERKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, { SUPERKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *screenshot[] = { "scrsht", NULL };
static const char *screenshotarea[] = { "scrsht", "-s", NULL };
static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
static Key keys[] = { static Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } }, { 0, XK_Print, spawn, {.v = screenshot } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } }, { ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ MODKEY, XK_b, togglebar, {0} }, { SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY2, XK_Tab, focusstack, {.i = +1 } }, { SUPERKEY, XK_Return, spawn, {.v = termcmd } },
/* { MODKEY, XK_k, focusstack, {.i = -1 } }, */ { SUPERKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_i, incnmaster, {.i = +1 } }, { ALTKEY, XK_Tab, focusstack, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } }, /* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ MODKEY, XK_h, setmfact, {.f = -0.05} }, { SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_l, setmfact, {.f = +0.05} }, { SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} }, { SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_Tab, view, {.ui = 0 } }, // next tab { SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab { SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab { SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ MODKEY, XK_q, killclient, {0} }, { SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { SUPERKEY, XK_q, killclient, {0} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
/* { MODKEY, XK_space, setlayout, {0} }, */ { SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_0, view, {.ui = ~0 } }, /* { SUPERKEY, XK_space, setlayout, {0} }, */
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_comma, focusmon, {.i = -1 } }, { SUPERKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } }, { SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { SUPERKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, { SUPERKEY, XK_period, focusmon, {.i = +1 } },
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0) TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1) TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2) TAGKEYS( XK_3, 2)
@ -106,7 +111,7 @@ static Key keys[] = {
TAGKEYS( XK_7, 6) TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7) TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8) TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} }, { SUPERKEY|ShiftMask, XK_q, quit, {0} },
}; };
/* button definitions */ /* button definitions */
@ -117,12 +122,12 @@ static Button buttons[] = {
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} }, { ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, SUPERKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, SUPERKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkClientWin, SUPERKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} }, { ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, SUPERKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} }, { ClkTagBar, SUPERKEY, Button3, toggletag, {0} },
}; };

View File

@ -54,49 +54,54 @@ static const Layout layouts[] = {
}; };
/* key definitions */ /* key definitions */
#define MODKEY Mod4Mask #define SUPERKEY Mod4Mask
#define MODKEY2 Mod1Mask #define ALTKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \ #define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { SUPERKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ { SUPERKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ { SUPERKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, { SUPERKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */ /* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */ /* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *screenshot[] = { "scrsht", NULL };
static const char *screenshotarea[] = { "scrsht", "-s", NULL };
static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; static const char *dmenucmd[] = { "dmenu_run", "-g", "10", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
static const char *termcmd[] = { "st", NULL }; static const char *termcmd[] = { "st", NULL };
static Key keys[] = { static Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } }, { 0, XK_Print, spawn, {.v = screenshot } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } }, { ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ MODKEY, XK_b, togglebar, {0} }, { SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY2, XK_Tab, focusstack, {.i = +1 } }, { SUPERKEY, XK_Return, spawn, {.v = termcmd } },
/* { MODKEY, XK_k, focusstack, {.i = -1 } }, */ { SUPERKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_i, incnmaster, {.i = +1 } }, { ALTKEY, XK_Tab, focusstack, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } }, /* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ MODKEY, XK_h, setmfact, {.f = -0.05} }, { SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_l, setmfact, {.f = +0.05} }, { SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} }, { SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_Tab, view, {.ui = 0 } }, // next tab { SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab { SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab { SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ MODKEY, XK_q, killclient, {0} }, { SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { SUPERKEY, XK_q, killclient, {0} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
/* { MODKEY, XK_space, setlayout, {0} }, */ { SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_0, view, {.ui = ~0 } }, /* { SUPERKEY, XK_space, setlayout, {0} }, */
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_comma, focusmon, {.i = -1 } }, { SUPERKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } }, { SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { SUPERKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, { SUPERKEY, XK_period, focusmon, {.i = +1 } },
{ SUPERKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ SUPERKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0) TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1) TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2) TAGKEYS( XK_3, 2)
@ -106,7 +111,7 @@ static Key keys[] = {
TAGKEYS( XK_7, 6) TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7) TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8) TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} }, { SUPERKEY|ShiftMask, XK_q, quit, {0} },
}; };
/* button definitions */ /* button definitions */
@ -117,12 +122,12 @@ static Button buttons[] = {
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} }, { ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, SUPERKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, SUPERKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} }, { ClkClientWin, SUPERKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} }, { ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} }, { ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} }, { ClkTagBar, SUPERKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} }, { ClkTagBar, SUPERKEY, Button3, toggletag, {0} },
}; };

BIN
drw.o

Binary file not shown.

BIN
dwm

Binary file not shown.

BIN
dwm.o

Binary file not shown.