Split: antiX-19.4 conky

  • This topic has 25 replies, 5 voices, and was last updated Jun 1-3:28 pm by Xecure.
Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #60685
    Member
    calciumsodium

      In the antix 19.4 full “test” version that I help test last month, I was able to check my battery status in conky using the code:

      {execi 1000 acpi 2>/dev/null | grep -q . && echo "Battery: "}${execi 10 acpi -b 2>/dev/null | cut -d" " -f3,4 | sed 's/,$//'}

      That is why I suggested adding this option in the .conkyrc file as another option for users.

      I just tested this code in the official antix 19.4 64-bit full version. This code did not produce any battery display output in conky. I checked to see if the code was the same as that found in the antiX 19.1 version where I found it originally. It is the same. I am not sure why it worked in the test, but not in the official version.

      I tried the other option in the .conkyrc file:

      Battery: ${battery_percent BAT0}% ${alignr}${color8}${battery_bar 8,70 BAT0} # You may need to change BAT0 to BAT1 or add the same line again if you have more then one battery.

      That did not work either in my system.

      • This topic was modified 1 year, 11 months ago by calciumsodium.
      • This topic was modified 1 year, 11 months ago by christophe.
      • This topic was modified 1 year, 11 months ago by christophe.
      #60688
      Moderator
      christophe
        Helpful
        Up
        0
        ::

        @calciumsodium – Try this:
        $ sudo apt install acpi

        That line in conky calls acpi. Make sure it’s installed. I’m running 19.4 base right now, and I had to install it for that line to work. 😉

        confirmed antiX frugaler, since 2019

        #60689
        Member
        calciumsodium
          Helpful
          Up
          0
          ::

          Hi @christophe,
          Now, this is getting interesting. I am running 19.4 64-bit full. acpi is already installed. acpi is already the newest version (1.7-1.1). This code does not work on this system. Yet, it works on the 19.4 base. What could be the difference?

          #60694
          Moderator
          christophe
            Helpful
            Up
            0
            ::

            This may be nothing, but the conky line you copied above needs to have a $ in front.
            Just a quick check to make sure the “$” wasn’t deleted on accident?

            confirmed antiX frugaler, since 2019

            #60695
            Member
            calciumsodium
              Helpful
              Up
              0
              ::

              Sorry, I didn’t copy the $ at the front. It is there.

              ${execi 1000 acpi 2>/dev/null | grep -q . && echo "Battery: "}${execi 10 acpi -b 2>/dev/null | cut -d" " -f3,4 | sed 's/,$//'}

              #60696
              Moderator
              christophe
                Helpful
                Up
                0
                ::

                Do any of these work?

                ${alignc}Battery: ${battery_percent BAT0}% ${alignr}${color8}${battery_bar 8,70 BAT0}

                ${alignc}Battery: ${battery_percent BAT1}% ${alignr}${color8}${battery_bar 8,70 BAT1}

                ${alignc}${execi 1000 acpi 2>/dev/null | grep -q . && echo "Battery: "}${execi 10 acpi -b 2>/dev/null | cut -d" " -f3,4 | sed 's/,$//'}
                ${alignr}${color8}${battery_bar 10,180 BAT0}

                All of these are currently running on my 19.4 base. No, I don’t NORMALLY run all 3 — but I wanted to try them out. Normally some work & some don’t.
                I’m no an expert; just learning by doing, around here. 🙂

                EDIT: “BAT1” shows empty battery for me, but the bar does show up.

                • This reply was modified 1 year, 11 months ago by christophe.

                confirmed antiX frugaler, since 2019

                #60698
                Member
                calciumsodium
                  Helpful
                  Up
                  0
                  ::

                  Fortunately, I still have a partition where I installed the 19.4 test last month. I am posting this post using this 19.4 test operating system.

                  As you can see (see attached conky screenshot.jpg), the conky displays the battery status.

                  I am also copying the code found in that .conkyrc file:

                  ${execi 1000 acpi 2>/dev/null | grep -q . && echo "Battery: "}${execi 10 acpi -b 2>/dev/null | cut -d" " -f3,4 | sed 's/,$//'}

                  I think it is the same as in the 19.4 64-bit full official version.

                  I checked the version of acpi installed in this 19.4 test. It is acpi version 1.7-1.1, which is the same as the 19.4 64-bit full official version.

                  • This reply was modified 1 year, 11 months ago by calciumsodium.
                  #60700
                  Moderator
                  christophe
                    Helpful
                    Up
                    0
                    ::

                    On at least 1 of those, I had to preface it with
                    ${alignc}
                    before it would work.

                    I don’t know why. See if it works for you.

                    confirmed antiX frugaler, since 2019

                    #60703
                    Member
                    Robin
                      Helpful
                      Up
                      0
                      ::

                      Hello Calciumsodium

                      you need to break the command down into the components it consists of in order to find out how it should read to fit your needs. So first find out what returns the command
                      acpi
                      on your command line. This is the base part of your complete sequence.

                      At least in my case it prints

                      Battery 0: Unknown, 0%

                      on an most recently updated antiX 19.x (which is true, my battery doesn’t have any capacity anymore, it will always show 0% only). Check this output first, before proceeding.

                      Now let’s look for the next ingredients of the command intended to make conky display the battery status:

                      acpi 2>/dev/null | grep -q .

                      followed by double &&. This is meant as a check merely whether acpi gives any respond (0 for success, 1 for error, check performed by grep command). You may query yourself by entering
                      echo $?
                      immediately after the command you entered before (acpi…) was executed. The && makes it go on only in case this check was positive, which should always happen as long the acpi you’ve just entered in the step before returns something at all. First thing which is executed now is an echo command, writing the Word Battery and a colon to the conky line:
                      echo "Battery: "
                      Given you got a result from acpi in first step you need to examine it carefully now. Next part of line:
                      acpi -b
                      will show battery status acpi returns.
                      And now you just need to analyze the structure of the acpi output line cutting out the desired value from it. The part of the command responsible for the cutout of the numbers is
                      acpi -b 2>/dev/null | cut -d" " -f3,4 | sed 's/,$//'
                      Especially the parts starting with cut and sed between the vertical bars. So enter this complete line simply on your command line in terminal window, and look what comes out. If the result doesn’t meet your expectations, you may have to adapt what exactly is cut (by cut command) or replaced (by sed command) from the acpi output line.
                      Next break it up still more:
                      acpi -b | cut -d" " -f3,4
                      What comes from that part when entering on commandline? Look whether seperator (“blank” is used here) is identical to what you see in the output line you’ve found. Also check whether actually fields No. 3 and No. 4 are needed or whether the values are found in different fields?
                      Then look whether sed command is needed at all, it is meant to cut off a trailing comma here only, but there seems to be none.

                      I’m aware this is kind of crash course in bash command line usage, if you are not familiar with this. So in case you can’t figure the commands needed yourself, please let us know the line returned by acpi -b command on your equipment and we’ll tailor a command string suiting for you.

                      Feeding the acpi line as found on my antiX 19.x from above to the command sequence from your original posting cuts out
                      Unknown, 0%
                      just as expected from the commands involved. So this should get displayed in conky also. If not, we’ll have to dig a bit deeper still.

                      So long
                      Robin

                      Windows is like a submarine. Open a window and serious problems will start.

                      #60704
                      Moderator
                      christophe
                        Helpful
                        Up
                        0
                        ::

                        Oh good!
                        Robin to the rescue!
                        (I had run dry of ideas… )

                        EDIT: And great line of inquiry into a possible solution.

                        • This reply was modified 1 year, 11 months ago by christophe.
                        • This reply was modified 1 year, 11 months ago by christophe.

                        confirmed antiX frugaler, since 2019

                        #60707
                        Member
                        calciumsodium
                          Helpful
                          Up
                          0
                          ::

                          Hi @Robin and @christophe,

                          As you suggested, I broke down the acpi command in both the 19.4 64-bit full test OS and the 19.4 64-bit full official OS.

                          on 19.4 64-bit full test OS

                          jakersfan@jakersfan:~
                          $ acpi
                          Battery 0: Charging, 82%, 00:22:51 until charged
                          jakersfan@jakersfan:~
                          $ acpi 2>/dev/null | grep -q .
                          jakersfan@jakersfan:~
                          $ acpi -b
                          Battery 0: Charging, 84%, 00:20:31 until charged
                          jakersfan@jakersfan:~
                          $ acpi -b 2>/dev/null | cut -d” ” -f3,4 | sed ‘s/,$//’
                          Charging, 85%
                          jakersfan@jakersfan:~
                          $

                          on 19.4 64-bit full official OS

                          demo@antix1:~
                          $ acpi
                          Battery 0: Discharging, 84%, 03:03:16 remaining
                          demo@antix1:~
                          $ acpi 2>/dev/null | grep -q .
                          demo@antix1:~
                          $ echo “Battery: ”
                          Battery:
                          demo@antix1:~
                          $ acpi -b
                          Battery 0: Discharging, 84%, 03:04:37 remaining
                          demo@antix1:~
                          $ acpi -b 2>/dev/null | cut -d” ” -f3,4 | sed ‘s/,$//’
                          Discharging, 84%
                          demo@antix1:~
                          $ acpi -b | cut -d” ” -f3,4
                          Discharging, 84%,
                          demo@antix1:~
                          $

                          The acpi components seem to work in both systems just fine. But the battery status would be displayed in the 19.4 64-bit full test OS, but NOT in the 19.4 64-bit full official OS in conky.

                          • This reply was modified 1 year, 11 months ago by calciumsodium.
                          • This reply was modified 1 year, 11 months ago by calciumsodium.
                          #60710
                          Member
                          Robin
                            Helpful
                            Up
                            1
                            ::

                            acpi components seem to work in both systems just fine

                            you are right, in both versions acpi returns what is needed and the values are correctly cut from it.

                            Everything looks fine so far. So let’s make it get displayed in conky also.
                            Just a side note:

                            Discharging, 84%,

                            here you can see what the sed command is good for. It cuts simply off this trailing colon.

                            So your command line is fine for usage. Let’s check the conky part.

                            Please let us know the output of
                            cat ~/.conkyrc
                            from both systems. Therein the solution sould be found now.
                            Btw, are there on both systems installed the same conky versions?
                            apt-cache policy conky

                            _____________________
                            Edit: If conky isn’t found to be installed, just check all the conky versions you get back from
                            apt-cache search conky
                            with this policy command to see whether there are any version differences between the two systems.

                            Windows is like a submarine. Open a window and serious problems will start.

                            #60711
                            Member
                            calciumsodium
                              Helpful
                              Up
                              0
                              ::

                              I was doing the test on a 19.4 test installed and a 19.4 official live usb without persistence. Is this a valid test? I was assuming that I can change the .conkyrc file in the live usb without persistence by removing the # in front of the

                              ${execi 1000 acpi 2>/dev/null | grep -q . && echo “Battery: “}${execi 10 acpi -b 2>/dev/null | cut -d” ” -f3,4 | sed ‘s/,$//’}

                              to turn on the battery status display in conky.

                              If this is not correct, then do I have to install the 19.4 official? That defeats the purpose of having a live usb.

                              #60712
                              Moderator
                              christophe
                                Helpful
                                Up
                                0
                                ::

                                Everything looks fine so far. So let’s make it get displayed in conky also.

                                Excellent coaching, Robin!

                                From that group of output, I threw together a nice 2-line battery status. This should work for (calciumsodium) your conky, too, since you were able to get this output on the command line:

                                ${alignc} Battery: 
                                ${alignc}${execi 10 acpi -b}

                                EDIT: Actually it looks better with just the 2nd line! Oh well. You get the idea…

                                • This reply was modified 1 year, 11 months ago by christophe.
                                • This reply was modified 1 year, 11 months ago by christophe. Reason: added screenshot

                                confirmed antiX frugaler, since 2019

                                #60713
                                Moderator
                                christophe
                                  Helpful
                                  Up
                                  0
                                  ::

                                  I was assuming that I can change the .conkyrc file in the live usb without persistence by removing the # in front

                                  That works for the current session only, if persistence isn’t being used. Next boot it goes back to original, in that case.

                                  confirmed antiX frugaler, since 2019

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