Subject: xfce4-power-manager-plugins: plugin icon is missing

From: Zlatko Calusic <[email-masked]>
Date: Mon, 22 Sep 2014 22:51:20 +0200

Package: xfce4-power-manager-plugins
Version: 1.4.0-2
Severity: normal

I like new xfpm plugin very much, there's just one small problem with
it. On the desktop, where I have an UPS connected via USB cable,
there's no icon in the xfce panel (previously, there was an icon in
the tray). But, on the laptop (equipped with a battery), I see the
icon.

Just to be clear, I'm not talking about trayicon, I know it's gone,
I'm talking about the xfpm plugin icon.

Screenshot: http://i39.servimg.com/u/f39/13/01/91/22/xfpm10.png

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.17.0-rc6+ (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xfce4-power-manager-plugins depends on:
ii  libatk1.0-0          2.12.0-1
ii  libc6                2.19-11
ii  libcairo2            1.12.16-5
ii  libdbus-1-3          1.8.8-1
ii  libdbus-glib-1-2     0.102-1
ii  libfontconfig1       2.11.0-6.1
ii  libfreetype6         2.5.2-2
ii  libgdk-pixbuf2.0-0   2.30.8-1
ii  libglib2.0-0         2.41.5-2
ii  libgtk2.0-0          2.24.24-1
ii  libpango-1.0-0       1.36.7-1
ii  libpangocairo-1.0-0  1.36.7-1
ii  libpangoft2-1.0-0    1.36.7-1
ii  libupower-glib3      0.99.1-3
ii  libx11-6             2:1.6.2-3
ii  libxfce4ui-1-0       4.10.0-6
ii  libxfce4util6        4.10.1-2
ii  libxfconf-0-2        4.10.0-3
ii  libxrandr2           2:1.4.2-1
ii  xfce4-panel          4.10.1-1
ii  xfce4-power-manager  1.4.0-2

xfce4-power-manager-plugins recommends no packages.

xfce4-power-manager-plugins suggests no packages.

-- no debconf information

---

From: Yves-Alexis Perez <[email-masked]>
Date: Mon, 22 Sep 2014 23:19:12 +0200

> Screenshot: http://i39.servimg.com/u/f39/13/01/91/22/xfpm10.png

Can you strace the plugin and check the file it tries to open? It should
try to use the various ups files from xfce4-power-manager-data, but that
can also depend on the currently used icon theme.

Regards,
-- 
Yves-Alexis

---

From: Zlatko Calusic <[email-masked]>
Date: Tue, 23 Sep 2014 00:00:30 +0200

> can also depend on the currently used icon theme.

I replaced panel's wrapper binary with script that executes strace -fe 
open on the real wrapper binary, and then added the plugin to the panel. 
I'm afraid not much additional info in the trace file. Unless I missed 
something, it looks like the plugin never attempts to open any image 
file. At least you can see what icon themes I have installed (adwaita, 
gnome, hicolor).

http://pastebin.com/6MM6CkEB

This issue looks specific to the fact that I have UPS connected on this 
particular computer, not battery. I see that xfce4-power-manager-data 
package has specific icons for UPS' and they're properly installed, 
somehow they are invisible in panel. :P

-- 
Zlatko

---

From: Yves-Alexis Perez <[email-masked]>
Date: Tue, 23 Sep 2014 09:20:04 +0200

> somehow they are invisible in panel. :P
It might be worth running xfpm from command line, using debug:

xfce4-power-manager -q # stop current daemon
xfce4-power-manager --debug # run new daemon with debug mode

And report your findings. Unfortunately I don't have an UPS so I can't
really debug here.

Regards,
-- 
Yves-Alexis

---

From: Zlatko Calusic <[email-masked]>
Date: Tue, 23 Sep 2014 18:58:19 +0200

> And report your findings. Unfortunately I don't have an UPS so I can't

Got it!

Somehow you always manage to help me to help you :), really nice to work with you.

I'm not even posting the whole debug output, because I have a pretty good idea where the problem lies, I hope you can take it from there.

Since there's a difference in behaviour between battery and UPS equipped computers, I extracted debug output from both, and with a bit of filtering did a context diff. And soon it's obvious what's goin' on.

Desktop:

-xfpm_power_get_power_devices(): Power device detected at : /org/freedesktop/UPower/devices/ups_hiddev0
-xfpm_power_add_device(): 'ups' device added
-xfpm_power_add_device(): Battery device type 'ups' detected at: /org/freedesktop/UPower/devices/ups_hiddev0

Laptop:

+xfpm_power_get_power_devices(): Power device detected at : /org/freedesktop/UPower/devices/line_power_AC
+xfpm_power_add_device(): 'line-power' device added
+xfpm_power_get_power_devices(): Power device detected at : /org/freedesktop/UPower/devices/battery_BAT0
+xfpm_power_add_device(): 'battery' device added
+xfpm_power_add_device(): Battery device type 'battery' detected at: /org/freedesktop/UPower/devices/battery_BAT0

So far so good... But later on...

-xfpm_battery_refresh_icon(): Battery icon xfpm-ups-charged
+xfpm_battery_refresh_icon(): Battery icon xfpm-primary-charged

So, laptop is searching for something called xfpm-ups-charged, and with a little help of locate(1), I can see lots of such named icons. But, locating xfpm-ups-charged returns nil. That's because appropriate icons are actually called:

/usr/share/icons/hicolor/32x32/status/xfpm-ups-100.png
/usr/share/icons/hicolor/48x48/status/xfpm-ups-100.png
/usr/share/icons/hicolor/scalable/status/xfpm-ups-100.svg

To test it, I did 3 symbolic links (ln -s xfpm-ups-100.foo xfpm-ups-charged.foo), rebuilt icon-cache, reloaded plugin and voila, the icon is there in all its beauty. ;)

So, either icons should be renamed or the plugin should search for appropriately named icons.

Regards,
-- 
Zlatko