! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Display percentage and battery time next to icon
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfce4-power-manager
Component:
General

Comments

Description Yves-Alexis Perez editbugs 2008-10-19 17:26:32 CEST
Hi,

I have a feature request: currently power manager can nearly replace the battery plugin. But it'd be nice to be able to (optionnally) have it display the time and/or the percentage.

You may want to look at the hal_based branch of xfce4-battery-plugin, which is really great.
Comment 1 Ali Abdallah editbugs 2008-10-20 07:22:57 CEST
Hi,

On Saturday i've implemented something like that, but still giving not correct time, so i'll see what is done in xfce4-battery-plugin.

concering the percentage, is shown in the battery icon tooltip!
Comment 2 Yves-Alexis Perez editbugs 2008-10-20 08:11:31 CEST
(In reply to comment #1)
> Hi,
> 
> On Saturday i've implemented something like that, but still giving not correct
> time, so i'll see what is done in xfce4-battery-plugin.

Yes I saw that. For battery plugin, there was once a calculated time, but it wasn't really working correctly, and I submitted a patch (which I think was integrated) to just pick the time calculated by hal.
> 
> concering the percentage, is shown in the battery icon tooltip!

Yes but what I asked for was to show the time/percentage next to the icon, directly, so one doesn't have to hover the icon. This should be user-configurable of course :) I know the icon shows some indication of power left, but some people (including me) want more :)
Comment 3 Ali Abdallah editbugs 2008-10-20 08:20:43 CEST
(In reply to comment #2)
> (In reply to comment #1)
> Yes I saw that. For battery plugin, there was once a calculated time, but it
> wasn't really working correctly, and I submitted a patch (which I think was
> integrated) to just pick the time calculated by hal.

I'm also picking up the time calculated by hal, but sometimes it gives funny approximation.

> Yes but what I asked for was to show the time/percentage next to the icon,
> directly, so one doesn't have to hover the icon. This should be
> user-configurable of course :) I know the icon shows some indication of power
> left, but some people (including me) want more :)

I see what you mean now, don't know if this is doable with status icon, since i can't pack stuff in it and for now one can't add applet from an application directly to the panel, as Jannis said this feature will be added in 4.8.
Comment 4 Ali Abdallah editbugs 2008-10-21 09:32:58 CEST
Not feasible with status icon and with the current panel version.
Comment 5 Yves-Alexis Perez editbugs 2008-11-06 07:36:08 CET
Following up on this, would it be worth integrating the hal_based branch of battery plugin (well, only the UI part) so xfpm provide a panel plugin too (which could display text, like percentage and battery time directly). It'd make sense for people using xfce4-panel, and other people could still use the systray UI.

