From 9b69da6a45fcd081d656b67e07e7a092d8674ba1 Mon Sep 17 00:00:00 2001 From: speedie Date: Fri, 20 Jan 2023 22:22:36 +0100 Subject: [PATCH] add option for toggling alpha without #if USEALPHA --- README.md | 1 + docs/example.Xresources | 1 + options.h | 1 + speedwm.1 | 2 ++ speedwm.c | 2 +- xresources.h | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3d5680..0cb6d60 100644 --- a/README.md +++ b/README.md @@ -361,6 +361,7 @@ The magic of .Xresources is that it is a universal configuration file. While you Below is a list of all .Xresources values you can define. +- speedwm.bar.alpha: 1 - speedwm.bar.height: 3 - speedwm.bar.position: 1 - speedwm.bar.paddingoh: 0 diff --git a/docs/example.Xresources b/docs/example.Xresources index cba0d24..18d59c1 100644 --- a/docs/example.Xresources +++ b/docs/example.Xresources @@ -4,6 +4,7 @@ !! Alternatively append the values to your existing .Xresources. !! Bar options +speedwm.bar.alpha: 1 ! Enable alpha (0/1) speedwm.bar.height: 3 ! Height of the bar in pixels () speedwm.bar.position: 1 ! Position of the bar (0: Bottom, 1: Top) speedwm.bar.paddingoh: 0 ! Horizontal padding (extra space) around the bar in pixels () diff --git a/options.h b/options.h index d546761..5a3bd6b 100644 --- a/options.h +++ b/options.h @@ -91,6 +91,7 @@ static int iconsize = 15; /* Size of the icon */ static int iconspacing = 5; /* Spacing between the title and icon */ /* Bar options */ +static int alpha = 1; /* Enable alpha */ static int barposition = 1; /* Bar position. Top: 1, Bottom: 0 */ static int barheight = 3; /* Bar height in pixels, 0 = calculate automatically */ static int barpaddingov = 0; /* Vertical outer bar padding in pixels. */ diff --git a/speedwm.1 b/speedwm.1 index aa19b0b..3eed258 100644 --- a/speedwm.1 +++ b/speedwm.1 @@ -709,6 +709,8 @@ general/mainstream .Xresources configurations. .PP Below is a list of all .Xresources values you can define. .IP \[bu] 2 +speedwm.bar.alpha: 1 +.IP \[bu] 2 speedwm.bar.height: 3 .IP \[bu] 2 speedwm.bar.position: 1 diff --git a/speedwm.c b/speedwm.c index ee9e55e..78e52dd 100644 --- a/speedwm.c +++ b/speedwm.c @@ -6401,7 +6401,7 @@ xinitvisual() XFree(infos); - if (! visual) { + if (!visual || !alpha) { visual = DefaultVisual(dpy, screen); depth = DefaultDepth(dpy, screen); cmap = DefaultColormap(dpy, screen); diff --git a/xresources.h b/xresources.h index 1a3b025..0cbb007 100644 --- a/xresources.h +++ b/xresources.h @@ -112,6 +112,7 @@ ResourcePref resources[] = { { "client.decorhints", INTEGER, &decorhints }, { "client.swallow", INTEGER, &swallowclients }, { "client.swallowfloating", INTEGER, &swallowfloating }, + { "bar.alpha", INTEGER, &alpha }, { "bar.height", INTEGER, &barheight }, { "bar.paddingov", INTEGER, &barpaddingov }, { "bar.paddingoh", INTEGER, &barpaddingoh },