You are not logged in.

#26 2012-09-21 07:53:16

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 809

Re: cbatticon - A lightweight GTK+ battery status icon

Hi!
Is there a possibility that cbatticon hibernates my system on low battery (user-defined "low level") ?
As far as i see, it is not possible now. So i guess this can be a feature request! smile
EDIT: just added this to the source file and compiled again, seems to work:

if (!battery_low && percentage < 15) {                                  //changed from default 20
				battery_state = DISCHARGING;
				battery_low   = 1;
				notify_battery_information (LOW_POWER, percentage, time_string);
			}
      
if (battery_low && percentage < 5)
        system("systemctl hibernate");

Is this so ugly? Or can it be implemented in cbatticon?
Thanks!

Last edited by nierro (2012-09-22 08:33:20)

Offline

#27 2012-09-25 14:30:09

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

ecolinux wrote:

hello...
cbatticon seem good but i don't know how can display icons....I have icons but I don't know where i put them.  we must change the code cbatticon?
thank you....

Does this 'cbatticon --list-icon-types' mentions that icons are found ?
If not, it means your icon theme doesn't contains the required icons. What theme do you use ?

Offline

#28 2012-09-25 14:36:31

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

nierro wrote:
if (battery_low && percentage < 5)
        system("systemctl hibernate");

Is this so ugly? Or can it be implemented in cbatticon?
Thanks!

Yes, it is very ugly. It binds cbatticon to systemd.
Easiest solution is to make it a new optional parameter.
I'll look at it.

Offline

#29 2012-09-25 14:38:37

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 809

Re: cbatticon - A lightweight GTK+ battery status icon

Yes i know. I was only looking for the fastest way to achieve that, and i came up with that smile
Waiting for an update then!

Offline

#30 2012-12-23 20:36:13

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Hi all,

New feature has been added to execute any user defined command when critical battery level (5%) is reached.
List of available options is now:

Application Options:
  -u, --update-interval            Set update interval (in seconds)
  -i, --icon-type                  Set icon type ('standard', 'notification' or 'symbolic')
  -c, --command-critical-level     Command to execute when critical battery level (5%) is reached
  -t, --list-icon-types            List available icon types
  -b, --list-batteries             List available batteries
  --display=DISPLAY                X display to use

Enjoy!

Offline

#31 2012-12-23 23:43:40

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 809

Re: cbatticon - A lightweight GTK+ battery status icon

Thanks!:)

Offline

#32 2013-01-31 18:39:12

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: cbatticon - A lightweight GTK+ battery status icon

Hi,
I'm using this right now and it works fine. I'm just wondering whether it's possible to have the icon changing according to the battery state (little progress bar). I'm currently using AwOkenDark icons and awesome window manager.

Cheers,
Kubouch

EDIT: Sorry, it actually works. I had about 45% and it was showing almost full so I was confused. It seems that it changes when under 40%.

Last edited by Kubouch (2013-01-31 18:44:42)

Offline

#33 2013-01-31 21:09:39

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Displayed icon depends on icon type, battery charge level (%) and (un)plugged.

For type 'notification', it shows 20, 40, 60, 80, 100%
For other types, it's caution (<20), low (<40), good (<80), full.

Offline

#34 2013-02-05 20:45:10

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Hi all,

New features have been added to specify low battery level and critical battery level.
List of available options is now:

Application Options:
  -u, --update-interval            Set update interval (in seconds)
  -i, --icon-type                  Set icon type ('standard', 'notification' or 'symbolic')
  -c, --command-critical-level     Command to execute when critical battery level is reached
  -l, --low-level                  Set low battery level (in percent)
  -r, --critical-level             Set critical battery level (in percent)
  -t, --list-icon-types            List available icon types
  -b, --list-batteries             List available batteries

Examples:
  cbatticon
  cbatticon -t
  cbatticon -b
  cbatticon -u 20 -i notification -c "systemctl poweroff" -l 15 -r 3

Default value for options:
  update interval        : 5 seconds
  icon type              : the first one that is available in this sequence:
                           standard, notification or symbolic
                           (check your setup with --list-icon-types)
  command critical level : none
  low level              : 20 percent
  critical level         : 5 percent
  battery id             : the first one that is reported by udev

Enjoy!

Offline

#35 2013-02-06 09:27:24

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: cbatticon - A lightweight GTK+ battery status icon

