Xfce Forum

Sub domains
 

You are not logged in.

#1 2017-03-13 13:12:44

Malaise
Member
From: France
Registered: 2017-03-09
Posts: 2

Icon in workspace switcher

Hello,

I have applications directly at X11 level for which I want to define the icons in xpm. It works in the sense that the icon properly appears in the task bar. My problem is to have this icon displayed in the workspace switcher.

I have two PCs Ubuntu 16.04.2 LTS.
- on one, the icon appears in the switcher. If I resize the window too small, then the icon disappears. Only a small blue window with white border is displayed in the switcher. If I resize the window wider again, then the icon re-appears.
- on the other PC the icon is never displayed in the switcher area, whatever size the window.

What are the citeria for xfce to display (or not) the icon of a window in the switch area?
Thank you


Here is the code:

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/xpm.h>

#include "icon.xpm"

int main (void) {

  // Display
  Display* dpy;
  dpy = XOpenDisplay(NULL);

  // Colormap
  Colormap cmap;
  XColor c0, c1;
  cmap = DefaultColormap(dpy, 0);
  XAllocNamedColor(dpy, cmap, "forestgreen", &c1, &c0);

  // Window
  Window win;
  win =  XCreateSimpleWindow(dpy, RootWindow(dpy, 0), 0, 0,
                             670, 700, 0, 0, c1.pixel);

  // Icon
  Pixmap icon_pixmap;
  XWMHints* win_hints;
  char **icon_def = (char**)(unsigned long)icon_xpm;
  XpmCreatePixmapFromData (dpy, win, icon_def, &icon_pixmap, NULL, NULL);
  win_hints = XAllocWMHints();
  win_hints->flags = IconPixmapHint;
  win_hints->icon_pixmap = icon_pixmap;
  XSetWMHints(dpy, win, win_hints);
  XFree(win_hints);

  XStoreName(dpy, win, "xfc");

  // Main loop
  XMapWindow(dpy, win);
  XEvent ev;
  for (;;)  {
    XNextEvent(dpy, &ev);
  }

  return 0;
}

The icon is defined as:

/* XPM */
static const char * icon_xpm[] = {
"46 48 10 1",
"       c #006600",
".      c #F33331",
"+      c #1C8B1F",
"@      c #687262",
"#      c #439177",
"$      c #8CA1A9",
"%      c #F98D8B",
"&      c #94B28E",
"*      c #D0D5C8",
"=      c #FBFAF8",
...

Offline

Board footer

Powered by FluxBB