Implemented Transparency
This commit is contained in:
parent
e04da92807
commit
36efd8846c
@ -11,6 +11,7 @@ char *format = "%s %b"; /* default format */
|
|||||||
|
|
||||||
int timeouts[] = { 10, 10, 0 }; /* low, normal, critical */
|
int timeouts[] = { 10, 10, 0 }; /* low, normal, critical */
|
||||||
|
|
||||||
|
unsigned int transparency = 1; /* transparency */
|
||||||
char *geom = "0x0"; /* geometry */
|
char *geom = "0x0"; /* geometry */
|
||||||
int sort = True; /* sort messages by urgency */
|
int sort = True; /* sort messages by urgency */
|
||||||
int indicate_hidden = True; /* show count of hidden messages */
|
int indicate_hidden = True; /* show count of hidden messages */
|
||||||
|
11
draw.c
11
draw.c
@ -36,6 +36,9 @@ DEALINGS IN THE SOFTWARE.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/X.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
|
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
@ -231,6 +234,14 @@ void initfont(DC * dc, const char *fontstr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setopacity(DC *dc, Window win, unsigned long opacity)
|
||||||
|
{
|
||||||
|
Atom _NET_WM_WINDOW_OPACITY = XInternAtom(dc->dpy, "_NET_WM_WINDOW_OPACITY", False);
|
||||||
|
XChangeProperty(dc->dpy, win, _NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32, PropModeReplace,
|
||||||
|
(unsigned char *)&opacity, 1L);
|
||||||
|
}
|
||||||
|
|
||||||
void mapdc(DC * dc, Window win, unsigned int w, unsigned int h)
|
void mapdc(DC * dc, Window win, unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
XCopyArea(dc->dpy, dc->canvas, win, dc->gc, 0, 0, w, h, 0, 0);
|
XCopyArea(dc->dpy, dc->canvas, win, dc->gc, 0, 0, w, h, 0, 0);
|
||||||
|
1
draw.h
1
draw.h
@ -70,6 +70,7 @@ unsigned long getcolor(DC * dc, const char *colstr);
|
|||||||
ColorSet *initcolor(DC * dc, const char *foreground, const char *background);
|
ColorSet *initcolor(DC * dc, const char *foreground, const char *background);
|
||||||
DC *initdc(void);
|
DC *initdc(void);
|
||||||
void initfont(DC * dc, const char *fontstr);
|
void initfont(DC * dc, const char *fontstr);
|
||||||
|
void setopacity(DC *dc, Window win, unsigned long opacity);
|
||||||
void mapdc(DC * dc, Window win, unsigned int w, unsigned int h);
|
void mapdc(DC * dc, Window win, unsigned int w, unsigned int h);
|
||||||
void resizedc(DC * dc, unsigned int w, unsigned int h);
|
void resizedc(DC * dc, unsigned int w, unsigned int h);
|
||||||
int textnw(DC * dc, const char *text, size_t len);
|
int textnw(DC * dc, const char *text, size_t len);
|
||||||
|
4
dunst.c
4
dunst.c
@ -1270,7 +1270,7 @@ void setup(void)
|
|||||||
CopyFromParent, DefaultVisual(dc->dpy,
|
CopyFromParent, DefaultVisual(dc->dpy,
|
||||||
DefaultScreen(dc->dpy)),
|
DefaultScreen(dc->dpy)),
|
||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||||
|
setopacity(dc, win, (unsigned long)(transparency * (0xffffffff/100)));
|
||||||
grab_key(&history_ks);
|
grab_key(&history_ks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1565,6 +1565,8 @@ dunst_ini_handle(void *user_data, const char *section,
|
|||||||
sticky_history = dunst_ini_get_boolean(value);
|
sticky_history = dunst_ini_get_boolean(value);
|
||||||
else if (strcmp(name, "separator_height") == 0)
|
else if (strcmp(name, "separator_height") == 0)
|
||||||
separator_height = atoi(value);
|
separator_height = atoi(value);
|
||||||
|
else if (strcmp(name, "transparency") == 0)
|
||||||
|
transparency = (100 - atoi(value));
|
||||||
if (strcmp(name, "separator_color") == 0) {
|
if (strcmp(name, "separator_color") == 0) {
|
||||||
char *str = dunst_ini_get_string(value);
|
char *str = dunst_ini_get_string(value);
|
||||||
if (strcmp(str, "auto") == 0)
|
if (strcmp(str, "auto") == 0)
|
||||||
|
3
dunstrc
3
dunstrc
@ -38,6 +38,9 @@
|
|||||||
# right side of the screen. Y is measured from the top and down respectevly.
|
# right side of the screen. Y is measured from the top and down respectevly.
|
||||||
geometry = "0x3-30+20"
|
geometry = "0x3-30+20"
|
||||||
|
|
||||||
|
# the transparency of the window. range: [0; 100]
|
||||||
|
transparency = 25
|
||||||
|
|
||||||
# Don't remove messages, if the user is idle (no mouse or keyboard input)
|
# Don't remove messages, if the user is idle (no mouse or keyboard input)
|
||||||
# for longer than idle_threshold seconds.
|
# for longer than idle_threshold seconds.
|
||||||
# Set to 0 to disable.
|
# Set to 0 to disable.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user