Conky dissapears when I press "Minimize all"

Please post all general support questions for LXDE here.
Locked
robux
Posts: 5
Joined: Wed Aug 25, 2010 7:19 pm

Conky dissapears when I press "Minimize all"

Post by robux »

When I press a button "Minimize all" ("Show desktop") on LXPanel the conky window dissapears.
My conky config here:

Code: Select all

own_window yes
own_window_class Conky
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
What can you suggest me?
Marty Jack
Posts: 381
Joined: Mon Mar 23, 2009 5:14 am

Re: Conky dissapears when I press "Minimize all"

Post by Marty Jack »

Minimize all is implemented with a single window manager command _NET_SHOW_DESKTOP, so there is no opportunity to discriminate between windows.

We did what you asked for. You asked to minimize all windows, and we did that.

You could dispense with "skip_taskbar" and live with the taskbar button for conky so that you could get just that one window back. Or you could look into whether there is some other window attribute, like "dock", that will prevent whatever window manager you are using from acting on that window.
Truxton Spangler
Posts: 1
Joined: Mon Dec 20, 2010 11:27 am

Re: Conky dissapears when I press "Minimize all"

Post by Truxton Spangler »

I ran into the same problem. While searching i often saw people suggesting setting "own_window_type override" but that didn't work for me.
After some experimenting on my own i came up with this solution which works for me:

Code: Select all

own_window yes
own_window_class conky
own_window_type dock
Then go to the Openbox Configuration Manager -> Dock
- set "Stacking" to: "Keep dock below other windows"
- enable "Allow windows to be placed within the dock's area"
Fisch.666
Posts: 8
Joined: Sat Dec 18, 2010 2:12 pm

Re: Conky dissapears when I press "Minimize all"

Post by Fisch.666 »

Hi!

*Edit*
Problem is fixed. I don't know why, but after adding "@conky -q -d" to my /etc/xdg/autostart conky starts with transparency.
*Edit*

Thanks for this Hint, now pushing the "Minimize all" button doesn't minimize Conky. But now the transparency of conky doesn't work anymore, the background of conky is now black. Did you have the same problem or do you have any hints how to get the transparency to work again?

Thanks in advance for a reply.
inductiveload
Posts: 1
Joined: Wed Feb 08, 2012 5:35 am

Re: Conky dissapears when I press "Minimize all"

Post by inductiveload »

I didn't like using the dock, as I wanted a transparent background. I worked around it by having Conky as a "normal" window with a specific title:

Code: Select all

own_window yes
own_window_type normal
own_window_title myconky
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
Then, instead of using the "Minimise all windows" button, I made a new launcher .desktop with the following Exec field:

Code: Select all

sh -c 'wmctrl -k on; wmctrl -a myconky;'
This uses wmctrl to minimise all windows and then bring up Conky again. Plus you can use a "desktop" icon if you want. Additionally, this won't clutter up the dock, which you could use for actual dockapps, rather than co-opting for Conky.

Edit: concept from http://ubuntuforums.org/archive/index.p ... 15918.html
Aleph
Posts: 1
Joined: Mon Feb 20, 2012 3:17 pm

Re: Conky dissapears when I press "Minimize all"

Post by Aleph »

Hi friends,

I have the same problem, conky minimize when I click on minimize all windows.

Does somebody know if the LXde team is thinking to solve this bug?
dzmanto
Posts: 1
Joined: Tue Mar 12, 2013 10:40 am

Re: Conky dissapears when I press "Minimize all"

Post by dzmanto »

Hi all,

I experienced the same issue with the LXDE minimise button. I wrote the below program conkier.c. I start conkier 3 seconds after conky. That is, I add

Code: Select all

conky; sleep 3; conkier
to my .config/autostart in LXDE.

Enjoy!

Code: Select all

/* 
compile with 
gcc -o conkier conkier.c -L/usr/X11R6/lib -lX11 -I/usr/X11R6/include
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h> /* for sleep() */
#include<X11/keysym.h>
#include<X11/Xlib.h>
#include<X11/Xutil.h>
#include<X11/Xatom.h>

Window cw;

void help() {
	fprintf(stdout, "usage: conkier [options]\r\n");
	fprintf(stdout, "options:\r\n");
	fprintf(stdout, "-h,--help	Show this help.\r\n");
}

// ERROR HANDLER, GENERIC
static int ErrorHandler (Display *display, XErrorEvent *error)
{
   fprintf(stderr, "Error handler triggered.\r\n");
   return(0);
}

// ENUMARATE THROUGH WINDOWS AND DISPLAY THEIR TITLES
enumwin(Display *dpy, Window rootwin, char *sstr)
{
	static int level = 0;
	Window parent;
	Window *children;
	unsigned int noOfChildren;
	int status;
	int i;
	XTextProperty wmName;
	char **list;

	status = XGetWMName (dpy, rootwin, &wmName);
	if ((status) && (wmName.value) && (wmName.nitems))
	{
		status = XmbTextPropertyToTextList (dpy, &wmName, &list, &i);
		if(strcmp(*list,sstr)==0)
		{
			// fprintf(stdout, "Found Conky window.\n");
			// fprintf (stdout, "On level %i with id %02X. \r\n", level, (unsigned int)rootwin);
			cw=rootwin;
			free(list);
			XFree((char*) children);
			return;		
		}
	}

	level++;

	status = XQueryTree (dpy, rootwin, &rootwin, &parent, &children, &noOfChildren);

	for (i=0; i < noOfChildren; i++)
	{
		enumwin(dpy, children[i],sstr);
	}

	XFree((char*) children);
}