valr wrote:

Hi all,

New features have been added to specify low battery level and critical battery level.
List of available options is now:
...

When customizing low battery levels why not to enable customizing other battery levels (40%, 80%)? I'm just curious.

However I have another intricate query. Is there any command to invoke the popup message appearing when a cursor is hovering upon the icon? My intention is to keybind the command to have mouse-independent access to my current battery state. I use Awesome WM on my laptop and I'm trying to minimize cursor moving as much as possible.

Kubouch

Offline

#36 2013-02-06 17:04:20

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Kubouch wrote:

When customizing low battery levels why not to enable customizing other battery levels (40%, 80%)? I'm just curious.

The low and critical levels (that can be manually set via options) are events that trigger a specific notifications. If you set the low level at e.g. 30% then the 'low level' notification will appear at 30% i.o. default of 20%. Other levels (40%, ..., 80%) don't trigger a specific notification.

Kubouch wrote:

Is there any command to invoke the popup message appearing when a cursor is hovering upon the icon? My intention is to keybind the command to have mouse-independent access to my current battery state.

Not sure it's possible to trigger the display of the tooltip from a keybind. I'll have a look at it.

Offline

#37 2013-02-08 15:11:51

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: cbatticon - A lightweight GTK+ battery status icon

Sorry for spamming here again but I need an insight again.
When I run cbatticon in terminal I get this error:

Gtk-WARNING **: Unable to locate theme engine in module_path: "mist"

