mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding README.md
This commit is contained in:
parent
c34c536f3e
commit
2c9a889b22
19
README.md
Normal file
19
README.md
Normal file
@ -0,0 +1,19 @@
|
||||
This side project has a very different take on dwm patching. It uses preprocessor directives to decide whether or not to include a patch during build time; essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more.
|
||||
|
||||
For example to include the alpha patch then you would only need to flip this setting from 0 to 1 in `dwm.c`:
|
||||
```c
|
||||
#define ALPHA_PATCH 1
|
||||
```
|
||||
|
||||
Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on the dwm window manager, how to install it and how it works.
|
||||
|
||||
---
|
||||
|
||||
### Changelog:
|
||||
|
||||
2019-09-05 - Alpha patch added
|
||||
|
||||
### Patches included:
|
||||
|
||||
- [alpha](https://dwm.suckless.org/patches/alpha/)
|
||||
- adds transparency for the status bar
|
1
drw.c
1
drw.c
@ -5,6 +5,7 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
#include "patches.h"
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
|
||||
|
62
dwm.c
62
dwm.c
@ -41,12 +41,7 @@
|
||||
#endif /* XINERAMA */
|
||||
#include <X11/Xft/Xft.h>
|
||||
|
||||
/* patch options */
|
||||
#define ALPHA_PATCH 0
|
||||
|
||||
|
||||
|
||||
|
||||
#include "patches.h"
|
||||
#include "drw.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -63,10 +58,6 @@
|
||||
#define TAGMASK ((1 << LENGTH(tags)) - 1)
|
||||
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
|
||||
|
||||
#if ALPHA_PATCH
|
||||
#define OPAQUE 0xffU
|
||||
#endif // ALPHA_PATCH
|
||||
|
||||
/* enums */
|
||||
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
@ -242,9 +233,6 @@ static Monitor *wintomon(Window w);
|
||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
#if ALPHA_PATCH
|
||||
static void xinitvisual();
|
||||
#endif // ALPHA_PATCH
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
@ -281,16 +269,13 @@ static Drw *drw;
|
||||
static Monitor *mons, *selmon;
|
||||
static Window root, wmcheckwin;
|
||||
|
||||
#if ALPHA_PATCH
|
||||
static int useargb = 0;
|
||||
static Visual *visual;
|
||||
static int depth;
|
||||
static Colormap cmap;
|
||||
#endif // ALPHA_PATCH
|
||||
#include "patch/include.h"
|
||||
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
#include "patch/include.c"
|
||||
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
@ -2151,45 +2136,6 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if ALPHA_PATCH
|
||||
void
|
||||
xinitvisual()
|
||||
{
|
||||
XVisualInfo *infos;
|
||||
XRenderPictFormat *fmt;
|
||||
int nitems;
|
||||
int i;
|
||||
|
||||
XVisualInfo tpl = {
|
||||
.screen = screen,
|
||||
.depth = 32,
|
||||
.class = TrueColor
|
||||
};
|
||||
long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
|
||||
|
||||
infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
|
||||
visual = NULL;
|
||||
for(i = 0; i < nitems; i ++) {
|
||||
fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
|
||||
if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
|
||||
visual = infos[i].visual;
|
||||
depth = infos[i].depth;
|
||||
cmap = XCreateColormap(dpy, root, visual, AllocNone);
|
||||
useargb = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(infos);
|
||||
|
||||
if (! visual) {
|
||||
visual = DefaultVisual(dpy, screen);
|
||||
depth = DefaultDepth(dpy, screen);
|
||||
cmap = DefaultColormap(dpy, screen);
|
||||
}
|
||||
}
|
||||
#endif // ALPHA_PATCH
|
||||
|
||||
void
|
||||
zoom(const Arg *arg)
|
||||
{
|
||||
|
42
patch/alpha.c
Normal file
42
patch/alpha.c
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
static int useargb = 0;
|
||||
static Visual *visual;
|
||||
static int depth;
|
||||
static Colormap cmap;
|
||||
|
||||
void
|
||||
xinitvisual()
|
||||
{
|
||||
XVisualInfo *infos;
|
||||
XRenderPictFormat *fmt;
|
||||
int nitems;
|
||||
int i;
|
||||
|
||||
XVisualInfo tpl = {
|
||||
.screen = screen,
|
||||
.depth = 32,
|
||||
.class = TrueColor
|
||||
};
|
||||
long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
|
||||
|
||||
infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
|
||||
visual = NULL;
|
||||
for (i = 0; i < nitems; i ++) {
|
||||
fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
|
||||
if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
|
||||
visual = infos[i].visual;
|
||||
depth = infos[i].depth;
|
||||
cmap = XCreateColormap(dpy, root, visual, AllocNone);
|
||||
useargb = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(infos);
|
||||
|
||||
if (! visual) {
|
||||
visual = DefaultVisual(dpy, screen);
|
||||
depth = DefaultDepth(dpy, screen);
|
||||
cmap = DefaultColormap(dpy, screen);
|
||||
}
|
||||
}
|
3
patch/alpha.h
Normal file
3
patch/alpha.h
Normal file
@ -0,0 +1,3 @@
|
||||
#define OPAQUE 0xffU
|
||||
|
||||
static void xinitvisual();
|
5
patch/include.c
Normal file
5
patch/include.c
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
#if ALPHA_PATCH
|
||||
#include "alpha.c"
|
||||
#endif
|
||||
|
5
patch/include.h
Normal file
5
patch/include.h
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
#if ALPHA_PATCH
|
||||
#include "alpha.h"
|
||||
#endif
|
||||
|
14
patches.h
Normal file
14
patches.h
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* This file contains patch control flags.
|
||||
*
|
||||
* In principle you should be able to mix and match any patches
|
||||
* you may want. In cases where patches are logically incompatible
|
||||
* one patch may take precedence over the other as noted in the
|
||||
* relevant descriptions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The alpha patch adds transparency for the status bar.
|
||||
* https://dwm.suckless.org/patches/alpha/
|
||||
*/
|
||||
#define ALPHA_PATCH 0
|
Loading…
Reference in New Issue
Block a user