int main(int argc, char *argv[])
{
Display *dpy;
int screen;
Window rootwin=-1;
int status;
const char *name = "HOSTNAME";
char *hostname;
int i, len;
char *conkytitle;
char **list;
Atom net_showing_desktop_atom, net_active_window_atom, net_current_desktop_atom, net_wm_desktop_atom;
Atom actual_type;
int done=0;  
int actual_format, current_nsd,previous_nsd;
unsigned long nitems, after;
unsigned char *data = NULL; 
int current_screen, previous_screen;

for(i=0; i<argc; i++) {
	if(strcmp(argv[i],"--help")==0||strcmp(argv[i],"-h")==0) {
		help();
		exit(EXIT_SUCCESS);
	}
}

if(argv[1]) {
	conkytitle=argv[1];
	fprintf(stdout, "Conky title given: '%s'.\r\n", conkytitle);
	
} else {
	hostname=(char *) malloc(100*sizeof(char));
	if(hostname==NULL)
	{
		fprintf(stderr, "Failed to allocate memory for hostname retrieval.\r\nStop.\r\n");
		exit(EXIT_FAILURE);;
	}

	status=gethostname(hostname,100);

	conkytitle=(char *) malloc((10+strlen(hostname))*sizeof(char));
	if(conkytitle==NULL)
	{
		fprintf(stderr, "Failed to allocate memory to guess conky window title.\r\nStop.\r\n");
		exit(EXIT_FAILURE);
	}

	strncpy(conkytitle,"Conky (",7);
	strncat(conkytitle,hostname,strlen(hostname));
	strncat(conkytitle,")",1);
	free(hostname);
	fprintf(stdout, "Presumed conky title: '%s'.\r\n", conkytitle);
}
dpy=XOpenDisplay(NULL);
if(dpy==NULL)
{
	fprintf(stderr,"Failed to open display. Stop.\r\n");
	exit(EXIT_FAILURE);
}

XSetErrorHandler(ErrorHandler);
screen=DefaultScreen(dpy);

rootwin=RootWindow(dpy, screen); 

if(rootwin==-1)
{
	fprintf(stderr,"Failed to obtain root window. Stop.\r\n");
	exit(EXIT_FAILURE);
}

// LOOP THROUGH ALL WINDOWS
cw=-1;
enumwin(dpy, rootwin, conkytitle);

if(cw!=-1)
{
	fprintf(stdout, "Conky window id %02X. \r\n", (unsigned int) cw);
} else
{
	fprintf(stderr, "No conky window with title '%s' found. Stop.\r\n", conkytitle);
	exit(EXIT_FAILURE);
}

net_showing_desktop_atom = XInternAtom(dpy, "_NET_SHOWING_DESKTOP", False);
net_active_window_atom = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
net_current_desktop_atom = XInternAtom(dpy, "_NET_CURRENT_DESKTOP", False);
net_wm_desktop_atom = XInternAtom(dpy, "_NET_WM_DESKTOP", False);

current_nsd=-1;
current_screen=DefaultScreen(dpy);

/* Initialize Xevent struct */
XEvent xev = {
	.xclient = {
		.type=ClientMessage,
		.send_event=True,
		.display=dpy,
		.window=cw,
		.message_type=net_active_window_atom,
		.format=32,
		.data.l[0]=!current_nsd /* ThatÂ’s what we want the new state to be */
	}
};

/* Obtain the current state of _NET_SHOWING_DESKTOP on the default root window */
while(!done)
{
	//1st check if conky has been minimised together with all other windows
	status = XGetWindowProperty(dpy, rootwin, net_showing_desktop_atom, 0, 1, False, XA_CARDINAL, &actual_type, &actual_format, &nitems, &after, &data);
	if(status!=Success) {
		fprintf(stderr, "Received error %d.\n", status);
	}

	/* The current state should be in data[0] */
	if(data) {
		previous_nsd=current_nsd;
		current_nsd=data[0];
		XFree(data);
		data=NULL;
	}

	if(!nitems) {
		fprintf(stderr, "Unexpected result.\r\n");
		fprintf(stderr, "Assuming unshown desktop.\r\n");
		current_nsd=-1;
	}

	if(current_nsd==1 && cw!=-1) {
		xev.xclient.message_type=net_active_window_atom;
		xev.xclient.data.l[0]=!current_nsd;
		XSendEvent(dpy, rootwin, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);	
	}

	// Now check if desktop has been changed
	status = XGetWindowProperty(dpy, rootwin, net_current_desktop_atom, 0, 1, False, XA_CARDINAL, &actual_type, &actual_format, &nitems, &after, &data);
	if(status!=Success) {
		fprintf(stderr, "Received error %d.\n", status);
	}

	/* The current state should be in data[0] */
	if(data) {
		previous_screen=current_screen;
		current_screen=data[0];
		XFree(data);
		data=NULL;
	}

	if(!nitems) {
		fprintf(stderr, "Unexpected result.\r\n");
		fprintf(stderr, "Assuming unshown desktop.\r\n");
		current_screen=-1;
	}

	if(previous_screen!=current_screen && current_screen!=-1){
		// fprintf(stderr,"Desktop changed.\n");
		xev.xclient.message_type=net_wm_desktop_atom;
		xev.xclient.data.l[0]=current_screen;
		XSendEvent(dpy, rootwin, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);		
	}

	usleep(100000);
}

XCloseDisplay(dpy);
free(conkytitle);
exit(EXIT_SUCCESS);
}
Locked