Laptop Battery Status

Forum Forums Official Releases antiX-21/22 “Grup Yorum” Laptop Battery Status

  • This topic has 13 replies, 6 voices, and was last updated Aug 22-4:57 pm by 3guesses.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #87161
    Member
    3guesses

      Hi,

      I currently use antiX on my laptop, so the status of the battery is quite important. I have enabled the battery status in conky, but I have a couple of questions:

      – is is possible for conky to display a different coloured bar depending on whether or not the battery is charging / discharging, and if it is below a specific level (eg. 20%)?

      – is it possible to put some sort of battery / power icon in the system bar which I can hover over with the mouse pointer to get a tool-tip showing the battery status?

      Thanks for any help!

      3g

      #87165
      Member
      punranger
        Helpful
        Up
        0
        ::

        Can’t answer for Conky, but in the default ROX-IceWM config, there’s a battery status bar next to the system tray. (Click for full size.)

        • This reply was modified 8 months, 4 weeks ago by punranger.

        antiX linux: The best way to revive an old computer - https://www.youtube.com/watch?v=JCTaUAP6sSg

        #87169
        Anonymous
          Helpful
          Up
          1
          ::

          – for conky

          Yes, that is feasible (whether today, however, I do not know)
          I assume you mean something like this:

          That was many years ago. The one needs the kernel module ‘smapi’ and works only with ThinkPads.
          The relevant lines were:

          ${color}CycleCount:  ${execi 60 cat /sys/devices/platform/smapi/BAT0/cycle_count}
          ${color}Capacity:       ${execi 60 cat /sys/devices/platform/smapi/BAT0/design_capacity}${alignr}${color red}${execi 60 cat /sys/devices/platform/smapi/BAT0/remaining_capacity} mWh
          ${color}BAT0-temp:  ${execi 60 cat /sys/devices/platform/smapi/BAT0/temperature} °C/1000
          ${color}FAN:   ${ibm_fan} rpm
          ${color}CPU:   ${acpitemp}C°
          ${color}Battery: ${alignr}${if_match ${battery_percent BAT0} >= 100}${color white}${battery_bar 10,60 BAT0}${else}${if_match ${battery_percent BAT0} < 99}${color green}${battery_bar 10,60 BAT0}${else}${if_match ${battery_percent BAT0} < 55}${color yellow}${battery_bar 10,60 BAT0}${else}${if_match ${battery_percent BAT0} <= 32}${color red}${battery_bar 10,60 BAT0}${endif}${endif}${endif}${endif}
          ${voffset -22}${alignr 12}${font :size=7}${color black}${battery_percent BAT0}%${font}
          

          The other lines:

          ${voffset 0}${offset 775}${color2}   Power
          ${offset 775}$color0    Battery: ${alignr 15}${if_match ${battery_percent BAT0} >= 99}${color white}${battery_bar 15,130 BAT0}${else}${if_match ${battery_percent BAT0} < 99}${color green}${battery_bar 15,130 BAT0}${else}${if_match ${battery_percent BAT0} < 50}${color yellow}${battery_bar 15,130 BAT0}${else}${if_match ${battery_percent BAT0} <= 30}${color red}${battery_bar 15,130 BAT0}${endif}${endif}${endif}${endif}
          ${voffset -22}${alignr 47}${font :size=7}${color black}${battery_percent BAT0}%${font} #$acpiacadapter ${battery_percent BAT0}%
          ${offset 775}$color0 #$battery $battery_time

          I don’t know if this still works today, so, trial and error.

          #87178
          Moderator
          BobC
            Helpful
            Up
            0
            ::

            Maybe one of these would help

            https://www.antixforum.com/forums/topic/suggestions-for-a-lightweight-low-battery-warning-monitor/#post-51466

            https://www.antixforum.com/forums/topic/conky-mods/page/3/#post-22392

            https://www.antixforum.com/forums/topic/what-battery-monitor-do-you-recommend-2/#post-13766

            PS: just thinking aloud on the logic,
            If AC power on
            .. Show battery percent,
            .. if 100 percent
            …. show est time battery will hold
            .. else
            …. show time till full charge
            else
            .. show est time battery will hold
            .. if battery percent >= 66 (or some value)
            …. show percent bar in yellow
            .. elseif battery percent >= 40 (or some value)
            …. show percent bar in orange
            .. elseif
            …. show percent bar in red

            I haven’t been running any kind of battery monitor on my main laptop. It’s now getting old and I’ve run out of battery on average once a month as a result of not noticing it was running low, and crashing as a result. The usually the screen has an application window covering the conky. I should get a visible/audible alarm working again. Machines that crash tend to develop other issues.

            • This reply was modified 8 months, 4 weeks ago by BobC.
            • This reply was modified 8 months, 4 weeks ago by BobC.
            • This reply was modified 8 months, 4 weeks ago by BobC.
            #87232
            Member
            iznit
              Helpful
              Up
              0
              ::

              whether or not the battery is charging / discharging

              Accurately gauging this might be elusive. Easy to detect whether connected to A/C….. but what utility can track if the battery is healthy and accepting [[[gaining]]] a charge at the expected rate? For each laptop+battery SKU combination, the specified [[[healthy, normal]]] charging rate likely differs. Charging rate probably varies with battery temperature also…..

              #87485
              Member
              3guesses
                Helpful
                Up
                0
                ::

                Can’t answer for Conky, but in the default ROX-IceWM config, there’s a battery status bar next to the system tray. (Click for full size.)

                Thanks, yes, a partial solution seems to be to uncomment (ie remove the leading #) the line #TaskBarShowAPMAuto=1 # 0/1 in ~/.icewm/preferences – that puts a little bar icon in the system tray which seems to be yellow when the battery is discharging and green when charging, while hovering over it shows the battery status (% charged, and charging / discharging).

                There’s also TaskBarShowAPMTime and TaskBarShowAPMGraph, but I haven’t experimented with them yet!

                #87487
                Member
                3guesses
                  Helpful
                  Up
                  0
                  ::

                  – for conky

                  Yes, that is feasible (whether today, however, I do not know)
                  I assume you mean something like this:

                  That was many years ago. The one needs the kernel module ‘smapi’ and works only with ThinkPads.
                  The relevant lines were:

                  ${color}CycleCount:  ${execi 60 cat /sys/devices/platform/smapi/BAT0/cycle_count}
                  ${color}Capacity:       ${execi 60 cat /sys/devices/platform/smapi/BAT0/design_capacity}${alignr}${color red}${execi 60 cat /sys/devices/platform/smapi/BAT0/remaining_capacity} mWh
                  ${color}BAT0-temp:  ${execi 60 cat /sys/devices/platform/smapi/BAT0/temperature} °C/1000
                  ${color}FAN:   ${ibm_fan} rpm
                  ${color}CPU:   ${acpitemp}C°
                  ${color}Battery: ${alignr}${if_match ${battery_percent BAT0} >= 100}${color white}${battery_bar 10,60 BAT0}${else}${if_match ${battery_percent BAT0} < 99}${color green}${battery_bar 10,60 BAT0}${else}${if_match ${battery_percent BAT0} < 55}${color yellow}${battery_bar 10,60 BAT0}${else}${if_match ${battery_percent BAT0} <= 32}${color red}${battery_bar 10,60 BAT0}${endif}${endif}${endif}${endif}
                  ${voffset -22}${alignr 12}${font :size=7}${color black}${battery_percent BAT0}%${font}
                  

                  The other lines:

                  ${voffset 0}${offset 775}${color2}   Power
                  ${offset 775}$color0    Battery: ${alignr 15}${if_match ${battery_percent BAT0} >= 99}${color white}${battery_bar 15,130 BAT0}${else}${if_match ${battery_percent BAT0} < 99}${color green}${battery_bar 15,130 BAT0}${else}${if_match ${battery_percent BAT0} < 50}${color yellow}${battery_bar 15,130 BAT0}${else}${if_match ${battery_percent BAT0} <= 30}${color red}${battery_bar 15,130 BAT0}${endif}${endif}${endif}${endif}
                  ${voffset -22}${alignr 47}${font :size=7}${color black}${battery_percent BAT0}%${font} #$acpiacadapter ${battery_percent BAT0}%
                  ${offset 775}$color0 #$battery $battery_time

                  I don’t know if this still works today, so, trial and error.

                  Thanks very much. I shall investigate in due course!

                  #87488
                  Member
                  3guesses
                    Helpful
                    Up
                    0
                    ::

                    whether or not the battery is charging / discharging

                    Accurately gauging this might be elusive. Easy to detect whether connected to A/C….. but what utility can track if the battery is healthy and accepting [[[gaining]]] a charge at the expected rate? For each laptop+battery SKU combination, the specified [[[healthy, normal]]] charging rate likely differs. Charging rate probably varies with battery temperature also…..

                    Yes – whether the laptop is A/C-connected is really all I’m after (ie the battery is not discharging), nothing more complex than that 😎

                    #87493
                    Moderator
                    BobC
                      Helpful
                      Up
                      0
                      ::

                      What version of antiX are you running and with which desktop?

                      As noted by punranger, the default rox-icewm desktop should show the battery monitor. If you are connected it to power will be green, else yellow or black when discharging, by default.

                      The hover feature should also work.

                      #87529
                      Member
                      iznit
                        Helpful
                        Up
                        0
                        ::

                        Not a exact solution to the OP’s goal but I found this, it shows example output of “upower” command https://askubuntu.com/questions/69556/how-do-i-check-the-batterys-status-via-the-terminal

                        If your battery is indeed recognized as “battery_BAT0”, adding this snipplet into your conky config would give more info than just the battery “status”…..

                        ${execi 30 upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state"}
                        ${execi 30 upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "to\ full"}
                        ${execi 30 upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "percentage"}

                        should produce 3 lines like these within the displayed conky output

                        state:               charging
                        time to full:        57.3 minutes
                        percentage:          42.5469%

                        unknown to me: Does the upower output change, if the system locale is something other than *english?

                        The above really needs some “checking”. Like, makes no sense to display “time to full” when the current state is not “charging”.

                        #87532
                        Moderator
                        christophe
                          Helpful
                          Up
                          0
                          ::

                          Do you think xbattbar would be what you’re looking for?
                          After installation, add
                          xbattbar -t 4 -p 1 -I gray -i black -O purple -o red -c right &
                          to your startup file.
                          (Click the images below to see it better.)
                          First image shows battery dischaging – red bar on right.
                          Second image shows battery charging – blue bar on right.
                          Obviously you can designate where the bar is displayed, top/left/bottom/right.

                          • This reply was modified 8 months, 3 weeks ago by christophe.
                          Attachments:

                          confirmed antiX frugaler, since 2019

                          #87548
                          Anonymous
                            Helpful
                            Up
                            0
                            ::

                            @iznit,

                            unfortunately my battery is broken. Your (conky)code works only in english.

                            @christophe,

                            thanks for xbattbar. I did not know that yet. I made the bar a bit wider because otherwise my eyes don’t see it.

                            BTW, your images stay small after clicking. I can not see it.


                            xbattbar -t 8 -p 1 -I gray -i black -O purple -o red -c left &

                            #87565
                            Moderator
                            christophe
                              Helpful
                              Up
                              0
                              ::

                              Bigger pix, for anyone else whose eyes are worse than mine 😉
                              (Note: clicking on them will show the red/blue bar on the upper right of the screen better, against the grey background.)

                              • This reply was modified 8 months, 2 weeks ago by christophe.
                              Attachments:

                              confirmed antiX frugaler, since 2019

                              #87589
                              Member
                              3guesses
                                Helpful
                                Up
                                0
                                ::

                                Thank you all for the very helpful replies. I shall investigate them all when I get a chance!

                              Viewing 14 posts - 1 through 14 (of 14 total)
                              • You must be logged in to reply to this topic.