Red Hat Bugzilla – Bug 67296
Make battery applet appear conditionally on laptops
Last modified: 2008-05-01 11:38:02 EDT
I think we aren't adding the battery applet by default on laptops at the moment.
havoc -- where do default panel contents get defined? I'll take a stab at making
The gnome-panel RPM has a .schemas file redhat-panel-per-panel-config.schemas as
one of the SourceN lines that defines things. Probably what you would do is add
the battery in here (not trivial to figure out, this file is bizarre - I can do
it maybe as I already deciphered it, or just copy something like the
pager_applet entry), and then most likely you will need a bad hack
in gnome-panel/applet.c:panel_applet_load_idle_handler to intercept a battery
applet and avoid loading it on desktops. But then if the user chooses
a battery applet from the menu on their desktop, things will silently not work,
so perhaps a more complex change is required.
The see-if-we're-on-a-laptop code is in 1.4 gnome-core in 7.3, it does something
crazy like fork/exec a subprocess because on some laptops any process that
reads /proc/apm will segfault due to a kernel bug.
Actually screw all that - another possible approach that might work is to have
two .schemas files (hopefully one derived from the other in automated fashion),
and in %post install one or the other based on whether it's a laptop. This is
probably a lot easier and safer in fact. Just change the package to install two
.schemas files, pick one or the other in %post - main hard part is having
some "this_is_a_laptop" command to use in the script.
addressed in gnome-panel-2.0.6-2
This looks solid with gnome-panel-2.0.6-9.