mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-28 13:00:45 +00:00
make own_window_transparent a lua setting
This commit is contained in:
parent
94be4f6eb9
commit
518045eaf6
12
src/conky.cc
12
src/conky.cc
@ -361,9 +361,6 @@ static int draw_shades, draw_outline;
|
|||||||
|
|
||||||
long default_fg_color, default_bg_color, default_out_color;
|
long default_fg_color, default_bg_color, default_out_color;
|
||||||
|
|
||||||
/* create own window or draw stuff to root? */
|
|
||||||
static int set_transparent = 0;
|
|
||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
static int background_colour = 0;
|
static int background_colour = 0;
|
||||||
|
|
||||||
@ -2695,11 +2692,11 @@ static void X11_create_window(void)
|
|||||||
if (out_to_x.get(*state)) {
|
if (out_to_x.get(*state)) {
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
||||||
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, background_colour,
|
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, background_colour,
|
||||||
xargv, xargc);
|
xargv, xargc);
|
||||||
#else /* OWN_WINDOW */
|
#else /* OWN_WINDOW */
|
||||||
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
init_window(text_width + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2,
|
||||||
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, set_transparent, 0,
|
text_height + window.border_inner_margin * 2 + window.border_outer_margin * 2 + window.border_width * 2, 0,
|
||||||
xargv, xargc);
|
xargv, xargc);
|
||||||
#endif /* OWN_WINDOW */
|
#endif /* OWN_WINDOW */
|
||||||
|
|
||||||
@ -3240,11 +3237,6 @@ char load_config_file(const char *f)
|
|||||||
}
|
}
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
CONF("own_window_transparent") {
|
|
||||||
if (value) {
|
|
||||||
set_transparent = string_to_bool(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
CONF("own_window_hints") {
|
CONF("own_window_hints") {
|
||||||
if (value) {
|
if (value) {
|
||||||
char *p_hint, *p_save;
|
char *p_hint, *p_save;
|
||||||
|
11
src/x11.cc
11
src/x11.cc
@ -61,7 +61,6 @@ Display *display = NULL;
|
|||||||
int display_width;
|
int display_width;
|
||||||
int display_height;
|
int display_height;
|
||||||
int screen;
|
int screen;
|
||||||
static int set_transparent;
|
|
||||||
static int background_colour;
|
static int background_colour;
|
||||||
|
|
||||||
/* workarea from _NET_WORKAREA, this is where window / text is aligned */
|
/* workarea from _NET_WORKAREA, this is where window / text is aligned */
|
||||||
@ -186,7 +185,7 @@ void set_transparent_background(Window win, int alpha)
|
|||||||
#ifdef BUILD_ARGB
|
#ifdef BUILD_ARGB
|
||||||
if (have_argb_visual) {
|
if (have_argb_visual) {
|
||||||
// real transparency
|
// real transparency
|
||||||
if (set_transparent) {
|
if (set_transparent.get(*state)) {
|
||||||
XSetWindowBackground(display, win, 0x00);
|
XSetWindowBackground(display, win, 0x00);
|
||||||
} else if (colour_set != background_colour) {
|
} else if (colour_set != background_colour) {
|
||||||
XSetWindowBackground(display, win,
|
XSetWindowBackground(display, win,
|
||||||
@ -197,7 +196,7 @@ void set_transparent_background(Window win, int alpha)
|
|||||||
#endif /* BUILD_ARGB */
|
#endif /* BUILD_ARGB */
|
||||||
// pseudo transparency
|
// pseudo transparency
|
||||||
|
|
||||||
if (set_transparent) {
|
if (set_transparent.get(*state)) {
|
||||||
Window parent = win;
|
Window parent = win;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -262,13 +261,11 @@ void destroy_window(void)
|
|||||||
colour_set = -1;
|
colour_set = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_window(int w, int h, int set_trans, int back_colour,
|
void init_window(int w, int h, int back_colour, char **argv, int argc)
|
||||||
char **argv, int argc)
|
|
||||||
{
|
{
|
||||||
/* There seems to be some problems with setting transparent background
|
/* There seems to be some problems with setting transparent background
|
||||||
* (on fluxbox this time). It doesn't happen always and I don't know why it
|
* (on fluxbox this time). It doesn't happen always and I don't know why it
|
||||||
* happens but I bet the bug is somewhere here. */
|
* happens but I bet the bug is somewhere here. */
|
||||||
set_transparent = set_trans;
|
|
||||||
background_colour = back_colour;
|
background_colour = back_colour;
|
||||||
window_created = 1;
|
window_created = 1;
|
||||||
|
|
||||||
@ -937,6 +934,8 @@ conky::config_setting<bool> out_to_x("out_to_x", conky::simple_accessors<bool>(f
|
|||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
conky::config_setting<bool> own_window("own_window", conky::simple_accessors<bool>(false, false));
|
conky::config_setting<bool> own_window("own_window", conky::simple_accessors<bool>(false, false));
|
||||||
|
conky::config_setting<bool> set_transparent("own_window_transparent",
|
||||||
|
conky::simple_accessors<bool>(false, false));
|
||||||
conky::config_setting<std::string> own_window_class("own_window_class",
|
conky::config_setting<std::string> own_window_class("own_window_class",
|
||||||
conky::simple_accessors<std::string>(PACKAGE_NAME, false));
|
conky::simple_accessors<std::string>(PACKAGE_NAME, false));
|
||||||
|
|
||||||
|
@ -116,8 +116,7 @@ extern struct conky_window window;
|
|||||||
extern char window_created;
|
extern char window_created;
|
||||||
|
|
||||||
void init_X11(const char*);
|
void init_X11(const char*);
|
||||||
void init_window(int width, int height, int set_trans,
|
void init_window(int width, int height, int back_colour, char **argv, int argc);
|
||||||
int back_colour, char **argv, int argc);
|
|
||||||
void destroy_window(void);
|
void destroy_window(void);
|
||||||
void create_gc(void);
|
void create_gc(void);
|
||||||
void set_transparent_background(Window win, int alpha);
|
void set_transparent_background(Window win, int alpha);
|
||||||
@ -154,6 +153,7 @@ extern conky::config_setting<bool> out_to_x;
|
|||||||
|
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
extern conky::config_setting<bool> own_window;
|
extern conky::config_setting<bool> own_window;
|
||||||
|
extern conky::config_setting<bool> set_transparent;
|
||||||
extern conky::config_setting<std::string> own_window_class;
|
extern conky::config_setting<std::string> own_window_class;
|
||||||
extern conky::config_setting<std::string> own_window_title;
|
extern conky::config_setting<std::string> own_window_title;
|
||||||
#ifdef BUILD_ARGB
|
#ifdef BUILD_ARGB
|
||||||
|
Loading…
Reference in New Issue
Block a user