summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dmenu/config.def.h8
-rw-r--r--dmenu/dmenu.c50
-rw-r--r--dwm/config.def.h25
-rw-r--r--dwm/dwm.c41
4 files changed, 80 insertions, 44 deletions
diff --git a/dmenu/config.def.h b/dmenu/config.def.h
index 1edb647..bc17068 100644
--- a/dmenu/config.def.h
+++ b/dmenu/config.def.h
@@ -8,10 +8,10 @@ static const char *fonts[] = {
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
static const char *colors[SchemeLast][2] = {
- /* fg bg */
- [SchemeNorm] = { "#bbbbbb", "#222222" },
- [SchemeSel] = { "#eeeeee", "#005577" },
- [SchemeOut] = { "#000000", "#00ffff" },
+ /* fg bg */
+ [SchemeNorm] = { "#dddddd", "#000000" },
+ [SchemeSel] = { "#ffffff", "#66ccff" },
+ [SchemeOut] = { "#000000", "#66ccff" },
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
static unsigned int lines = 0;
diff --git a/dmenu/dmenu.c b/dmenu/dmenu.c
index 40153dc..066d20f 100644
--- a/dmenu/dmenu.c
+++ b/dmenu/dmenu.c
@@ -64,9 +64,12 @@ char color[8];
} ColorShm;
static ColorShm *accentshm;
static char accentcol[8] = "#005577";
+static const double opacity = 0.85;
static void initaccent(void);
static void updateaccent(void);
+static int openaccent(void);
+static void setopacity(Window w, double opacity);
#include "config.h"
@@ -127,13 +130,30 @@ cleanup(void)
XCloseDisplay(dpy);
}
+static int
+openaccent(void)
+{
+ int fd;
+ if (accentshm)
+ return 1;
+ if ((fd = shm_open(SHMNAME, O_RDONLY, 0)) < 0)
+ return 0;
+ accentshm = mmap(NULL, sizeof(ColorShm), PROT_READ, MAP_SHARED, fd, 0);
+ close(fd);
+ if (accentshm == MAP_FAILED) {
+ accentshm = NULL;
+ return 0;
+ }
+ return 1;
+}
+
static void
updateaccent(void)
{
uint32_t s1, s2;
char tmp[8];
- if (!accentshm)
+ if (!accentshm && !openaccent())
return;
do {
s1 = accentshm->seq;
@@ -149,15 +169,7 @@ updateaccent(void)
static void
initaccent(void)
{
-int fd = shm_open(SHMNAME, O_RDONLY, 0);
-if (fd >= 0) {
-accentshm = mmap(NULL, sizeof(ColorShm), PROT_READ,
- MAP_SHARED, fd, 0);
-if (accentshm == MAP_FAILED)
-accentshm = NULL;
-close(fd);
-}
-updateaccent();
+ updateaccent();
}
static char *
cistrstr(const char *h, const char *n)
@@ -240,6 +252,15 @@ drawmenu(void)
}
static void
+setopacity(Window w, double op)
+{
+ unsigned long val = op * 0xffffffff;
+ XChangeProperty(dpy, w, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)&val, 1);
+}
+
+static void
grabfocus(void)
{
struct timespec ts = { .tv_sec = 0, .tv_nsec = 10000000 };
@@ -758,10 +779,11 @@ setup(void)
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
XNClientWindow, win, XNFocusWindow, win, NULL);
- XMapRaised(dpy, win);
- if (embed) {
- XReparentWindow(dpy, win, parentwin, x, y);
- XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
+ XMapRaised(dpy, win);
+ setopacity(win, opacity);
+ if (embed) {
+ XReparentWindow(dpy, win, parentwin, x, y);
+ XSelectInput(dpy, parentwin, FocusChangeMask | SubstructureNotifyMask);
if (XQueryTree(dpy, parentwin, &dw, &w, &dws, &du) && dws) {
for (i = 0; i < du && dws[i] != win; ++i)
XSelectInput(dpy, dws[i], FocusChangeMask);
diff --git a/dwm/config.def.h b/dwm/config.def.h
index 0424ce8..fb3a839 100644
--- a/dwm/config.def.h
+++ b/dwm/config.def.h
@@ -8,11 +8,12 @@ static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10" };
static const char dmenufont[] = "monospace:size=10";
-static const char col_gray1[] = "#222222";
-static const char col_gray2[] = "#444444";
-static const char col_gray3[] = "#bbbbbb";
-static const char col_gray4[] = "#eeeeee";
-static const char col_cyan[] = "#005577";
+static const char col_gray1[] = "#000000";
+static const char col_gray2[] = "#555555";
+static const char col_gray3[] = "#dddddd";
+static const char col_gray4[] = "#ffffff";
+static const char col_cyan[] = "#66ccff";
+static const double baropacity = 0.85;
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
@@ -97,13 +98,13 @@ static const Key keys[] = {
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
- { MODKEY, XK_minus, setgaps, {.i = -1 } },
- { MODKEY, XK_equal, setgaps, {.i = +1 } },
- { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
- { MODKEY, XK_KP_End, spawn, {.v = mediaprev } },
- { MODKEY, XK_KP_Down, spawn, {.v = mediaplaypause } },
- { MODKEY, XK_KP_Page_Down, spawn, {.v = medianext } },
- TAGKEYS( XK_1, 0)
+ { MODKEY, XK_minus, setgaps, {.i = -1 } },
+ { MODKEY, XK_equal, setgaps, {.i = +1 } },
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
+ { MODKEY, XK_KP_End, spawn, {.v = mediaprev } },
+ { MODKEY, XK_KP_Down, spawn, {.v = mediaplaypause } },
+ { MODKEY, XK_KP_Page_Down, spawn, {.v = medianext } },
+ TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
diff --git a/dwm/dwm.c b/dwm/dwm.c
index 633e9d6..21f352e 100644
--- a/dwm/dwm.c
+++ b/dwm/dwm.c
@@ -208,6 +208,7 @@ static void setfullscreen(Client *c, int fullscreen);
static void setgaps(const Arg *arg);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
+static void setopacity(Window w, double opacity);
static void setup(void);
static void initaccent(void);
static void updateaccent(void);
@@ -754,7 +755,7 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
- int x, w, tw = 0;
+ int x, w, tw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
@@ -776,16 +777,18 @@ drawbar(Monitor *m)
urg |= c->tags;
}
x = 0;
- for (i = 0; i < LENGTH(tags); i++) {
- w = TEXTW(tags[i]);
- drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
- drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- urg & 1 << i);
- x += w;
- }
+ for (i = 0; i < LENGTH(tags); i++) {
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
+ w = TEXTW(tags[i]);
+ drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
+ drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
+ if (occ & 1 << i)
+ drw_rect(drw, x + boxs, boxs, boxw, boxw,
+ m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
+ urg & 1 << i);
+ x += w;
+ }
w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
@@ -1626,6 +1629,15 @@ setmfact(const Arg *arg)
arrange(selmon);
}
+static void
+setopacity(Window w, double opacity)
+{
+ unsigned long val = opacity * 0xffffffff;
+ XChangeProperty(dpy, w, XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False),
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *)&val, 1);
+}
+
void
setup(void)
{
@@ -1946,9 +1958,10 @@ updatebars(void)
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
- XMapRaised(dpy, m->barwin);
- XSetClassHint(dpy, m->barwin, &ch);
- }
+ XMapRaised(dpy, m->barwin);
+ setopacity(m->barwin, baropacity);
+ XSetClassHint(dpy, m->barwin, &ch);
+ }
}
void