Commit b59a2037 authored by uoou's avatar uoou

hello

parent b293023c
......@@ -34,15 +34,25 @@ convert "$location" \
-compose Overlay -layers composite \
-set colorspace CMYK -combine -colorspace RGB \
"$location" &&
convert "$location" \
-virtual-pixel edge -channel M -fx "p[-5,-1]" \
"$location" &&
ratio=$(convert "$location" -format "%[fx:w/h]" info:)
brightness=$(identify -format "%[fx:mean]\n" "$location")
brightness=$(echo - | awk "{print $brightness * 100}")
brightness=${brightness%.*}
if (( $(awk 'BEGIN {print ("'$location'" < "'1.7'")}') )); then
convert "$location" -gravity West -chop 6x0 "$location"
if [ "$brightness" -le "66" ];then
# too dark, go again
echo "too dark, going again"
/home/drew/.local/bin/randmovwp
else
convert "$location" \
-virtual-pixel edge -channel M -fx "p[-5,-1]" \
"$location" &&
ratio=$(convert "$location" -format "%[fx:w/h]" info:)
if (( $(awk 'BEGIN {print ("'$location'" < "'1.7'")}') )); then
convert "$location" -gravity West -chop 6x0 "$location"
fi
feh --bg-fill --no-xinerama "$location" --geometry +0+100
fi
feh --bg-fill --no-xinerama "$location" --geometry +0+100
#!/usr/bin/env bash
baseuri="https://github.com/GloriousEggroll/proton-ge-custom/releases/download"
latesturi="https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest"
dstpath="$HOME/.steam/root/compatibilitytools.d"
ge_ver="${1}"
if [ -z "$ge_ver" ]
then
latestversion="$(curl -s $latesturi | egrep -m1 "tag_name" | cut -d \" -f4)"
if [[ -d $dstpath/Proton-$latestversion ]]
then
echo "Proton $latestversion is the latest version and is already installed."
else
echo "Proton $latestversion is the latest version and is not installed yet."
fi
read -p "Do you want to download and (re)install this release? <y/N> " prompt
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
then
url=$(curl -s $latesturi | egrep -m1 "browser_download_url.*Proton" | cut -d \" -f4)
else
echo "Operation canceled"
exit 0
fi
elif [ $ge_ver == "-l" ]
then
curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases | grep -H "tag_name" | cut -d \" -f4
else
if [[ -d $dstpath/Proton-$ge_ver ]]
then
echo "Proton $ge_ver is already installed."
else
echo "Proton $ge_ver is not installed yet."
fi
read -p "Do you want to try to download and (re)install this release? <y/N> " prompt
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]
then
url=$baseuri/"$ge_ver"/Proton-"$ge_ver".tar.gz
else
echo "Operation canceled"
exit 0
fi
fi
if [ ! "$ge_ver" == "-l" ]
then
rsp="$(curl -sI "$url" | head -1)"
echo "$rsp" | grep -q 302 || {
echo "$rsp"
exit 1
}
[ -d "$dstpath" ] || {
mkdir "$dstpath"
echo [Info] Created "$dstpath"
}
curl -sL "$url" | tar xfzv - -C "$dstpath"
fi
" Maintainer: Alexander Imenes <[email protected]>
" Repository: http://github.com/reewr
"
" Note: This file is auto-generated using a script of mine. If you have
" any complaints about the syntax or readability of this file,
" please make an issue. You can also see the tool used to create
" this colourscheme at github.com/reewr/monokai-phoenix-builder
" uoou based on monokai-phoenix
set background=dark
hi clear
......@@ -13,42 +7,42 @@ if exists("syntax_on")
syntax reset
endif
let colors_name="monokai-phoenix"
let colors_name="uoou"
" Below are the colours used for this colourscheme with their fullname
"
" #5F87AF, Term: 67 4
" #420E09, Term: 52
" #334455, Term: 59
" #111111, Term: NONE
" #000000, Term: 08
" #211F1C, Term: 00
" #960020, Term: 88
" #FD971F, Term: 208
" #FF00FF, Term: 13
" #FF0000, Term: 09
" #F92782, Term: 197 1
" #2F312B, Term: 22
" #75715E, Term: 95
" #49483E, Term: 59
" #8F908A, Term: 102
" #A6E22E, Term: 112 2
" #AE81FF, Term: 141 5
" #778899, Term: 103
" #222218, Term: 00
" #223344, Term: 23
" #253B22, Term: 22
" #9D550F, Term: 130
" #F92672, Term: 197 1
" #3C1518, Term: 52
" #F8F8F2, Term: 15
" #66D9EF, Term: 81 6
" #66D9EF, Term: 81 6
" #383A3E, Term: 236
" #F8F8F2, Term: 15
" #F8F8F8, Term: 15
" #E6DB74, Term: 185 3
" #FFE972, Term: 221
" Below are the colours used for this colourscheme
"
" 67 4
" 52
" 59
" NONE
" 08
" 00
" 88
" 208
" 13
" 09
" 197 1
" 22
" 95
" 59
" 102
" 112 2
" 141 5
" 103
" 00
" 23
" 22
" 130
" 197 1
" 52
" 15
" 81 6
" 81 6
" 236
" 15
" 15
" 185 3
" 221
" Popup Menu
" --------------------------
......
/home/drew/.config/systemd/user/rmovwallp.timer
\ No newline at end of file
......@@ -25,8 +25,7 @@ export __GL_SHADER_DISK_CACHE=1
export PROTON_FORCE_LARGE_ADDRESS_AWARE=1
# tiler stuff
#feh --bg-fill --no-xinerama ~/Pictures/Wallpapers/frame.png --geometry +0+100
hsetroot -solid "#555"
feh --bg-fill --no-xinerama ~/Pictures/Wallpapers/frame.png --geometry +0+100
picom -b
clipmenud &
(sleep 1 && "$TERMCMD" -n "files" -e nnn -R) &
......
......@@ -12,7 +12,7 @@ index 9762166..6ed8ad3 100644
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/config.def.h b/config.def.h
index 1edb647..c47f50a 100644
index 1edb647..1100ce0 100644
--- a/config.def.h
+++ b/config.def.h
@@ -4,14 +4,15 @@
......@@ -29,8 +29,8 @@ index 1edb647..c47f50a 100644
- [SchemeNorm] = { "#bbbbbb", "#222222" },
- [SchemeSel] = { "#eeeeee", "#005577" },
- [SchemeOut] = { "#000000", "#00ffff" },
+ [SchemeNorm] = { "#ffffff", "#0f0f0f" },
+ [SchemeSel] = { "#ff009e", "#0f0f0f" },
+ [SchemeNorm] = { "#ffffff", "#030303" },
+ [SchemeSel] = { "#ff009e", "#030303" },
+ [SchemeOut] = { "#000000", "#00ffff" },
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
......
......@@ -12,7 +12,7 @@ index 9762166..6ed8ad3 100644
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/config.def.h b/config.def.h
index 1edb647..7a661e0 100644
index 1edb647..c47f50a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -4,14 +4,15 @@
......@@ -20,8 +20,8 @@ index 1edb647..7a661e0 100644
/* -fn option overrides fonts[0]; default X11 font or font set */
static const char *fonts[] = {
- "monospace:size=10"
+ "Fira Code:size=10",
+ "JoyPixels:pixelsize=10:antialias=true:autohint=true"
+ "Fira Code:size=11",
+ "JoyPixels:pixelsize=11:antialias=true:autohint=true"
};
static const char *prompt = NULL; /* -p option; prompt to the left of input field */
static const char *colors[SchemeLast][2] = {
......@@ -29,8 +29,8 @@ index 1edb647..7a661e0 100644
- [SchemeNorm] = { "#bbbbbb", "#222222" },
- [SchemeSel] = { "#eeeeee", "#005577" },
- [SchemeOut] = { "#000000", "#00ffff" },
+ [SchemeNorm] = { "#ffffff", "#030303" },
+ [SchemeSel] = { "#ff009e", "#030303" },
+ [SchemeNorm] = { "#ffffff", "#0f0f0f" },
+ [SchemeSel] = { "#ff009e", "#0f0f0f" },
+ [SchemeOut] = { "#000000", "#00ffff" },
};
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
......
diff --git a/config.mk b/config.mk
index 6d36cb7..3cb1518 100644
--- a/config.mk
+++ b/config.mk
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/drw.c b/drw.c
index 8fd1ca4..c202cb3 100644
--- a/drw.c
+++ b/drw.c
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
}
Drw *
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
{
Drw *drw = ecalloc(1, sizeof(Drw));
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->root = root;
drw->w = w;
drw->h = h;
- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
- drw->gc = XCreateGC(dpy, root, 0, NULL);
+ drw->visual = visual;
+ drw->depth = depth;
+ drw->cmap = cmap;
+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
}
void
@@ -193,21 +196,22 @@ drw_fontset_free(Fnt *font)
}
void
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
{
if (!drw || !dest || !clrname)
return;
- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen),
+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
+
+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
* returned color scheme when done using it. */
Clr *
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
{
size_t i;
Clr *ret;
@@ -217,7 +221,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
return NULL;
for (i = 0; i < clrcount; i++)
- drw_clr_create(drw, &ret[i], clrnames[i]);
+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
return ret;
}
@@ -273,9 +277,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen));
+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
x += lpad;
w -= lpad;
}
diff --git a/drw.h b/drw.h
index 4bcd5ad..a56f523 100644
--- a/drw.h
+++ b/drw.h
@@ -20,6 +20,9 @@ typedef struct {
Display *dpy;
int screen;
Window root;
+ Visual *visual;
+ unsigned int depth;
+ Colormap cmap;
Drawable drawable;
GC gc;
Clr *scheme;
@@ -27,7 +30,7 @@ typedef struct {
} Drw;
/* Drawable abstraction */
-Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h);
+Drw *drw_create(Display *dpy, int screen, Window win, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap);
void drw_resize(Drw *drw, unsigned int w, unsigned int h);
void drw_free(Drw *drw);
@@ -38,8 +41,8 @@ unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
/* Colorscheme abstraction */
-void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
+void drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha);
+Clr *drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount);
/* Cursor abstraction */
Cur *drw_cur_create(Drw *drw, int shape);
diff --git a/dwm.c b/dwm.c
index 4465af1..20f8309 100644
--- a/dwm.c
+++ b/dwm.c
@@ -57,6 +57,8 @@
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
+#define OPAQUE 0xffU
+
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
@@ -232,6 +234,7 @@ 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);
+static void xinitvisual();
static void zoom(const Arg *arg);
/* variables */
@@ -268,6 +271,11 @@ static Drw *drw;
static Monitor *mons, *selmon;
static Window root, wmcheckwin;
+static int useargb = 0;
+static Visual *visual;
+static int depth;
+static Colormap cmap;
+
/* configuration, allows nested code to access above variables */
#include "config.h"
@@ -1541,7 +1549,8 @@ setup(void)
sw = DisplayWidth(dpy, screen);
sh = DisplayHeight(dpy, screen);
root = RootWindow(dpy, screen);
- drw = drw_create(dpy, screen, root, sw, sh);
+ xinitvisual();
+ drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
die("no fonts could be loaded.");
lrpad = drw->fonts->h;
@@ -1569,7 +1578,7 @@ setup(void)
/* init appearance */
scheme = ecalloc(LENGTH(colors), sizeof(Clr *));
for (i = 0; i < LENGTH(colors); i++)
- scheme[i] = drw_scm_create(drw, colors[i], 3);
+ scheme[i] = drw_scm_create(drw, colors[i], alphas[i], 3);
/* init bars */
updatebars();
updatestatus();
@@ -1804,16 +1813,18 @@ updatebars(void)
Monitor *m;
XSetWindowAttributes wa = {
.override_redirect = True,
- .background_pixmap = ParentRelative,
+ .background_pixel = 0,
+ .border_pixel = 0,
+ .colormap = cmap,
.event_mask = ButtonPressMask|ExposureMask
};
XClassHint ch = {"dwm", "dwm"};
for (m = mons; m; m = m->next) {
if (m->barwin)
continue;
- m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
- CopyFromParent, DefaultVisual(dpy, screen),
- CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
+ InputOutput, visual,
+ CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
XMapRaised(dpy, m->barwin);
XSetClassHint(dpy, m->barwin, &ch);
@@ -2110,6 +2121,43 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
return -1;
}
+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);
+ }
+}
+
void
zoom(const Arg *arg)
{
diff --git a/config.def.h b/config.def.h
index 1c0b587..45cde15 100644
index 1c0b587..8930dda 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,21 +1,24 @@
@@ -1,21 +1,31 @@
/* See LICENSE file for copyright and license details. */
/* appearance */
......@@ -28,9 +28,11 @@ index 1c0b587..45cde15 100644
+static const int topbar = 1; /* 0 means bottom bar */
+static const char *fonts[] = { "Fira Code:size=11", "JoyPixels:pixelsize=10:antialias=true:autohint=true" };
+static const char dmenufont[] = "Fira Code:size=11";
+static const char col_dark_grey[] = "#0f0f0f";
+static const char col_dark_grey[] = "#030303";
+static const char col_red[] = "#ff009e";
+static const char col_white[] = "#ffffff";
+static const unsigned int baralpha = 0xd8;
+static const unsigned int borderalpha = OPAQUE;
static const char *colors[][3] = {
- /* fg bg border */
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
......@@ -38,10 +40,15 @@ index 1c0b587..45cde15 100644
+ /* fg bg border */
+ [SchemeNorm] = { col_white, col_dark_grey, col_dark_grey },
+ [SchemeSel] = { col_red, col_dark_grey, col_white },
+};
+static const unsigned int alphas[][3] = {
+ /* fg bg border */
+ [SchemeNorm] = { OPAQUE, baralpha, baralpha },
+ [SchemeSel] = { OPAQUE, baralpha, OPAQUE },
};
/* tagging */
@@ -26,16 +29,25 @@ static const Rule rules[] = {
@@ -26,16 +36,25 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
......@@ -72,7 +79,7 @@ index 1c0b587..45cde15 100644
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
@@ -44,7 +56,7 @@ static const Layout layouts[] = {
@@ -44,7 +63,7 @@ static const Layout layouts[] = {
};
/* key definitions */
......@@ -81,7 +88,7 @@ index 1c0b587..45cde15 100644
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
@@ -56,44 +68,99 @@ static const Layout layouts[] = {
@@ -56,44 +75,99 @@ static const Layout layouts[] = {
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
......
diff --git a/config.mk b/config.mk
index 6d36cb7..3cb1518 100644
--- a/config.mk
+++ b/config.mk
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
diff --git a/drw.c b/drw.c
index 8fd1ca4..c202cb3 100644
--- a/drw.c
+++ b/drw.c
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
}
Drw *
-drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
+drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
{
Drw *drw = ecalloc(1, sizeof(Drw));
@@ -70,8 +70,11 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
drw->root = root;
drw->w = w;
drw->h = h;
- drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
- drw->gc = XCreateGC(dpy, root, 0, NULL);
+ drw->visual = visual;
+ drw->depth = depth;
+ drw->cmap = cmap;
+ drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
+ drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
return drw;
@@ -87,7 +90,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
drw->h = h;
if (drw->drawable)
XFreePixmap(drw->dpy, drw->drawable);
- drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
+ drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
}
void
@@ -193,21 +196,22 @@ drw_fontset_free(Fnt *font)
}
void
-drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
+drw_clr_create(Drw *drw, Clr *dest, const char *clrname, unsigned int alpha)
{
if (!drw || !dest || !clrname)
return;
- if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen),
+ if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
+
+ dest->pixel = (dest->pixel & 0x00ffffffU) | (alpha << 24);
}
/* Wrapper to create color schemes. The caller has to call free(3) on the
* returned color scheme when done using it. */
Clr *
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
+drw_scm_create(Drw *drw, const char *clrnames[], const unsigned int alphas[], size_t clrcount)
{
size_t i;
Clr *ret;
@@ -217,7 +221,7 @@ drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
return NULL;
for (i = 0; i < clrcount; i++)
- drw_clr_create(drw, &ret[i], clrnames[i]);
+ drw_clr_create(drw, &ret[i], clrnames[i], alphas[i]);
return ret;
}
@@ -273,9 +277,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
} else {
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
- DefaultColormap(drw->dpy, drw->screen));
+ d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
x += lpad;
w -= lpad;
}
diff --git a/drw.h b/drw.h
index 4bcd5ad..a56f523 100644
--- a/drw.h
+++ b/drw.h
@@ -20,6 +20,9 @@ typedef struct {
Display *dpy;
int screen;
Window root;
+ Visual *visual;
+ unsigned int depth;