Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-02-26 23:14:49

billsmugs
Member
Registered: 2015-02-26
Posts: 4

Window Buttons (size and icon theming)

It would be nice if the panel icons for open applications could be resized to >32px, and if they followed the currently active icon theme. If there are any ways to achieve this, please let me know! I'm not a fan of the various docks that I've tried (dockbarx, cairo-dock, plank, docky, probably others I'm forgetting), as I like the simplicity of the default Xfce panels, but with the setup I've currently got some larger icons (using the Numix-Circle icon set that I'm using in the rest of the OS) would look a lot better.

I'm currently getting around this with a very hacky solution where I've recompiled the deafult tasklist panel plugin with the following lines in tasklist-widget.c

  /* get the window icon */
  if (tasklist->show_labels)
    pixbuf = wnck_window_get_mini_icon (window);
  else
   pixbuf = wnck_window_get_icon (window);

replaced with the (fairly horrible and specialised for the programs I most often use) code below:

  /* get the window icon */
  if (tasklist->show_labels)
    pixbuf = wnck_window_get_mini_icon (window);
  else
  {
    GError* gError = NULL;
    GdkPixbuf* pixbuf_temp;

    /* Get the icon name - these are all far from perfect, but this one gives the best results! */
    //gchar* icon_name = wnck_application_get_name(wnck_window_get_application (window));
    //gchar* icon_name = wnck_window_get_name(window);
    gchar* icon_name = wnck_application_get_icon_name(wnck_window_get_application(window));

    //Convert to lower case - this gets a few icons correctly automatically
    int i;
    for(i = 0; icon_name[i]; i++)
    {
      icon_name[i] = tolower(icon_name[i]);
    }

    /* manual hacks for commonly used programs that don't automatically work*/
    if (strstr(icon_name, "google chrome") != NULL)
    {
      icon_name = "google-chrome";
    }
    else if (strstr(icon_name, " - atom") != NULL)
    {
      icon_name = "atom";
    }
    else if (strstr(icon_name, "xfce terminal") != NULL)
    {
      icon_name = "terminal";
    }
    else if (strstr(icon_name, "catfish") != NULL)
    {
      icon_name = "catfish";
    }
    else if (strstr(icon_name, "pcmanfm") != NULL)
    {
      icon_name = "file-manager";
    }
    else if (strstr(icon_name, "intellij idea 14") != NULL)
    {
      icon_name = "idea";
    }
    else if (strstr(icon_name, "libreoffice 4.3") != NULL)
    {
      icon_name = "libreoffice-writer";
    }
    else if (strstr(icon_name, "gnu image manipulation program") != NULL)
    {
      icon_name = "gimp";
    }
    else if (strstr(icon_name, "gcalctool") != NULL)
    {
      icon_name = "calc";
    }
    else if (strstr(icon_name, "clion cl-140") != NULL || strstr(icon_name, "welcome to clion") != NULL )
    {
      icon_name = "clion";
    }
    else if (strstr(icon_name, "system monitor") != NULL)
    {
      icon_name = "utilities-system-monitor";
    }

    /* This is defined as a global variable at the top of the file */
    if (!gtkIconTheme)
      gtkIconTheme = gtk_icon_theme_get_default();

    pixbuf = gtk_icon_theme_load_icon (gtkIconTheme, icon_name, 128, 0, &gError);

    //Need to look into this (to do with memory (de)allocation), the below lines don't work:
    //pixbuf = gdk_pixbuf_copy(pixbuf);
    //g_object_unref(pixbuf_temp);

    /*Fall back to the old way of doing things when my new way fails*/
    if(gError!=NULL)
      pixbuf = wnck_window_get_icon (window);
  }

I then build libtasklist.so and copy it over the existing one in /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins, restart the panel and go from the top image to the bottom one:
comparebqu1f.png

I've rotated and cropped the image to take up less room, see the full screenshots at the following links:
Before
After

With larger panel sizes (useful for large screens or high DPI displays), this would be even more important. Does anyone know of a way this can be done (properly, not like my version!) without completely re-writing the tasklist plugin?

Offline

#2 2015-11-10 19:25:14

bio2
Member
Registered: 2014-01-08
Posts: 7

Re: Window Buttons (size and icon theming)

Hi,
what version of Xfce are you using?
If 4.12, can you post  libtasklist.so?

--
thread: https://forum.xfce.org/viewtopic.php?pid=39428#p39428

Offline

#3 2015-11-10 20:12:16

billsmugs
Member
Registered: 2015-02-26
Posts: 4

Re: Window Buttons (size and icon theming)

I am using 4.12, I've uploaded my libtasklist.so here: https://drive.google.com/file/d/0B7pnEQ … sp=sharing

This does attempt to load icons from your icon theme, and may occasionally load the wrong icon, based on the title of the window. I've customised it to work properly for most of the applications that I use frequently, but I can't guarantee that it will work flawlessly for you.

Another tweak that exists in this version of libtasklist.so is that if you put an icon called "CUSTOM_FALLBACK.svg" in your active icon theme's /scalable/apps folder then it will use that instead of the low-res default icon for windows that don't provide an icon.

Some programs will still have small icons, when a valid icon can't be found in your icon theme. This is the case for a few of the xfce settings windows (e.g. keyboard settings). You can work around this for programs you use often by copying the relevant icon in your theme folder and renaming it to the name found for that application by running the following executable (which dumps out the names inferred by my tasklist modification for all open windows): https://drive.google.com/file/d/0B7pnEQ … sp=sharing (If you want to compile it yourself for security, the source is here: https://drive.google.com/file/d/0B7pnEQ … sp=sharing and the comment at the top of the file gives the gcc flags used to compile it. You'll probably need to install the libwnck-3-dev package (on Ubuntu) to compile it).

Hopefully this works for your needs.

Offline

Board footer

Powered by FluxBB