diff --git a/config.def.h b/config.def.h index 44adc16..1e57893 100644 --- a/config.def.h +++ b/config.def.h @@ -95,6 +95,7 @@ static Key keys[] = { { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, + { MODKEY|ControlMask, XK_space, focusmaster, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, @@ -152,7 +153,8 @@ static Key keys[] = { { MODKEY|ShiftMask, XK_Down, moveresize, {.v = (int []){ 0, 0, 0, 25 }}}, { MODKEY|ShiftMask, XK_Up, moveresize, {.v = (int []){ 0, 0, 0, -25 }}}, { MODKEY|ShiftMask, XK_Right, moveresize, {.v = (int []){ 0, 0, 25, 0 }}}, - { MODKEY|ShiftMask, XK_Left, moveresize, {.v = (int []){ 0, 0, -25, 0 }}},{ MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_Left, moveresize, {.v = (int []){ 0, 0, -25, 0 }}}, + { MODKEY|ShiftMask, XK_q, quit, {0} }, }; /* button definitions */ diff --git a/config.h b/config.h index a03fc85..7936f34 100644 --- a/config.h +++ b/config.h @@ -60,18 +60,18 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ - { "[M]", monocle }, - { "[@]", spiral }, - { "[\\]", dwindle }, - { "H[]", deck }, - { "TTT", bstack }, - { "===", bstackhoriz }, - { "HHH", grid }, - { "###", nrowgrid }, - { "---", horizgrid }, + //{ "[M]", monocle }, + //{ "[@]", spiral }, + //{ "[\\]", dwindle }, + //{ "H[]", deck }, + //{ "TTT", bstack }, + //{ "===", bstackhoriz }, + //{ "HHH", grid }, + //{ "###", nrowgrid }, + //{ "---", horizgrid }, { ":::", gaplessgrid }, { "|M|", centeredmaster }, - { "><>", NULL }, /* no layout function means floating behavior */ + { "><>", NULL }, /*[> no layout function means floating behavior <]*/ { NULL, NULL }, }; @@ -99,12 +99,13 @@ static Key keys[] = { //{ MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, + { MODKEY|ShiftMask, XK_space, focusmaster, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, - //{ MODKEY, XK_i, incnmaster, {.i = +1 } }, - //{ MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_plus, incnmaster, {.i = +1 } }, + { MODKEY, XK_minus, incnmaster, {.i = -1 } }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY, XK_Tab, zoom, {0} }, @@ -131,8 +132,8 @@ static Key keys[] = { { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_space, cyclelayout, {.i = +1 } }, + { MODKEY|ShiftMask, XK_f, togglefloating, {0} }, { MODKEY, XK_f, togglefullscr, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, diff --git a/dwm b/dwm index 3d6e910..5d760e9 100755 Binary files a/dwm and b/dwm differ diff --git a/dwm.c b/dwm.c index 08de02e..dc2d6b3 100644 --- a/dwm.c +++ b/dwm.c @@ -275,6 +275,8 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void focusmaster(const Arg *arg); + /* variables */ static Systray *systray = NULL; static const char broken[] = "broken"; @@ -2575,3 +2577,17 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } + +void +focusmaster(const Arg *arg) +{ + Client *c; + + if (selmon->nmaster < 1) + return; + + c = nexttiled(selmon->clients); + + if (c) + focus(c); +} diff --git a/dwm.o b/dwm.o index 9579b07..0f934fa 100644 Binary files a/dwm.o and b/dwm.o differ diff --git a/focusmaster.diff b/focusmaster.diff new file mode 100644 index 0000000..e180288 --- /dev/null +++ b/focusmaster.diff @@ -0,0 +1,45 @@ +From 3e020d93df3aaec92d2daa142cd1f0d5301b3197 Mon Sep 17 00:00:00 2001 +From: Mateus Auler +Date: Fri, 17 Jul 2020 12:36:36 -0300 +Subject: [PATCH] Ability to map a key combination to switch focus to + the master window. + +--- + dwm.c | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/dwm.c b/dwm.c +index 9fd0286..be01927 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -235,6 +235,8 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee); + static int xerrorstart(Display *dpy, XErrorEvent *ee); + static void zoom(const Arg *arg); + ++static void focusmaster(const Arg *arg); ++ + /* variables */ + static const char broken[] = "broken"; + static char stext[256]; +@@ -2150,3 +2152,17 @@ main(int argc, char *argv[]) + XCloseDisplay(dpy); + return EXIT_SUCCESS; + } ++ ++void ++focusmaster(const Arg *arg) ++{ ++ Client *c; ++ ++ if (selmon->nmaster < 1) ++ return; ++ ++ c = nexttiled(selmon->clients); ++ ++ if (c) ++ focus(c); ++} +-- +2.27.0 + +