add toggle for X11 window (un)mapping

This commit is contained in:
speedie 2023-01-06 23:40:11 +01:00
parent fbba2f4fec
commit 26b756cb44
5 changed files with 35 additions and 19 deletions

View file

@ -38,6 +38,7 @@ speedwm.bar.titleposition: 1 ! Position of the title (0: Left, 1:
speedwm.border.size: 1 ! Size of the border around windows in pixels (<num>)
!! Client options
speedwm.client.map: 1 ! Map and unmap windows through X11 (0/1)
speedwm.client.allowurgent: 1 ! Allow windows to have the 'urgent' status (0/1)
speedwm.client.automove: 1 ! Allow windows to move themselves on demand. This may be annoying depending on what software you use and is disabled by default for this reason (0/1)
speedwm.client.autofocus: 1 ! Allow windows to focus themselves on demand. This may be annoying depending on what software you use and is disabled by default for this reason (0/1)

View file

@ -14,9 +14,9 @@ static int resizehints = 0; /* Show resize hints */
static int decorhints = 1; /* Respect decoration hints */
static int savefloat = 1; /* Save position of floating windows */
static int refreshrules = 0; /* Refresh rules when a CLASS or TITLE changes */
static int i3mastercount = 0; /* Enable i3-gaps like mastercount (1/0) */
static int mousemfact = 1; /* Enable adjusting mfact using the mouse (1/0) */
static int mousecfact = 1; /* Enable adjusting cfact using the mouse (1/0) */
static int i3mastercount = 0; /* Enable i3-gaps like mastercount (0/1) */
static int mousemfact = 1; /* Enable adjusting mfact using the mouse (0/1) */
static int mousecfact = 1; /* Enable adjusting cfact using the mouse (0/1) */
static float mfact = 0.50; /* Default mfact value. 0.50 = each gets half the available space */
static float lowestmfact = 0.05; /* Lowest possible mfact value on top of the existing. */
@ -43,13 +43,14 @@ static int barpreview = 1; /* Display the bar in the pre
static int scalepreview = 4; /* Size of tag preview. Lower is bigger, higher is smaller. */
/* Window spawning options */
static int windowmap = 1; /* Map and unmap windows through X11 (0/1) */
static int allowurgent = 1; /* Allow windows to have the 'urgent' status */
static int attachdirection = 3; /* 0 default, 1 above, 2 aside, 3 below, 4 bottom, 5 top */
static int swallowclients = 1; /* Swallow windows or not */
static int swallowfloating = 1; /* Swallow floating windows by default */
static int centerfloating = 1; /* Center floating windows by default */
static int startontag = 1; /* Start on a tag or not? */
static int floatscratchpad = 0; /* Float the scratchpad window on hide (1/0) */
static int floatscratchpad = 0; /* Float the scratchpad window on hide (0/1) */
/* Client properties */
static int autofocus = 1; /* Allow clients to automatically be focused when they request it. This comes with the side effect of potentially being annoying */

View file

@ -760,7 +760,7 @@ static void viewtoright_vacant(const Arg *arg);
/* window mapping */
static void window_set_state(Display *dpy, Window win, long state);
static void window_map(Display *dpy, Client *c, int deiconify);
static void window_unmap(Display *dpy, Window win, Window root, int iconify);
static void window_unmap(Display *dpy, Window win, Window root, int iconify, Client *c);
static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
@ -2982,7 +2982,7 @@ showhide(Client *c)
} else {
/* hide clients bottom up */
showhide(c->snext);
window_unmap(dpy, c->win, root, 1);
window_unmap(dpy, c->win, root, 1, c);
}
}
@ -3481,6 +3481,14 @@ window_set_state(Display *dpy, Window win, long state)
void
window_map(Display *dpy, Client *c, int deiconify)
{
if (!windowmap) {
XMoveWindow(dpy, c->win, c->x, c->y);
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
resize(c, c->x, c->y, c->w, c->h, 0);
return;
}
Window win = c->win;
/* fix: hidden windows immediately get mapped */
@ -3497,10 +3505,15 @@ window_map(Display *dpy, Client *c, int deiconify)
}
void
window_unmap(Display *dpy, Window win, Window root, int iconify)
window_unmap(Display *dpy, Window win, Window root, int iconify, Client *c)
{
static XWindowAttributes ca, ra;
if (!windowmap) {
XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
return;
}
XGrabServer(dpy);
XGetWindowAttributes(dpy, root, &ra);
XGetWindowAttributes(dpy, win, &ca);

View file

@ -5,7 +5,7 @@
*/
/* IPC */
#define USEIPC 1 /* Whether or not to include IPC.
#define USEIPC 1 /* Include IPC.
NOTE: If you set this to 1, set USEIPC to true in toggle.mk and comment the YAJLLIBS and YAJLINC lines in config.mk.
Not compatible with BSDs so for those, set this to 0. */
@ -14,21 +14,21 @@ Not compatible with BSDs so for those, set this to 0. */
* These do not have any dependencies but can slow down older computers.
* Because of this, you can easily toggle them on/off.
*/
#define USEALPHA 1 /* Whether or not to include transparency for the bar */
#define USEFADE 1 /* Whether or not to include fading windows */
#define USEALPHA 1 /* Include transparency for the bar */
#define USEFADE 1 /* Include fading windows */
/* Miscellanious */
#define USESWITCHER 1 /* Whether or not to include the switcher */
#define USESYSTRAY 1 /* Whether or not to include the systray */
#define USEMEDIA 1 /* Whether or not to include media keys */
#define USEMOUSE 1 /* Whether or not to include mouse binds */
#define USEXRESOURCES 1 /* Whether or not to include .Xresources support. */
#define USESWITCHER 1 /* Include the switcher */
#define USESYSTRAY 1 /* Include the systray */
#define USEMEDIA 1 /* Include media keys */
#define USEMOUSE 1 /* Include mouse binds */
#define USEXRESOURCES 1 /* Include .Xresources support. */
/* Image related patches
*
* These can slow down speedwm slightly but if you include modern computers, it's not noticeable.
* If you wish to disable them though, set them to 0.
*/
#define USEIMLIB2 1 /* Whether or not to include imlib2. Required by USEWINICON and USETAGPREVIEW. */
#define USEWINICON 1 /* Whether or not to include window icons. Requires imlib to be enabled in toggle.mk and it must be installed. */
#define USETAGPREVIEW 1 /* Whether or not to include tag previews. Requires imlib to be enabled in toggle.mk and it must be installed. */
#define USEIMLIB2 1 /* Include imlib2. Required by USEWINICON and USETAGPREVIEW. */
#define USEWINICON 1 /* Include window icons. Requires imlib to be enabled in toggle.mk and it must be installed. */
#define USETAGPREVIEW 1 /* Include tag previews. Requires imlib to be enabled in toggle.mk and it must be installed. */

View file

@ -142,10 +142,11 @@ ResourcePref resources[] = {
{ "client.hide.single.border", INTEGER, &hidesingleborder },
{ "client.hide.unselected.border",INTEGER, &hideunselectedborder },
{ "client.allowurgent", INTEGER, &allowurgent },
{ "client.wmclass", INTEGER, &wmclass },
{ "client.map", INTEGER, &windowmap },
{ "tag.resetlayout", INTEGER, &resetlayout },
{ "tag.resetmfact", INTEGER, &resetmfact },
{ "tag.resetgaps", INTEGER, &resetgaps },
{ "client.wmclass", INTEGER, &wmclass },
{ "tag.urgentwindows", INTEGER, &urgentwindows },
{ "tag.underline", INTEGER, &underline },
{ "tag.underlinepad", INTEGER, &underlinepad },