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 */
#define MODKEY Mod4Mask
#define MODKEY2 Mod1Mask
#define SUPERKEY Mod4Mask
#define ALTKEY Mod1Mask
#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} },
{ SUPERKEY, KEY, view, {.ui = 1 << TAG} }, \
{ SUPERKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ SUPERKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ SUPERKEY|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 *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 *termcmd[] = { "st", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY2, XK_Tab, focusstack, {.i = +1 } },
/* { MODKEY, XK_k, focusstack, {.i = -1 } }, */
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ MODKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ MODKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { MODKEY, XK_space, setlayout, {0} }, */
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ 0, XK_Print, spawn, {.v = screenshot } },
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} },
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ SUPERKEY, XK_q, killclient, {0} },
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { SUPERKEY, XK_space, setlayout, {0} }, */
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ SUPERKEY, XK_0, view, {.ui = ~0 } },
{ SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ SUPERKEY, XK_comma, focusmon, {.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_2, 1)
TAGKEYS( XK_3, 2)
@ -106,7 +111,7 @@ static Key keys[] = {
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ SUPERKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */
@ -117,12 +122,12 @@ static Button buttons[] = {
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkClientWin, SUPERKEY, Button1, movemouse, {0} },
{ ClkClientWin, SUPERKEY, Button2, togglefloating, {0} },
{ ClkClientWin, SUPERKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
{ ClkTagBar, SUPERKEY, Button1, tag, {0} },
{ ClkTagBar, SUPERKEY, Button3, toggletag, {0} },
};

View File

@ -54,49 +54,54 @@ static const Layout layouts[] = {
};
/* key definitions */
#define MODKEY Mod4Mask
#define MODKEY2 Mod1Mask
#define SUPERKEY Mod4Mask
#define ALTKEY Mod1Mask
#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} },
{ SUPERKEY, KEY, view, {.ui = 1 << TAG} }, \
{ SUPERKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ SUPERKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ SUPERKEY|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 *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 *termcmd[] = { "st", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY2, XK_Tab, focusstack, {.i = +1 } },
/* { MODKEY, XK_k, focusstack, {.i = -1 } }, */
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ MODKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ MODKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ MODKEY, XK_q, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { MODKEY, XK_space, setlayout, {0} }, */
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ 0, XK_Print, spawn, {.v = screenshot } },
{ ShiftMask, XK_Print, spawn, {.v = screenshotarea } },
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
{ SUPERKEY, XK_b, togglebar, {0} },
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
{ SUPERKEY, XK_d, incnmaster, {.i = -1 } },
{ SUPERKEY, XK_h, setmfact, {.f = -0.05} },
{ SUPERKEY, XK_l, setmfact, {.f = +0.05} },
{ SUPERKEY|ShiftMask, XK_Return, zoom, {0} },
{ SUPERKEY, XK_Tab, view, {.ui = 0 } }, // next tab
{ SUPERKEY|ShiftMask, XK_Tab, view, {.ui = -1 } }, // prev tab
{ SUPERKEY|ControlMask, XK_Tab, view, {.ui = -2 } }, // last tab
{ SUPERKEY, XK_q, killclient, {0} },
{ SUPERKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ SUPERKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ SUPERKEY, XK_m, setlayout, {.v = &layouts[2]} },
/* { SUPERKEY, XK_space, setlayout, {0} }, */
{ SUPERKEY|ShiftMask, XK_space, togglefloating, {0} },
{ SUPERKEY, XK_0, view, {.ui = ~0 } },
{ SUPERKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ SUPERKEY, XK_comma, focusmon, {.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_2, 1)
TAGKEYS( XK_3, 2)
@ -106,7 +111,7 @@ static Key keys[] = {
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ SUPERKEY|ShiftMask, XK_q, quit, {0} },
};
/* button definitions */
@ -117,12 +122,12 @@ static Button buttons[] = {
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkClientWin, SUPERKEY, Button1, movemouse, {0} },
{ ClkClientWin, SUPERKEY, Button2, togglefloating, {0} },
{ ClkClientWin, SUPERKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
{ ClkTagBar, SUPERKEY, Button1, tag, {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.