mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding keymodes patch
This commit is contained in:
parent
e7ea06a0c2
commit
af96d4c358
@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
|
||||
### Changelog:
|
||||
|
||||
2020-05-31 - Added the keymodes patch
|
||||
|
||||
2020-05-29 - Added the color emoji patch
|
||||
|
||||
2020-05-26 - Added the status2d patch (with alpha, systray, statuspadding and dwmblocks compatibility, no statuscolors or extrabar compatibility)
|
||||
@ -259,6 +261,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
||||
- [ispermanent](https://dwm.suckless.org/patches/ispermanent/)
|
||||
- adds rule option for clients to avoid accidental termination by killclient for sticky windows
|
||||
|
||||
- [keymodes](https://dwm.suckless.org/patches/keymodes/)
|
||||
- this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be performed
|
||||
|
||||
- [leftlayout](http://dwm.suckless.org/patches/leftlayout/)
|
||||
- moves the layout symbol in the status bar to the left hand side
|
||||
|
||||
|
29
config.def.h
29
config.def.h
@ -702,6 +702,9 @@ static const unsigned scratchpad_mask = 1u << sizeof tags / sizeof * tags;
|
||||
|
||||
static Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
#if KEYMODES_PATCH
|
||||
{ MODKEY, XK_Escape, setkeymode, {.ui = COMMANDMODE} },
|
||||
#endif // KEYMODES_PATCH
|
||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
@ -991,6 +994,32 @@ static Key keys[] = {
|
||||
TAGKEYS( XK_9, 8)
|
||||
};
|
||||
|
||||
#if KEYMODES_PATCH
|
||||
static Key cmdkeys[] = {
|
||||
/* modifier keys function argument */
|
||||
{ 0, XK_Escape, clearcmd, {0} },
|
||||
{ ControlMask, XK_c, clearcmd, {0} },
|
||||
{ 0, XK_i, setkeymode, {.ui = INSERTMODE} },
|
||||
};
|
||||
|
||||
static Command commands[] = {
|
||||
/* modifier (4 keys) keysyms (4 keys) function argument */
|
||||
{ {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_h, 0, 0}, setlayout, {.v = &layouts[0]} },
|
||||
{ {ControlMask, 0, 0, 0}, {XK_w, XK_o, 0, 0}, setlayout, {.v = &layouts[2]} },
|
||||
{ {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_o, 0, 0}, onlyclient, {0} },
|
||||
{ {ControlMask, 0, 0, 0}, {XK_w, XK_v, 0, 0}, setlayout, {.v = &layouts[0]} },
|
||||
{ {ControlMask, 0, 0, 0}, {XK_w, XK_less, 0, 0}, setmfact, {.f = -0.05} },
|
||||
{ {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_less, 0, 0}, setmfact, {.f = +0.05} },
|
||||
{ {ControlMask, ShiftMask, 0, 0}, {XK_w, XK_0, 0, 0}, setmfact, {.f = +1.50} },
|
||||
{ {ShiftMask, 0, 0, 0}, {XK_period, XK_e, 0, 0}, spawn, {.v = dmenucmd} },
|
||||
{ {ShiftMask, 0, 0, 0}, {XK_period, XK_o, 0, 0}, spawn, {.v = dmenucmd} },
|
||||
{ {ShiftMask, 0, 0, 0}, {XK_period, XK_q, XK_Return, 0}, quit, {0} },
|
||||
{ {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_d, XK_Return}, killclient, {0} },
|
||||
{ {ShiftMask, 0, 0, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = +1} },
|
||||
{ {ShiftMask, 0, ShiftMask, 0}, {XK_period, XK_b, XK_n, XK_Return}, focusstack, {.i = -1} },
|
||||
};
|
||||
#endif // KEYMODES_PATCH
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
static Button buttons[] = {
|
||||
|
16
dwm.c
16
dwm.c
@ -364,9 +364,17 @@ static int getrootptr(int *x, int *y);
|
||||
static long getstate(Window w);
|
||||
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
|
||||
static void grabbuttons(Client *c, int focused);
|
||||
#if KEYMODES_PATCH
|
||||
static void grabdefkeys(void);
|
||||
#else
|
||||
static void grabkeys(void);
|
||||
#endif // KEYMODES_PATCH
|
||||
static void incnmaster(const Arg *arg);
|
||||
#if KEYMODES_PATCH
|
||||
static void keydefpress(XEvent *e);
|
||||
#else
|
||||
static void keypress(XEvent *e);
|
||||
#endif // KEYMODES_PATCH
|
||||
static void killclient(const Arg *arg);
|
||||
static void manage(Window w, XWindowAttributes *wa);
|
||||
static void mappingnotify(XEvent *e);
|
||||
@ -1987,7 +1995,11 @@ grabbuttons(Client *c, int focused)
|
||||
}
|
||||
|
||||
void
|
||||
#if KEYMODES_PATCH
|
||||
grabdefkeys(void)
|
||||
#else
|
||||
grabkeys(void)
|
||||
#endif // KEYMODES_PATCH
|
||||
{
|
||||
updatenumlockmask();
|
||||
{
|
||||
@ -2028,7 +2040,11 @@ isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info)
|
||||
#endif /* XINERAMA */
|
||||
|
||||
void
|
||||
#if KEYMODES_PATCH
|
||||
keydefpress(XEvent *e)
|
||||
#else
|
||||
keypress(XEvent *e)
|
||||
#endif // KEYMODES_PATCH
|
||||
{
|
||||
unsigned int i;
|
||||
KeySym keysym;
|
||||
|
@ -61,6 +61,9 @@
|
||||
#if INPLACEROTATE_PATCH
|
||||
#include "inplacerotate.c"
|
||||
#endif
|
||||
#if KEYMODES_PATCH
|
||||
#include "keymodes.c"
|
||||
#endif
|
||||
#if KILLUNSEL_PATCH
|
||||
#include "killunsel.c"
|
||||
#endif
|
||||
|
@ -64,6 +64,9 @@
|
||||
#if INPLACEROTATE_PATCH
|
||||
#include "inplacerotate.h"
|
||||
#endif
|
||||
#if KEYMODES_PATCH
|
||||
#include "keymodes.h"
|
||||
#endif
|
||||
#if KILLUNSEL_PATCH
|
||||
#include "killunsel.h"
|
||||
#endif
|
||||
|
@ -294,6 +294,12 @@
|
||||
*/
|
||||
#define IGNORE_XFT_ERRORS_WHEN_DRAWING_TEXT_PATCH 0
|
||||
|
||||
/* This patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts
|
||||
* can be performed.
|
||||
* https://dwm.suckless.org/patches/keymodes/
|
||||
*/
|
||||
#define KEYMODES_PATCH 0
|
||||
|
||||
/* This patch adds a keybinding to kills all visible clients that are not selected.
|
||||
* https://dwm.suckless.org/patches/killunsel/
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user