Adding fullscreen, holdbar and unfloatvisible patches

pull/32/head
bakkeby 5 years ago
parent 1cff033127
commit 37b1b54ab9

@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2019-10-01 - Added leftlayout patch
2019-10-01 - Added leftlayout, fullscreen, holdbar and unfloatvisible patches
2019-09-30 - Replaced flextile with flextile-deluxe, refactored monitor rules to support predetermined layouts per tag
@ -102,6 +102,14 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- by default, dwm responds to \_NET_ACTIVE_WINDOW client messages by setting the urgency bit on the named window
- this patch activates the window instead
- [fullscreen](https://dwm.suckless.org/patches/fullscreen/)
- applies the monocle layout with the focused client on top and hides the bar
- when pressed again it shows the bar and restores the layout that was active before going fullscreen
- [holdbar](http://dwm.suckless.org/patches/holdbar/)
- with this patch dwm's built-in status bar is only shown when HOLDKEY is pressed
- additionally the bar will now overlay the display
- [leftlayout](http://dwm.suckless.org/patches/leftlayout/)
- moves the layout symbol in the status bar to the left hand side
@ -164,6 +172,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [togglefullscreen](https://github.com/bakkeby/dwm-vanitygaps/blob/master/patches/dwm-togglefullscreen-6.2.diff)
- allows you to toggle fullscreen on and off using a single shortcut key
- [unfloatvisible](https://dwm.suckless.org/patches/unfloatvisible/)
- resets isfloating on any visible windows that have it set and optionally also applies a layout
- [urgentborder](https://dwm.suckless.org/patches/urgentborder/)
- this patch makes "urgent" windows have different colors

@ -10,7 +10,11 @@ static const unsigned int gappoh = 10 /* horiz outer gap between windo
static const unsigned int gappov = 30 /* vert outer gap between windows and screen edge */
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
#endif // VANITYGAPS_PATCH
#if HOLDBAR_PATCH
static const int showbar = 0; /* 0 means no bar */
#else
static const int showbar = 1; /* 0 means no bar */
#endif // HOLDBAR_PATCH
static const int topbar = 1; /* 0 means bottom bar */
#if FOCUSONCLICK_PATCH
static const int focusonwheel = 0;
@ -290,6 +294,10 @@ static const Layout layouts[] = {
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
#endif // COMBO_PATCH
#if HOLDBAR_PATCH
#define HOLDKEY 0 // replace 0 with the keysym to activate holdbar
#endif // HOLDBAR_PATCH
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
@ -350,6 +358,9 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_r, self_restart, {0} },
#endif // SELFRESTART_PATCH
{ MODKEY|ShiftMask, XK_q, quit, {0} },
#if HOLDBAR_PATCH
{ 0, HOLDKEY, holdbar, {0} },
#endif // HOLDBAR_PATCH
#if WINVIEW_PATCH
{ MODKEY, XK_o, winview, {0} },
#endif // WINVIEW_PATCH
@ -368,6 +379,10 @@ static Key keys[] = {
#endif // FLEXTILE_DELUXE_LAYOUT
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
#if UNFLOATVISIBLE_PATCH
{ 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} },
#endif // TOGGLEFULLSCREEN_PATCH

@ -372,9 +372,9 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
[ButtonPress] = buttonpress,
#if COMBO_PATCH
#if COMBO_PATCH || HOLDBAR_PATCH
[ButtonRelease] = keyrelease,
#endif // COMBO_PATCH
#endif // COMBO_PATCH / HOLDBAR_PATCH
[ClientMessage] = clientmessage,
[ConfigureRequest] = configurerequest,
[ConfigureNotify] = configurenotify,
@ -385,9 +385,9 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[Expose] = expose,
[FocusIn] = focusin,
[KeyPress] = keypress,
#if COMBO_PATCH
#if COMBO_PATCH || HOLDBAR_PATCH
[KeyRelease] = keyrelease,
#endif // COMBO_PATCH
#endif // COMBO_PATCH / HOLDBAR_PATCH
[MappingNotify] = mappingnotify,
[MapRequest] = maprequest,
#if !FOCUSONCLICK_PATCH

@ -0,0 +1,13 @@
Layout *last_layout;
void
fullscreen(const Arg *arg)
{
if (selmon->showbar) {
for (last_layout = (Layout *)layouts; last_layout != selmon->lt[selmon->sellt]; last_layout++);
setlayout(&((Arg) { .v = &layouts[2] })); // <-- NB! hardcoded monocle
} else {
setlayout(&((Arg) { .v = last_layout }));
}
togglebar(arg);
}

@ -0,0 +1 @@
static void fullscreen(const Arg *arg);

@ -0,0 +1,31 @@
void
holdbar(const Arg *arg)
{
selmon->showbar = 1;
updateholdbarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
}
void
keyrelease(XEvent *e)
{
if (e->xkey.keycode == XKeysymToKeycode(dpy, HOLDKEY)) {
selmon->showbar = 0;
updateholdbarpos(selmon);
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
arrange(selmon);
}
}
void
updateholdbarpos(Monitor *m)
{
m->wy = m->my;
m->wh = m->mh;
if (m->showbar) {
m->by = m->topbar ? m->wy : m->wy + m->wh - bh;
m->wy = m->topbar ? m->wy - bh + bh : m->wy;
} else {
m->by = -bh;
}
}

@ -0,0 +1,3 @@
static void keyrelease(XEvent *e);
static void holdbar(const Arg *arg);
static void updateholdbarpos(Monitor *m);

@ -36,6 +36,14 @@
#include "ewmhtags.c"
#endif
#if FULLSCREEN_PATCH
#include "fullscreen.c"
#endif
#if HOLDBAR_PATCH
#include "holdbar.c"
#endif
#if PERTAG_PATCH
#include "pertag.c"
#endif
@ -78,6 +86,10 @@
#include "togglefullscreen.c"
#endif
#if UNFLOATVISIBLE_PATCH
#include "unfloatvisible.c"
#endif
#if VANITYGAPS_PATCH
#include "vanitygaps.c"
#endif

@ -36,6 +36,14 @@
#include "ewmhtags.h"
#endif
#if FULLSCREEN_PATCH
#include "fullscreen.h"
#endif
#if HOLDBAR_PATCH
#include "holdbar.h"
#endif
#if PERTAG_PATCH
#include "pertag.h"
#endif
@ -78,6 +86,10 @@
#include "togglefullscreen.h"
#endif
#if UNFLOATVISIBLE_PATCH
#include "unfloatvisible.h"
#endif
#if VANITYGAPS_PATCH
#include "vanitygaps.h"
#endif

@ -0,0 +1,14 @@
void
unfloatvisible(const Arg *arg)
{
Client *c;
for (c = selmon->clients; c; c = c->next)
if (ISVISIBLE(c) && c->isfloating)
c->isfloating = c->isfixed;
if (arg && arg->v)
setlayout(arg);
else
arrange(selmon);
}

@ -0,0 +1 @@
static void unfloatvisible(const Arg *arg);

@ -141,6 +141,19 @@
*/
#define FOCUSONNETACTIVE_PATCH 0
/* Applies the monocle layout with the focused client on top and hides the bar. When pressed
* again it shows the bar and restores the layout that was active before going fullscreen.
* NB: This patch assumes that the third layout is monocle and that the bar is shown.
* https://dwm.suckless.org/patches/fullscreen/
*/
#define FULLSCREEN_PATCH 0
/* With this patch dwm's built-in status bar is only shown when HOLDKEY is pressed
* and the bar will now overlay the display.
* http://dwm.suckless.org/patches/holdbar/
*/
#define HOLDBAR_PATCH 0
/* Moves the layout symbol in the status bar to the left hand side.
* http://dwm.suckless.org/patches/leftlayout/
*/
@ -273,6 +286,12 @@
*/
#define TOGGLEFULLSCREEN_PATCH 0
/* This patch resets isfloating on any visible windows that have it set.
* Optionally also applies a layout.
* https://dwm.suckless.org/patches/unfloatvisible/
*/
#define UNFLOATVISIBLE_PATCH 0
/* This patch makes "urgent" windows have different colors.
* https://dwm.suckless.org/patches/urgentborder/
*/

Loading…
Cancel
Save