diff --git a/README.md b/README.md index ff2c4ab..587c3dd 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2019-10-24 - Added dragmfact, extrabar and nodmenu patches +2019-10-24 - Added dragmfact, extrabar, exresize and nodmenu patches 2019-10-22 - Added ispermanent and swallow patches @@ -128,6 +128,10 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [ewmhtags](https://dwm.suckless.org/patches/ewmhtags/) - adds EWMH support for \_NET_NUMBER_OF_DESKTOPS, \_NET_CURRENT_DESKTOP, \_NET_DESKTOP_NAMES and \_NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs that request workspace information, e.g. polybar's xworkspaces module + - [exresize](https://dwm.suckless.org/patches/exresize/) + - this patch allows the user to change size and placement of floating windows using only the keyboard + - it also allows for temporary vertical and horizontal extension of windows similar to other WMs fill command + - [extrabar](https://dwm.suckless.org/patches/extrabar/) - enables an extra status bar in dwm in a similar manner to the dualstatus patch - if the primary status is at the top via topbar then the extra status bar will be placed at the bottom and vice versa diff --git a/config.def.h b/config.def.h index 9aeee95..ff4e45d 100644 --- a/config.def.h +++ b/config.def.h @@ -502,202 +502,230 @@ static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34 #endif // SCRATCHPAD_PATCH static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, #if SCRATCHPAD_PATCH - { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, + { MODKEY, XK_grave, togglescratch, {.v = scratchpadcmd } }, #endif // SCRATCHPAD_PATCH - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, #if SWITCHCOL_PATCH - { MODKEY, XK_v, switchcol, {0} }, + { MODKEY, XK_v, switchcol, {0} }, #endif // SWITCHCOL_PATCH #if ROTATESTACK_PATCH - { MODKEY|Mod4Mask, XK_j, rotatestack, {.i = +1 } }, - { MODKEY|Mod4Mask, XK_k, rotatestack, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_j, rotatestack, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_k, rotatestack, {.i = -1 } }, #endif // ROTATESTACK_PATCH #if PUSH_PATCH || PUSH_NO_MASTER_PATCH - { MODKEY|ControlMask, XK_j, pushdown, {0} }, - { MODKEY|ControlMask, XK_k, pushup, {0} }, + { MODKEY|ControlMask, XK_j, pushdown, {0} }, + { MODKEY|ControlMask, XK_k, pushup, {0} }, #endif // PUSH_PATCH / PUSH_NO_MASTER_PATCH - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, #if FLEXTILE_DELUXE_LAYOUT - { MODKEY|ControlMask, XK_i, incnstack, {.i = +1 } }, - { MODKEY|ControlMask, XK_u, incnstack, {.i = -1 } }, + { MODKEY|ControlMask, XK_i, incnstack, {.i = +1 } }, + { MODKEY|ControlMask, XK_u, incnstack, {.i = -1 } }, #endif // FLEXTILE_DELUXE_LAYOUT - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, #if CFACTS_PATCH - { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} }, - { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, - { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} }, + { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} }, + { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} }, + { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} }, #endif // CFACTS_PATCH #if MOVESTACK_PATCH - { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, - { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, + { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, + { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, #endif // MOVESTACK_PATCH - { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Return, zoom, {0} }, #if VANITYGAPS_PATCH - { MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } }, - { MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } }, - { MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } }, - { MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } }, - { MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } }, - { MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } }, - { MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } }, - { MODKEY|Mod4Mask, XK_0, togglegaps, {0} }, - { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, + { MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_0, togglegaps, {0} }, + { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} }, #endif // VANITYGAPS_PATCH - { MODKEY, XK_Tab, view, {0} }, + { MODKEY, XK_Tab, view, {0} }, #if AWESOMEBAR_PATCH - { MODKEY, XK_z, showhideclient, {0} }, + { MODKEY, XK_z, showhideclient, {0} }, #endif // AWESOMEBAR_PATCH - { MODKEY|ShiftMask, XK_c, killclient, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, #if KILLUNSEL_PATCH - { MODKEY|ShiftMask, XK_x, killunsel, {0} }, + { MODKEY|ShiftMask, XK_x, killunsel, {0} }, #endif // KILLUNSEL_PATCH #if SELFRESTART_PATCH - { MODKEY|ShiftMask, XK_r, self_restart, {0} }, + { MODKEY|ShiftMask, XK_r, self_restart, {0} }, #endif // SELFRESTART_PATCH - { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_q, quit, {0} }, #if RESTARTSIG_PATCH - { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, + { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, #endif // RESTARTSIG_PATCH #if FOCUSURGENT_PATCH - { MODKEY, XK_u, focusurgent, {0} }, + { MODKEY, XK_u, focusurgent, {0} }, #endif // FOCUSURGENT_PATCH #if HOLDBAR_PATCH - { 0, HOLDKEY, holdbar, {0} }, + { 0, HOLDKEY, holdbar, {0} }, #endif // HOLDBAR_PATCH #if WINVIEW_PATCH - { MODKEY, XK_o, winview, {0} }, + { MODKEY, XK_o, winview, {0} }, #endif // WINVIEW_PATCH #if XRDB_PATCH - { MODKEY|ShiftMask, XK_F5, xrdb, {.v = NULL } }, + { MODKEY|ShiftMask, XK_F5, xrdb, {.v = NULL } }, #endif // XRDB_PATCH - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, #if COLUMNS_LAYOUT - { MODKEY, XK_c, setlayout, {.v = &layouts[3]} }, + { MODKEY, XK_c, setlayout, {.v = &layouts[3]} }, #endif // COLUMNS_LAYOUT #if FLEXTILE_DELUXE_LAYOUT - { MODKEY|ControlMask, XK_t, rotatelayoutaxis, {.i = 0 } }, /* flextile, 0 = layout axis */ - { MODKEY|ControlMask, XK_Tab, rotatelayoutaxis, {.i = 1 } }, /* flextile, 1 = master axis */ - { MODKEY|ControlMask|ShiftMask, XK_Tab, rotatelayoutaxis, {.i = 2 } }, /* flextile, 2 = stack axis */ - { MODKEY|ControlMask|Mod1Mask, XK_Tab, rotatelayoutaxis, {.i = 3 } }, /* flextile, 3 = secondary stack axis */ - { MODKEY|ControlMask, XK_Return, mirrorlayout, {0} }, /* flextile, flip master and stack areas */ + { MODKEY|ControlMask, XK_t, rotatelayoutaxis, {.i = 0 } }, /* flextile, 0 = layout axis */ + { MODKEY|ControlMask, XK_Tab, rotatelayoutaxis, {.i = 1 } }, /* flextile, 1 = master axis */ + { MODKEY|ControlMask|ShiftMask, XK_Tab, rotatelayoutaxis, {.i = 2 } }, /* flextile, 2 = stack axis */ + { MODKEY|ControlMask|Mod1Mask, XK_Tab, rotatelayoutaxis, {.i = 3 } }, /* flextile, 3 = secondary stack axis */ + { MODKEY|ControlMask, XK_Return, mirrorlayout, {0} }, /* flextile, flip master and stack areas */ #endif // FLEXTILE_DELUXE_LAYOUT - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, #if MAXIMIZE_PATCH - { MODKEY|ControlMask|ShiftMask, XK_h, togglehorizontalmax, {0} }, - { MODKEY|ControlMask|ShiftMask, XK_l, togglehorizontalmax, {0} }, - { MODKEY|ControlMask|ShiftMask, XK_j, toggleverticalmax, {0} }, - { MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, {0} }, - { MODKEY|ControlMask, XK_m, togglemaximize, {0} }, + { MODKEY|ControlMask|ShiftMask, XK_h, togglehorizontalmax, {0} }, + { MODKEY|ControlMask|ShiftMask, XK_l, togglehorizontalmax, {0} }, + { MODKEY|ControlMask|ShiftMask, XK_j, toggleverticalmax, {0} }, + { MODKEY|ControlMask|ShiftMask, XK_k, toggleverticalmax, {0} }, + { MODKEY|ControlMask, XK_m, togglemaximize, {0} }, #endif // MAXIMIZE_PATCH #if UNFLOATVISIBLE_PATCH - { MODKEY|Mod4Mask, XK_space, unfloatvisible, {0} }, - { MODKEY|ShiftMask, XK_t, unfloatvisible, {.v = &layouts[0]} }, + { MODKEY|Mod4Mask, XK_space, unfloatvisible, {0} }, + { MODKEY|ShiftMask, XK_t, unfloatvisible, {.v = &layouts[0]} }, #endif // UNFLOATVISIBLE_PATCH #if TOGGLEFULLSCREEN_PATCH - { MODKEY, XK_y, togglefullscreen, {0} }, + { MODKEY, XK_y, togglefullscreen, {0} }, #endif // TOGGLEFULLSCREEN_PATCH #if FULLSCREEN_PATCH - { MODKEY|ShiftMask, XK_f, fullscreen, {0} }, + { MODKEY|ShiftMask, XK_f, fullscreen, {0} }, #endif // FULLSCREEN_PATCH #if STICKY_PATCH - { MODKEY, XK_s, togglesticky, {0} }, + { MODKEY, XK_s, togglesticky, {0} }, #endif // STICKY_PATCH - { 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 } }, + { 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 } }, #if FOCUSADJACENTTAG_PATCH - { MODKEY, XK_Left, viewtoleft, {0} }, - { MODKEY, XK_Right, viewtoright, {0} }, - { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} }, - { MODKEY|ShiftMask, XK_Right, tagtoright, {0} }, - { MODKEY|ControlMask, XK_Left, tagandviewtoleft, {0} }, - { MODKEY|ControlMask, XK_Right, tagandviewtoright, {0} }, + { MODKEY, XK_Left, viewtoleft, {0} }, + { MODKEY, XK_Right, viewtoright, {0} }, + { MODKEY|ShiftMask, XK_Left, tagtoleft, {0} }, + { MODKEY|ShiftMask, XK_Right, tagtoright, {0} }, + { MODKEY|ControlMask, XK_Left, tagandviewtoleft, {0} }, + { MODKEY|ControlMask, XK_Right, tagandviewtoright, {0} }, #endif // FOCUSADJACENTTAG_PATCH #if TAGALL_PATCH - { MODKEY|ShiftMask, XK_F1, tagall, {.v = "F1"} }, - { MODKEY|ShiftMask, XK_F2, tagall, {.v = "F2"} }, - { MODKEY|ShiftMask, XK_F3, tagall, {.v = "F3"} }, - { MODKEY|ShiftMask, XK_F4, tagall, {.v = "F4"} }, - { MODKEY|ShiftMask, XK_F5, tagall, {.v = "F5"} }, - { MODKEY|ShiftMask, XK_F6, tagall, {.v = "F6"} }, - { MODKEY|ShiftMask, XK_F7, tagall, {.v = "F7"} }, - { MODKEY|ShiftMask, XK_F8, tagall, {.v = "F8"} }, - { MODKEY|ShiftMask, XK_F9, tagall, {.v = "F9"} }, - { MODKEY|ControlMask, XK_F1, tagall, {.v = "1"} }, - { MODKEY|ControlMask, XK_F2, tagall, {.v = "2"} }, - { MODKEY|ControlMask, XK_F3, tagall, {.v = "3"} }, - { MODKEY|ControlMask, XK_F4, tagall, {.v = "4"} }, - { MODKEY|ControlMask, XK_F5, tagall, {.v = "5"} }, - { MODKEY|ControlMask, XK_F6, tagall, {.v = "6"} }, - { MODKEY|ControlMask, XK_F7, tagall, {.v = "7"} }, - { MODKEY|ControlMask, XK_F8, tagall, {.v = "8"} }, - { MODKEY|ControlMask, XK_F9, tagall, {.v = "9"} }, + { MODKEY|ShiftMask, XK_F1, tagall, {.v = "F1"} }, + { MODKEY|ShiftMask, XK_F2, tagall, {.v = "F2"} }, + { MODKEY|ShiftMask, XK_F3, tagall, {.v = "F3"} }, + { MODKEY|ShiftMask, XK_F4, tagall, {.v = "F4"} }, + { MODKEY|ShiftMask, XK_F5, tagall, {.v = "F5"} }, + { MODKEY|ShiftMask, XK_F6, tagall, {.v = "F6"} }, + { MODKEY|ShiftMask, XK_F7, tagall, {.v = "F7"} }, + { MODKEY|ShiftMask, XK_F8, tagall, {.v = "F8"} }, + { MODKEY|ShiftMask, XK_F9, tagall, {.v = "F9"} }, + { MODKEY|ControlMask, XK_F1, tagall, {.v = "1"} }, + { MODKEY|ControlMask, XK_F2, tagall, {.v = "2"} }, + { MODKEY|ControlMask, XK_F3, tagall, {.v = "3"} }, + { MODKEY|ControlMask, XK_F4, tagall, {.v = "4"} }, + { MODKEY|ControlMask, XK_F5, tagall, {.v = "5"} }, + { MODKEY|ControlMask, XK_F6, tagall, {.v = "6"} }, + { MODKEY|ControlMask, XK_F7, tagall, {.v = "7"} }, + { MODKEY|ControlMask, XK_F8, tagall, {.v = "8"} }, + { MODKEY|ControlMask, XK_F9, tagall, {.v = "9"} }, #endif // TAGALL_PATCH #if TAGALLMON_PATCH - { MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } }, - { MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_comma, tagallmon, {.i = +1 } }, + { MODKEY|Mod4Mask|ShiftMask, XK_period, tagallmon, {.i = -1 } }, #endif // TAGALLMON_PATCH #if TAGSWAPMON_PATCH - { MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } }, - { MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_comma, tagswapmon, {.i = +1 } }, + { MODKEY|Mod4Mask|ControlMask, XK_period, tagswapmon, {.i = -1 } }, #endif // TAGSWAPMON_PATCH #if ALTERNATIVE_TAGS_PATCH - { MODKEY, XK_n, togglealttag, {0} }, + { MODKEY, XK_n, togglealttag, {0} }, #endif // ALTERNATIVE_TAGS_PATCH #if TAGGRID_PATCH - { MODKEY|ControlMask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } }, - { MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } }, - { MODKEY|ControlMask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } }, - { MODKEY|ControlMask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_VIEW } }, - { MODKEY|Mod4Mask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, - { MODKEY|Mod4Mask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, - { MODKEY|Mod4Mask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, - { MODKEY|Mod4Mask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, + { MODKEY|ControlMask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } }, + { MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } }, + { MODKEY|ControlMask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } }, + { MODKEY|ControlMask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_VIEW } }, + { MODKEY|Mod4Mask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, + { MODKEY|Mod4Mask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, + { MODKEY|Mod4Mask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, + { MODKEY|Mod4Mask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } }, #endif // TAGGRID_PATCH + #if EXRESIZE_PATCH + { MODKEY, XK_KP_7, explace, {.ui = EX_NW }}, + { MODKEY, XK_KP_8, explace, {.ui = EX_N }}, + { MODKEY, XK_KP_9, explace, {.ui = EX_NE }}, + { MODKEY, XK_KP_4, explace, {.ui = EX_W }}, + { MODKEY, XK_KP_5, explace, {.ui = EX_C }}, + { MODKEY, XK_KP_6, explace, {.ui = EX_E }}, + { MODKEY, XK_KP_1, explace, {.ui = EX_SW }}, + { MODKEY, XK_KP_2, explace, {.ui = EX_S }}, + { MODKEY, XK_KP_3, explace, {.ui = EX_SE }}, + + { MODKEY|ShiftMask, XK_KP_8, exresize, {.v = (int []){ 0, 25 }}}, + { MODKEY|ShiftMask, XK_KP_2, exresize, {.v = (int []){ 0, -25 }}}, + { MODKEY|ShiftMask, XK_KP_6, exresize, {.v = (int []){ 25, 0 }}}, + { MODKEY|ShiftMask, XK_KP_4, exresize, {.v = (int []){ -25, 0 }}}, + { MODKEY|ShiftMask, XK_KP_5, exresize, {.v = (int []){ 25, 25 }}}, + { MODKEY|ShiftMask|ControlMask, XK_KP_5, exresize, {.v = (int []){ -25, -25 }}}, + + { MODKEY|ControlMask, XK_KP_6, togglehorizontalexpand, {.i = +1} }, + { MODKEY|ControlMask, XK_KP_3, togglehorizontalexpand, {.i = 0} }, + { MODKEY|ControlMask, XK_KP_4, togglehorizontalexpand, {.i = -1} }, + { MODKEY|ControlMask, XK_KP_8, toggleverticalexpand, {.i = +1} }, + { MODKEY|ControlMask, XK_KP_1, toggleverticalexpand, {.i = 0} }, + { MODKEY|ControlMask, XK_KP_2, toggleverticalexpand, {.i = -1} }, + { MODKEY|ControlMask, XK_KP_9, togglemaximize, {.i = -1} }, + { MODKEY|ControlMask, XK_KP_7, togglemaximize, {.i = +1} }, + { MODKEY|ControlMask, XK_KP_5, togglemaximize, {.i = 0} }, + #endif // EXRESIZE_PATCH #if SETBORDERPX_PATCH - { MODKEY|ShiftMask, XK_minus, setborderpx, {.i = -1 } }, - { MODKEY|ShiftMask, XK_plus, setborderpx, {.i = +1 } }, - { MODKEY|ShiftMask, XK_numbersign, setborderpx, {.i = 0 } }, + { MODKEY|ShiftMask, XK_minus, setborderpx, {.i = -1 } }, + { MODKEY|ShiftMask, XK_plus, setborderpx, {.i = +1 } }, + { MODKEY|ShiftMask, XK_numbersign, setborderpx, {.i = 0 } }, #endif // SETBORDERPX_PATCH #if CYCLELAYOUTS_PATCH - { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, - { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, + { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, + { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, #endif // CYCLELAYOUTS_PATCH #if MDPCONTROL_PATCH - { MODKEY, XK_F1, mpdchange, {.i = -1} }, - { MODKEY, XK_F2, mpdchange, {.i = +1} }, - { MODKEY, XK_Escape, mpdcontrol, {0} }, + { MODKEY, XK_F1, mpdchange, {.i = -1} }, + { MODKEY, XK_F2, mpdchange, {.i = +1} }, + { MODKEY, XK_Escape, mpdcontrol, {0} }, #endif // MDPCONTROL_PATCH - 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) + 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) }; /* button definitions */ diff --git a/dwm.c b/dwm.c index 274c36c..3b8fbb9 100644 --- a/dwm.c +++ b/dwm.c @@ -142,14 +142,21 @@ struct Client { float cfact; #endif // CFACTS_PATCH int x, y, w, h; - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */ - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH int oldx, oldy, oldw, oldh; int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + #if EXRESIZE_PATCH + unsigned char expandmask; + int expandx1, expandy1, expandx2, expandy2; + #if !MAXIMIZE_PATCH + int wasfloating; + #endif // MAXIMIZE_PATCH + #endif // EXRESIZE_PATCH #if MAXIMIZE_PATCH int ismax, wasfloating; #endif // MAXIMIZE_PATCH @@ -1992,19 +1999,22 @@ manage(Window w, XWindowAttributes *wa) c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2; } #endif // CENTER_PATCH - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH c->sfx = -9999; c->sfy = -9999; c->sfw = c->w; c->sfh = c->h; - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, 0); #if MAXIMIZE_PATCH c->wasfloating = 0; c->ismax = 0; - #endif // MAXIMIZE_PATCH + #elif EXRESIZE_PATCH + c->wasfloating = 0; + #endif // MAXIMIZE_PATCH / EXRESIZE_PATCH + if (!c->isfloating) c->isfloating = c->oldstate = trans != None || c->isfixed; if (c->isfloating) @@ -2147,14 +2157,14 @@ movemouse(const Arg *arg) && (abs(nx - c->x) > snap || abs(ny - c->y) > snap)) togglefloating(NULL); if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) { - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH resize(c, nx, ny, c->w, c->h, 1); /* save last known float coordinates */ c->sfx = nx; c->sfy = ny; #else resize(c, nx, ny, c->w, c->h, 1); - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH } break; } @@ -2304,6 +2314,9 @@ resizeclient(Client *c, int x, int y, int w, int h) c->oldy = c->y; c->y = wc.y = y; c->oldw = c->w; c->w = wc.width = w; c->oldh = c->h; c->h = wc.height = h; + #if EXRESIZE_PATCH + c->expandmask = 0; + #endif // EXRESIZE_PATCH wc.border_width = c->bw; #if NOBORDER_PATCH if (((nexttiled(c->mon->clients) == c && !nexttiled(c->next)) @@ -2413,21 +2426,21 @@ resizemouse(const Arg *arg) if (!selmon->lt[selmon->sellt]->arrange || c->isfloating) { #if RESIZECORNERS_PATCH resize(c, nx, ny, nw, nh, 1); - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH /* save last known float dimensions */ c->sfx = nx; c->sfy = ny; c->sfw = nw; c->sfh = nh; - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH #else resize(c, c->x, c->y, nw, nh, 1); - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH c->sfx = c->x; c->sfy = c->y; c->sfw = nw; c->sfh = nh; - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH #endif // RESIZECORNERS_PATCH } break; @@ -2539,6 +2552,9 @@ scan(void) void sendmon(Client *c, Monitor *m) { + #if EXRESIZE_PATCH + Monitor *oldm = selmon; + #endif // EXRESIZE_PATCH if (c->mon == m) return; unfocus(c, 1); @@ -2556,8 +2572,16 @@ sendmon(Client *c, Monitor *m) attach(c); #endif attachstack(c); + #if EXRESIZE_PATCH + if (oldm != m) + arrange(oldm); + arrange(m); + focus(c); + restack(m); + #else focus(NULL); arrange(NULL); + #endif // EXRESIZE_PATCH } void @@ -2687,6 +2711,17 @@ setlayout(const Arg *arg) #else selmon->sellt ^= 1; #endif // PERTAG_PATCH + #if EXRESIZE_PATCH + if (!selmon->lt[selmon->sellt]->arrange) { + for (Client *c = selmon->clients ; c ; c = c->next) { + if (!c->isfloating) { + /*restore last known float dimensions*/ + resize(c, selmon->mx + c->sfx, selmon->my + c->sfy, + c->sfw, c->sfh, False); + } + } + } + #endif // EXRESIZE_PATCH } if (arg && arg->v) #if PERTAG_PATCH @@ -2886,14 +2921,14 @@ showhide(Client *c) return; if (ISVISIBLE(c)) { /* show clients top down */ - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH if (!c->mon->lt[c->mon->sellt]->arrange && c->sfx != -9999 && !c->isfullscreen) { XMoveWindow(dpy, c->win, c->sfx, c->sfy); resize(c, c->sfx, c->sfy, c->sfw, c->sfh, 0); showhide(c->snext); return; } - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH #if AUTORESIZE_PATCH if (c->needresize) { c->needresize = 0; @@ -3059,7 +3094,7 @@ togglefloating(const Arg *arg) XSetWindowBorder(dpy, selmon->sel->win, scheme[SchemeSel][ColBorder].pixel); #endif // FLOAT_BORDER_COLOR_PATCH if (selmon->sel->isfloating) { - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH if (selmon->sel->sfx != -9999) { /* restore last known float dimensions */ resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy, @@ -3067,17 +3102,17 @@ togglefloating(const Arg *arg) arrange(selmon); return; } - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH // EXRESIZE_PATCH resize(selmon->sel, selmon->sel->x, selmon->sel->y, selmon->sel->w, selmon->sel->h, 0); - #if SAVEFLOATS_PATCH + #if SAVEFLOATS_PATCH || EXRESIZE_PATCH } else { /* save last known float dimensions */ selmon->sel->sfx = selmon->sel->x; selmon->sel->sfy = selmon->sel->y; selmon->sel->sfw = selmon->sel->w; selmon->sel->sfh = selmon->sel->h; - #endif // SAVEFLOATS_PATCH + #endif // SAVEFLOATS_PATCH / EXRESIZE_PATCH } arrange(selmon); } diff --git a/patch/exresize.c b/patch/exresize.c new file mode 100644 index 0000000..31591b0 --- /dev/null +++ b/patch/exresize.c @@ -0,0 +1,184 @@ +#define EXPAND_LEFT (1 << 0) +#define EXPAND_RIGHT (1 << 2) +#define EXPAND_UP (1 << 4) +#define EXPAND_DOWN (1 << 6) + +#define IS_SET(q, w) ((q & w) != 0) +#define IS_FORCED(q, w) IS_SET((q << 1), w) + +#define EXPANDALL (EXPAND_LEFT | EXPAND_RIGHT | EXPAND_UP | EXPAND_DOWN) +#define UNEXPAND (EXPANDALL << 1) // Force all directions to 0 +#define FORCE_EXPANDALL ~0 // Force expand in all directions + +void +exresize(const Arg *arg) { + Client *c; + int x, y, nx, ny, nw, nh; + c = selmon->sel; + + if (!c || !arg) return; + if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) + togglefloating(NULL); + if (c->expandmask != 0) + expand(UNEXPAND); + + x = ((int *)arg->v)[0]; + y = ((int *)arg->v)[1]; + + nw = MIN(selmon->ww - c->bw*2, c->w + x); + nh = MIN(selmon->wh - c->bw*2, c->h + y); + nx = c->x - x/2; + ny = c->y - y/2; + + if (!((abs(c->x + c->w/2 - (selmon->wx + selmon->ww/2)) < snap))) { + if ((nw == selmon->ww) || + (nx < selmon->wx) || + (abs(selmon->wx - c->x) < snap)) + nx = selmon->wx; + else if ((nx+nw > (selmon->wx + selmon->ww)) || + (abs((selmon->wx + selmon->ww) - (c->x + c->w)) < snap)) + nx = (selmon->wx + selmon->ww) - nw - c->bw*2; + } else + nx = selmon->wx + selmon->ww/2 - nw/2; + + if (!((abs(c->y + c->h/2 - (selmon->wy + selmon->wh/2)) < snap))) { + + if ((nh == selmon->wh) || + (ny < selmon->wy) || + (abs(selmon->wy - c->y) < snap)) + ny = selmon->wy; + else if ((ny+nh > (selmon->wy + selmon->wh)) || + (abs((selmon->wy + selmon->wh) - (c->y + c->h)) < snap)) + ny = (selmon->wy + selmon->wh) - nh - c->bw*2; + } else + ny = selmon->wy + selmon->wh/2 - nh/2; + + + resizeclient(c, nx, ny, MAX(nw, 32), MAX(nh, 32)); + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); +} + +void +explace(const Arg *arg) { + Client *c; + int nx, ny; + + c = selmon->sel; + if (!c || (arg->ui >= 9)) return; + if (selmon->lt[selmon->sellt]->arrange && !c->isfloating) + togglefloating(NULL); + + nx = (arg->ui % 3) - 1; + ny = (arg->ui / 3) - 1; + + if (nx < 0) nx = selmon->wx; + else if (nx > 0) nx = selmon->wx + selmon->ww - c->w - c->bw*2; + else nx = selmon->wx + selmon->ww/2 - c->w/2; + + if (ny < 0) ny = selmon->wy; + else if (ny > 0) ny = selmon->wy + selmon->wh - c->h - c->bw*2; + else ny = selmon->wy + selmon->wh/2 - c->h/2; + + resize(c, nx, ny, c->w, c->h, True); + XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w/2, c->h/2); +} + +int +calculate_expand(unsigned char mask, unsigned char curmask, + unsigned char *newmask, unsigned char key, + int *reset_value, int new_reset_value, + int max_value, int old_value) { + if (IS_SET(key, mask) || + (IS_SET(key, curmask) && (!IS_SET(key, mask) && IS_FORCED(key, mask))) || + (!IS_SET(key, curmask) && (IS_SET(key, mask) && IS_FORCED(key, mask)))) { + + if (IS_SET(key, mask) && (!IS_SET(key,curmask) || IS_FORCED(key,mask))) + { + if (!IS_SET(key, curmask)) + *reset_value = new_reset_value; + *newmask |= key; + return max_value; + } else if ((IS_SET(key,curmask) && IS_SET(key, mask)) || + (!IS_SET(key, mask) && IS_FORCED(key, mask))) { + *newmask &= ~key; + return *reset_value; + } else { + *newmask &= ~key; + return old_value; + } + } else + return new_reset_value; +} + +void +expand(unsigned char mask) { + XEvent ev; + int nx1, ny1, nx2, ny2; + unsigned char curmask; + unsigned char newmask; + + if(!selmon->sel || selmon->sel->isfixed) + return; + XRaiseWindow(dpy, selmon->sel->win); + newmask = curmask = selmon->sel->expandmask; + + if (curmask == 0) { + if(!selmon->lt[selmon->sellt]->arrange || selmon->sel->isfloating) + selmon->sel->wasfloating = 1; + else { + togglefloating(NULL); + selmon->sel->wasfloating = 0; + } + } + + nx1 = calculate_expand(mask, curmask, &newmask, + EXPAND_LEFT, &selmon->sel->expandx1, + selmon->sel->x, + selmon->wx, + selmon->sel->oldx); + nx2 = calculate_expand(mask, curmask, &newmask, + EXPAND_RIGHT, &selmon->sel->expandx2, + selmon->sel->x + selmon->sel->w, + selmon->wx + selmon->ww - 2*borderpx, + selmon->sel->oldw + selmon->sel->x); + ny1 = calculate_expand(mask, curmask, &newmask, + EXPAND_UP, &selmon->sel->expandy1, + selmon->sel->y, + selmon->wy, + selmon->sel->oldy); + ny2 = calculate_expand(mask, curmask, &newmask, + EXPAND_DOWN, &selmon->sel->expandy2, + selmon->sel->y + selmon->sel->h, + selmon->wy + selmon->wh - 2*borderpx, + selmon->sel->oldh + selmon->sel->y); + + + resizeclient(selmon->sel, nx1, ny1, MAX(nx2-nx1, 32), MAX(ny2-ny1, 32)); + + if ((newmask == 0) && (!selmon->sel->wasfloating)) + togglefloating(NULL); + selmon->sel->expandmask = newmask; + drawbar(selmon); + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); +} + +void +togglemaximize(const Arg *arg) { + if (arg->i > 0) expand(FORCE_EXPANDALL); + else if (arg->i < 0) expand(UNEXPAND); + else expand(EXPANDALL); +} + +void +toggleverticalexpand(const Arg *arg) { + if (arg->i < 0) expand(EXPAND_DOWN); + else if (arg->i > 0) expand(EXPAND_UP); + else expand(EXPAND_DOWN | EXPAND_UP); +} + +void +togglehorizontalexpand(const Arg *arg) { + if (arg->i < 0) expand(EXPAND_LEFT); + else if (arg->i > 0) expand(EXPAND_RIGHT); + else expand(EXPAND_LEFT | EXPAND_RIGHT); +} diff --git a/patch/exresize.h b/patch/exresize.h new file mode 100644 index 0000000..79695ba --- /dev/null +++ b/patch/exresize.h @@ -0,0 +1,8 @@ +enum { EX_NW, EX_N, EX_NE, EX_W, EX_C, EX_E, EX_SW, EX_S, EX_SE }; + +void expand(unsigned char mask); +void togglemaximize(const Arg *arg); +void toggleverticalexpand(const Arg *arg); +void togglehorizontalexpand(const Arg *arg); +void exresize(const Arg *arg); +void explace(const Arg *arg); \ No newline at end of file diff --git a/patch/include.c b/patch/include.c index 3c73054..5166174 100644 --- a/patch/include.c +++ b/patch/include.c @@ -44,6 +44,9 @@ #if HOLDBAR_PATCH #include "holdbar.c" #endif +#if EXRESIZE_PATCH +#include "exresize.c" +#endif #if KILLUNSEL_PATCH #include "killunsel.c" #endif diff --git a/patch/include.h b/patch/include.h index 168384e..9c1980f 100644 --- a/patch/include.h +++ b/patch/include.h @@ -32,6 +32,9 @@ #if EWMHTAGS_PATCH #include "ewmhtags.h" #endif +#if EXRESIZE_PATCH +#include "exresize.h" +#endif #if FOCUSADJACENTTAG_PATCH #include "focusadjacenttag.h" #endif diff --git a/patches.h b/patches.h index d9b3d03..4d1d781 100644 --- a/patches.h +++ b/patches.h @@ -143,6 +143,13 @@ */ #define EWMHTAGS_PATCH 0 +/* This patch allows the user to change size and placement of floating windows using only the + * keyboard. It also allows for temporary vertical and horizontal extension of windows similar + * to other WMs fill command. + * https://dwm.suckless.org/patches/exresize/ + */ +#define EXRESIZE_PATCH 0 + /* This patch will enable an extra status bar in dwm in a similar manner to the dualstatus * patch. If the primary status is at the top via topbar then the extra status bar will be * placed at the bottom and vice versa.