(yeah, I really miss the battery infos as text, and I really think it's useful, so I'm thinking on how workarounding the “no text in systray”. The hal based battery plugin could be loaded at the same time as xfpm running without posing problem, and it'd just be display, but it'd be even better if you could have all xfpm options from the panel plugin too.

What do you think?

Cheers, and thanks,
Comment 6 Yves-Alexis Perez editbugs 2008-11-06 07:38:41 CET
[08:34:29] (kelnos): problem is that applications can't automatically add panel 
                     plugins

I forgot that, so yeah, it can be tricky. Maybe xfpm could start, go to the systray, then the user could manually add the plugin if he wants to. Not sure if a panel plugin cand send dbus/hal stuff, though.
Comment 7 Ali Abdallah editbugs 2008-11-06 07:56:29 CET
(In reply to comment #6)
All xfpm can be a panel plugin, sure a plugin can use DBus and HAL services, as long as the user is allowed to.

But i don't think this is the correct way to go. All power managers work in the way that xfpm is now.

I think is a good idea to file a bug as enhancement for Gtk+, so they can have the possibility to add a label with a specific orientation in each Gtk Status icon. In other hand, the user can add whatever he likes to the panel.
Comment 8 Yves-Alexis Perez editbugs 2008-11-06 07:59:31 CET
(In reply to comment #7)
> (In reply to comment #6)
> All xfpm can be a panel plugin, sure a plugin can use DBus and HAL services, as
> long as the user is allowed to.
> 
> But i don't think this is the correct way to go. All power managers work in the
> way that xfpm is now.

Yeah I know. And I don't think it's a good idea to change that, at least the default. But it'd be nice providing “another UI” for advanced users or people used to panel plugins. That would just be another way to control xfpm.

> 
> I think is a good idea to file a bug as enhancement for Gtk+, so they can have
> the possibility to add a label with a specific orientation in each Gtk Status
> icon. In other hand, the user can add whatever he likes to the panel.

squisher (on irc) said it could be possible to do that using cairo/pango. I don't know enough gtk but maybe it's worth trying?
Comment 9 Ali Abdallah editbugs 2008-11-06 08:37:48 CET
(In reply to comment #8)
> squisher (on irc) said it could be possible to do that using cairo/pango. I
> don't know enough gtk but maybe it's worth trying?

I have some code on this already, but the pixbuf result is very ugly, somehow GdkPixbuf and cairo aren't compatible in the way of handling this.

If i figure out a clean and a not expensive way to get this done, i'll add it, but i think it won't be in 0.6.0.
Comment 10 Yves-Alexis Perez editbugs 2008-11-06 09:23:42 CET
(In reply to comment #9)
> (In reply to comment #8)
> > squisher (on irc) said it could be possible to do that using cairo/pango. I
> > don't know enough gtk but maybe it's worth trying?
> 
> I have some code on this already, but the pixbuf result is very ugly, somehow
> GdkPixbuf and cairo aren't compatible in the way of handling this.

Ha, cool. Is there a branch for this?
> 
> If i figure out a clean and a not expensive way to get this done, i'll add it,
> but i think it won't be in 0.6.0.

Yeah, I don't think it's worth messing with the first stable release :)
Comment 11 Ali Abdallah editbugs 2008-11-06 09:36:49 CET
(In reply to comment #10)
> Ha, cool. Is there a branch for this?

No, actually it was just a try that i did last week on my machine.
Comment 12 Christian Dywan 2008-11-07 18:26:42 CET
I would also love to see some form of label, maybe a second tray icon would work good enough. I will be keeping the battery monitor's label for now. It's not urgent for me, I'm fine with waiting until after the current stable release.
Comment 13 David Mohr 2008-11-07 20:40:13 CET
I just noticed that orage does put text into the tray icon (although it looks pretty bad). Might be worth it to check out how it's done there.
Comment 14 David Mohr 2008-11-07 20:41:43 CET
btw, I vote for having only one tray icon, and then give an option to show either time or %. Both seem like overkill to me.
Comment 15 Christian Dywan 2008-11-12 01:59:43 CET
(In reply to comment #14)
> btw, I vote for having only one tray icon, and then give an option to show
> either time or %. Both seem like overkill to me.

I personally frequently look at the remaining battery time, but nothing else. So for I what, I would agree one additional label would be enough.
Comment 16 Ali Abdallah editbugs 2009-07-02 14:06:18 CEST
Closing old bugs to keep things organized.
Comment 17 Yves-Alexis Perez editbugs 2009-07-02 14:42:31 CEST
Hmh, I don't think this bug should be marked closed. It's not solved, it's just postponed. The possibility to have the remaining percentage (and time) displayed, like the battery plugin does atm, would really be nice to have.

If it's definitely not possible to have it displayed in the systray because of GTK, ok, but the other solution (to provide a battery plugin, a bit like there's the brightness plugin and once was the inhibit plugin) would be nice.
Comment 18 Ali Abdallah editbugs 2009-07-02 16:19:53 CEST
(In reply to comment #17)
> Hmh, I don't think this bug should be marked closed. It's not solved, it's just
> postponed. The possibility to have the remaining percentage (and time)
> displayed, like the battery plugin does atm, would really be nice to have.
> 
> If it's definitely not possible to have it displayed in the systray because of
> GTK, ok, but the other solution (to provide a battery plugin, a bit like
> there's the brightness plugin and once was the inhibit plugin) would be nice.

Yeah of course, i will provide such thing in future release, i'm sorry, i closed this bug accidentally.
Comment 19 Raphael Groner 2012-10-20 17:15:14 CEST
http://goodies.xfce.org/projects/panel-plugins/xfce4-battery-plugin

Is bug #9068 a duplication?
Comment 20 Raphael Groner 2012-10-20 17:16:54 CEST
*** Bug 9068 has been marked as a duplicate of this bug. ***
Comment 21 Simon Steinbeiss editbugs 2014-05-29 12:10:51 CEST
*** Bug 6112 has been marked as a duplicate of this bug. ***
Comment 22 Harald Judt 2014-11-19 21:23:30 CET
I believe the current version 1.4.1 has a panel plugin that can do this satisfactorily; therefore closing this bug.
Comment 23 Yves-Alexis Perez editbugs 2014-11-19 21:28:18 CET
(In reply to Harald Judt from comment #22)
> I believe the current version 1.4.1 has a panel plugin that can do this
> satisfactorily; therefore closing this bug.

There's indeed a panel plugin, but I don't think it's configurable.
Comment 24 Harald Judt 2014-11-19 21:42:49 CET
What's the thing you're missing?
Comment 25 Yves-Alexis Perez editbugs 2014-11-19 23:53:15 CET
(In reply to Harald Judt from comment #24)
> What's the thing you're missing?

The percentage and time remaining, as the title indicates
Comment 26 Harald Judt 2014-11-20 00:00:56 CET
Created attachment 5759 
panel-plugin.png

Maybe there is some sort of misunderstanding, but you mean like the one in my screenshot?
Comment 27 Yves-Alexis Perez editbugs 2014-11-20 07:54:03 CET
(In reply to Harald Judt from comment #26)
> Created attachment 5759 
> panel-plugin.png
> 
> Maybe there is some sort of misunderstanding, but you mean like the one in
> my screenshot?

No, I mean “next to the icon”. Directly in the panel. The previous version already displayed time and percentage a bit like this (in tooltip), and this is not what was requested.
Comment 28 Harald Judt 2014-11-20 17:45:37 CET
Ok, so you want that shown in the panel besides the icon. Some design considerations. One problem with that would be the space available, so it would need to be rather concise, like:

[I] 60%, 01:30

Or vertically of course, with percentage and time below the icon.

    [I]
60%, 01:30

Another probability would be using multiple lines (like weather plugin or cpufreq plugin), e.g.

[||] 60% discharging
[||] 01:30 left

These settings could be hooked up to the right click menu, in a new properties dialog of the panel plugin.

This is just to write this down somewhere. Does that answer better your expectations?
Comment 29 Yves-Alexis Perez editbugs 2014-11-20 19:51:17 CET
(In reply to Harald Judt from comment #28)
> Ok, so you want that shown in the panel besides the icon. Some design
> considerations. One problem with that would be the space available, so it
> would need to be rather concise, like:
> 
> [I] 60%, 01:30
> 
> Or vertically of course, with percentage and time below the icon.
> 
>     [I]
> 60%, 01:30
> 
> Another probability would be using multiple lines (like weather plugin or
> cpufreq plugin), e.g.
> 
> [||] 60% discharging
> [||] 01:30 left
> 
> These settings could be hooked up to the right click menu, in a new
> properties dialog of the panel plugin.
> 
> This is just to write this down somewhere. Does that answer better your
> expectations?

Yes. Not denying your work on triaging bugzilla, but everything is in the bug report :)
Comment 30 Harald Judt 2014-11-20 20:57:16 CET
> Yes. Not denying your work on triaging bugzilla, but everything is in the
> bug report :)

Yes, but there has already been written a lot in this bug report, so much that I got bored midway and decided it's best to put down a definition and put it in a nutshell. I've added this to the backlog as a possible new feature (patches are very welcome of course): https://wiki.xfce.org/design/power-manager
Comment 31 Simon Steinbeiss editbugs 2014-11-21 00:40:32 CET
Yup, thanks for the concise description Harald – that is exactly what I'd expect this to be. In terms of conciseness, one could evaluate the existing solutions in e.g. Ubuntu's power indicator or OSX, since both of those deal with this problem already (although only with a single panel layout).
Comment 32 Simon Steinbeiss editbugs 2015-04-08 19:14:55 CEST
Created attachment 6175 
Add hidden option to show percentage next to icon in plugin

I've written a small patch that displays the percentage next to the battery. I still have to come up with a decent way to map the remaining time (e.g. "1h 34m" or "1:34h" or "1:34" etc). Theoretically we could make that configurable, but I'm not sure it's worth the hassle.

Feedback appreciated either way!

Note: After applying this patch (on top of git master) you have to set "show-percentage" via xfconf to TRUE.
Comment 33 Simon Steinbeiss editbugs 2015-04-12 14:04:21 CEST
Created attachment 6188 
Add option to show percentage or remaining time in panel plugin

I've reworked my patch a bit and extended it. Now you can either
0: show no label
1: show the percentage
2: show the remaining time (charging or discharging, format: %hh:%mm)
3: show time and percentage

If the battery is full, the label is hidden automatically.

In order to test this, you need to apply the patch and add the property
/xfce4-power-manager/show-panel-label
to xfce4-power-manager's xfconf channel as INT.

So for the moment this is a hidden option. Depending on whether we want to add more options to the plugin (I can't think of any), we might want to add that to a properties-dialog. An alternative would be to add a submenu to the plugin's menu offering the choices as "Show percentage" and "Show remaining time" checkboxes that are not mutually exclusive (in this case 1+1 would be 3 :)).

Another note: any values displayed are courtesy of UPower, so if e.g. the percentage goes down but the remaining time goes up, complain to them. Also, keep this in mind: https://xkcd.com/612/
Comment 34 Simon Steinbeiss editbugs 2015-04-12 14:13:57 CEST
Created attachment 6189 
Add option to show percentage or remaining time in panel plugin

Fix typos in the patch.
Comment 35 Simon Steinbeiss editbugs 2015-04-12 22:02:21 CEST
Created attachment 6190 
Add option to show percentage or remaining time in panel plugin

After some testing and feedback from Eric, I've ironed out a few more small issues.

Note: if the label isn't hidden at 100% or 0:00 remaining time, it is because UPower isn't reporting the state as "fully charged". Using the percentage or remaining time has it's own set of problems though, which is why I decided to go with UPower directly. (E.g. my battery strangely only loads up to 98% at times.)
Comment 36 Simon Steinbeiss editbugs 2015-05-29 09:59:29 CEST
Created attachment 6294 
Add hidden option to show percentage or remaining time in panel plugin

Rebased the patch against git master aka 1.5.
Comment 37 flocculant 2015-05-29 15:09:17 CEST
On a desktop - changing the variable from between 0 and 2 leaves the result showing in the plugin (xubuntu 15.10)

On laptop - when on mains just have battery icon, when on battery label changes to expected from variable
Comment 38 Simon Steinbeiss editbugs 2015-06-05 10:28:40 CEST
I pushed my patch to git master, so it'll be released with 1.5.1. There is still room for improvement of course (like the detection and automatic handling of desktops, where the label should always be hidden etc.), but I think this is a good start and a nice improvement over the status quo. Marking this fixed.

Bug #4499

Reported by:
Yves-Alexis Perez
Reported on: 2008-10-19
Last modified on: 2015-06-05
Duplicates (2):
  • 6112 Display numeric value in panel
  • 9068 Idea: Merge with xfce4-power-manager?

People

Assignee:
Simon Steinbeiss
CC List:
6 users

Version

Version:
Unspecified

Attachments

Additional information