Cbatticon runs normally, though. (Well, ran... Now it's broken for some reason as I posted here.)
When I install gtk-engines (Mist theme is included there) error message disappears. Why is cbatticon requiring Mist? I use Owl Light theme with AwOken icons so from my point of view there is no point of installing gtk-engines at all.

Offline

#38 2013-02-08 15:24:09

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Kubouch wrote:

Why is cbatticon requiring Mist?

It doesn't. It's gtk that requires the theme and that complains when it doesn't find one.

Edit: regarding the battery not found, does cbatticon show something when you do this:

cbatticon --list-batteries

If yes, use that info, if not I can't help. I have no ThinkPad.

Last edited by valr (2013-02-08 15:26:24)

Offline

#39 2013-02-08 21:53:34

Kubouch
Member
From: Czech Republic
Registered: 2013-01-03
Posts: 25

Re: cbatticon - A lightweight GTK+ battery status icon

valr wrote:

It's gtk that requires the theme and that complains when it doesn't find one.

Well, I think I'll leave it complaining. Thanks for info.

valr wrote:

Edit: regarding the battery not found, does cbatticon show something when you do this:

cbatticon --list-batteries

Yes, it shows path to my BAT0 (/sys/devices/.../power_supply/BAT0). Not sure how to use this, though.

Last edited by Kubouch (2013-02-09 09:18:18)

Offline

#40 2013-02-18 21:16:49

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

valr wrote:
Kubouch wrote:

Is there any command to invoke the popup message appearing when a cursor is hovering upon the icon? My intention is to keybind the command to have mouse-independent access to my current battery state.

Not sure it's possible to trigger the display of the tooltip from a keybind. I'll have a look at it.

Ok, after having looked at it I've found no clean way (well, not found any way at all, in fact) to trigger the display of a tooltip via a keypress. It's not made for that and technically the main problem is that a GtkStatusIcon is not a GtkWidget but a GObject. This already restrict quite a lot what can be done. What could be done via a keypress is displaying a notification i.e. using a notification daemon, but I guess it's not what you want.

Offline

#41 2013-03-11 10:28:32

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Last changes in cbatticon:
- improved Makefile
- tagged as 1.0 in github (well, there is no real roadmap so let's start at 1.0)

cbatticon is now available in aur both as git or as release (tag).

Offline

#42 2013-04-20 11:07:09

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Hi all,

Here is a status update on cbatticon development:

Version 1.1 was posted few times ago.

It was mainly posted to add an option to (try to) determine status even when 'unknown' status is returned (some batteries do it when (dis)charging).
Some other small fixes.

Version 1.2 has just been posted.

Dependency on libudev has been removed.
A message is sent to system logger before spawning command when critical level is reached.
Tooltip and notification messages have been reworked.
The version option (-v) has been added.
Fixed bug triggering the switching from normal calculation to estimated calculation when not needed.
Lots of code cleaning/rework.

More to come,

Cheers

Offline

#43 2014-08-17 10:06:25

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Hi all,

I've forgotten to keep this thread up-to-date.

Version 1.3.0 -> 1.3.2 were released long time ago with main changes:

* Added option to hide notification at runtime
* Fix compilation with libnotify version older than 0.7.0

Version 1.4.0 has just been released with main changes:

* Allow building with(out) libnotify support (default: build with libnotify)
* Allow building with gtk2 or gtk3 (default: build with gtk2)
* Renamed option --list-batteries into --list-power-supplies to show battery and AC
* Allow AC only tray icon when there is no battery
* Allow execution of command when left clicking on the tray icon
* Added debug option

cbatticon is now in the community repo.

Cheers

Offline

#44 2014-08-22 14:01:33

Painless
Member
Registered: 2006-02-06
Posts: 177

Re: cbatticon - A lightweight GTK+ battery status icon

Hi,

Firstly, thanks for writing this software, I use it with FVWM and find it extremely useful.

Since the last update, the colour of the cbatticon symbolic icon has changed on my system from white to black.  Is there a way to revert back to the old colour?  Or is this due to some other change (like an icon theme change?

Thanks,

Rob

Offline

#45 2014-08-23 14:55:52

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Painless wrote:

Since the last update, the colour of the cbatticon symbolic icon has changed on my system from white to black.  Is there a way to revert back to the old colour?  Or is this due to some other change (like an icon theme change?

Well, it could be a bug. Have you tried with the previous version (you can reinstall it from your pacman cache) to be sure it's not a change in your icon theme ?
If you indeed have a difference of behaviour between the old & new version of cbatticon, can you provide me the name of your icon theme and the command line you use to start cbatticon ?
When you say that the icon change from white to black, which icon is it: the one when your battery if full ? or any icon (discharging, ...) changed from white to black ?

Thanks

Offline

#46 2014-08-23 18:58:14

Painless
Member
Registered: 2006-02-06
Posts: 177

Re: cbatticon - A lightweight GTK+ battery status icon

Hi,

The only icon theme setting I'm aware of is gtk-icon-theme-name="Tango" in my .gtkrc-2.0.  Tango hasn't been updated in years.  Having said that, these look a little bit like the Faenza status icons, but white instead of black, a happy accident, until now.  The faenza icon theme package was last updated Wed 02 Jul 2014.

I've tried reverting from 1.4.0-1 => 1.3.2-2 (i686), but it exhibits the same behaviour.  With 1.3.2-2 the icon is white (upper part of screenshot below), with 1.4.0-1 the icon is black (lower part of screenshot below).

cbatticon screenshots

The command I'm using is:

cbatticon -u 20 -i symbolic -c "systemctl poweroff" -l 35 -r 25

Thanks,

Rob

Offline

#47 2014-08-23 20:48:20

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

I've checked the code and in fact the one related to determination of the icon name has not been changed.
But there is something that also has changed with this version is that it has now been built with gtk3 and not with gtk2 anymore.

Can you check your gtk3 settings ?

Offline

#48 2014-08-24 10:40:37

Painless
Member
Registered: 2006-02-06
Posts: 177

Re: cbatticon - A lightweight GTK+ battery status icon

Hi,

After some experimentation, changing icon sets, the icons themselves would change but the colour would remain as black.  It is definitely a gtk3 thing - I rebuilt the 1.4.0 package but changed WITH_GTK3=1 to WITH_GTK3=0 and the symbolic icon is white again.

It's nothing major tbh, it works, and I have an angle to approach this from now.  Perhaps my system tray (trayer) doesn't handle gtk3 icons very well.  I'll investigate from that viewpoint.

Thanks for your help.

Rob

Offline

#49 2014-08-24 13:23:35

valr
Member
From: Belgium
Registered: 2012-01-08
Posts: 62

Re: cbatticon - A lightweight GTK+ battery status icon

Could it be the "gtk-application-prefer-dark-theme" setting in the gtk3 ?

Offline

#50 2014-08-24 18:25:26

Painless
Member
Registered: 2006-02-06
Posts: 177

Re: cbatticon - A lightweight GTK+ battery status icon

This doesn't appear to help, but this may be due to trayer being not fully aware of gtk3 settings.  I'll try a few options, maybe try a different system tray.  If I find a solution, I'll post it here.

Offline

Board footer

Powered by FluxBB