Sunday, December 9, 2012

Fedora 17 with ibam and ibamtray

I recently reinstalled Fedora 17 on my laptop and instead of using one of the default usual spins (Gnome, KDE, XFCE or LXDE) I wanted to try something different. A friend of mine who uses Arch mentioned he uses a combination of Openbox and fbpanel which he really enjoys. This sounded as good as any and noticing that the LXDE spin comes with Openbox, I installed that spin.

After everything was installed and I got fbpanel up and running, I tried to use the battery plugin that's built in but it didn't work. Assuming I figure that problem out, it will be the subject of a future post. In the mean time I installed ibam or Intelligent Battery Monitor. You can read about it at their sourceforge page. Initially it didn't work. I was getting an error 'No apm data available'. After some searching I found that the location for my battery information is:
/sys/class/power_supply/BAT0/ 
whereas ibam was looking in:
/sys/class/power_supply/BAT1/
That was a simple enough to fix. If you look in the ibam.inl file, you'll see this around line 962:
      acpi.close();
      apm = new acpi_status();
   } else {
      sysfs.open((sysfs_path+"/BAT1/charge_full").c_str());
      if(sysfs.is_open()) {
All that was needed was to change BAT1 to BAT0 and recompile, then I was good to go.

Next was to install ibamtry, a system tray frontend for ibam based on vubat found here. Unfortunately, that too was not working. Every time i would try to run ibamtray from the terminal, I would get this:

aerotachyon % ibamtray
Traceback (most recent call last):
  File "/bin/ibamtray", line 6, in <module>
    app.run ()
  File "/usr/lib/python2.7/site-packages/ibamtray.py", line 96, in run
    self.update_status ()
  File "/usr/lib/python2.7/site-packages/ibamtray.py", line 145, in update_status
    n.show()
glib.GError: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Notifications was not provided by any .service files
Everything I could find relating to the last line of the output had something to do with notification-daemon. I tried testing it by running:
notify-send "hello"
which failed produce a notification. I figured I should try running the daemon explicitly, but wasn't sure where it was in the filesystem to run it. Issuing the following command:
aerotachyon % whereis notification-daemon
notification-daemon: /usr/libexec/notification-daemon
gave me the location of what I needed to run. Once it was started, I tried sending a notification again with notify-send and it worked. From there I just needed to add the following lines to my Openbox autostart file to start the daemon and ibamtray upon starting Openbox:
/usr/libexec/notification-daemon &
ibamtray &
Now I have a nice battery monitor in the tray with notifications. In hindsight I'm glad the fbpanel battery plugin didn't work because ibam seems to be much more accurate at predicting discharge and charge times along with having better tray icons.