Looking to add color coding and an alert to battery meter [SOLVED]

Add functionality to your desktop
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Koentje »

Holy crap! :shock: All this for just colored text?!
I wonder if a bash script in this case isn't faster..
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Koentje wrote: Tue May 21, 2024 6:04 am Holy crap! :shock: All this for just colored text?!
I wonder if a bash script in this case isn't faster..
Gotta remember: newbie at keys = basic solutions

The fact I got this far without a aneurysm is a miracle.

In this case speed is of no consequence. When my computer is unplugged, one part of the computer immediately understands the plug is out and changes part of the battery display. The part of the computer that handles the battery icon in the systray takes 3-4 minutes to realize the plug is out, and continues to give a "charging" display when moused over even with power cord unplugged. Result is a combination of charging and discharging texts shown together at the same time.

Frustrating but I doubt there is anything to be done about it. If you know of a miraculous script that could straighten out the situation I would take it in a heartbeat!
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
zcot
Level 9
Level 9
Posts: 2957
Joined: Wed Oct 19, 2016 6:08 pm

Re: Looking to add color coding and an alert to battery meter

Post by zcot »

Logansfury wrote: Tue May 21, 2024 1:29 am I pushed

Code: Select all

conky.text = [[

#leet chars: ┤┤└ └ ┴ ┴ ┐┐│ │┘ ┘┌ ┌ ├ ├ ┬ ┬ ┼ ┼ ┴ ┴ ── ││ ▽▼△▲▵▴▾▿
${alignr}${voffset 16}${offset -216}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Charging"}${color1}${exec acpi | grep "Battery 0" | awk '{print $4}'}${battery_percent BAT0}%${endif}
${alignr}${voffset -13}${offset -216}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${color2}${exec acpi | grep "Battery 0" | awk '{print $4}'}${battery_percent BAT0}%${endif}
${alignr}${offset -170}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Charging"}${color1}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state" | awk '{$1=$1; print}'}${endif}
${alignr}${offset -170}${voffset -14}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${color2}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state" | awk '{$1=$1; print}'}${endif}
${alignr}${offset -72}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "to\ full"}
${alignr}${offset -156}${voffset -20}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} >= 36}${color2}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}
${alignr}${offset -156}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} <=35}${if_match ${battery_percent BAT0} >=16} ${color3}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}${endif}
${alignr}${offset -156}${voffset -20}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} <=15} ${color4}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}
]];
yea, no joke!

It's nice though. You are designing some cool stuff.

let me give an example of how it COULD look in the config instead. And I say this because, honestly, the internal MORE COMPLEX processing is just not that efficient. The typical single, simple calls, they're not bad. It's only when you start to get into logic like this that it just takes more, -and so in comparison, bash blows it away in efficiency.

Koentje has a lot of experience and does excellent work.

So then compare the above code block, to something like this following equal example instead:

Code: Select all

conky.text = [[

#leet chars: ┤┤└ └ ┴ ┴ ┐┐│ │┘ ┘┌ ┌ ├ ├ ┬ ┬ ┼ ┼ ┴ ┴ ── ││ ▽▼△▲▵▴▾▿
${exec do_unreal_battery_stuff}
]];
you called basically the same battery thing roughly 16 times, and over 1/3 of those times you also then called complex post-processing on it, more than numerous times the exact same processing. The first 2 lines are exactly the same, the only difference is the static text beside it. The next 2 lines are logic but are the same code, not horrible alone, but then the next 4 lines are working with the same info you already queried.

It's a problem with conky that we can't set a variable then use it later, so that's a bummer, but it makes it ruin the point when we have to accept the cpu, ON IDLE, is sitting at 20% or something because we're going to just repeatedly continue to hammer processing on the thing. LUA is available to overcome this problem, however, it doesn't compare well when talking about just using bash commands, WHEN YOU ARE ALREADY USING BASH COMMANDS AS IS! (you pretty much have all the bash code already sitting there.. minus the logic comparison only)

So, ok, I said it. It's all very cool stuff for sure. I can't run it though, I have an old pc, it eats it up.
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter

Post by Logansfury »

zcot wrote: Tue May 21, 2024 6:05 pm
Logansfury wrote: Tue May 21, 2024 1:29 am I pushed

Code: Select all

conky.text = [[

#leet chars: ┤┤└ └ ┴ ┴ ┐┐│ │┘ ┘┌ ┌ ├ ├ ┬ ┬ ┼ ┼ ┴ ┴ ── ││ ▽▼△▲▵▴▾▿
${alignr}${voffset 16}${offset -216}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Charging"}${color1}${exec acpi | grep "Battery 0" | awk '{print $4}'}${battery_percent BAT0}%${endif}
${alignr}${voffset -13}${offset -216}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${color2}${exec acpi | grep "Battery 0" | awk '{print $4}'}${battery_percent BAT0}%${endif}
${alignr}${offset -170}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Charging"}${color1}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state" | awk '{$1=$1; print}'}${endif}
${alignr}${offset -170}${voffset -14}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${color2}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state" | awk '{$1=$1; print}'}${endif}
${alignr}${offset -72}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "to\ full"}
${alignr}${offset -156}${voffset -20}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} >= 36}${color2}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}
${alignr}${offset -156}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} <=35}${if_match ${battery_percent BAT0} >=16} ${color3}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}${endif}
${alignr}${offset -156}${voffset -20}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} <=15} ${color4}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}
]];
yea, no joke!

It's nice though. You are designing some cool stuff.

let me give an example of how it COULD look in the config instead. And I say this because, honestly, the internal MORE COMPLEX processing is just not that efficient. The typical single, simple calls, they're not bad. It's only when you start to get into logic like this that it just takes more, -and so in comparison, bash blows it away in efficiency.

Koentje has a lot of experience and does excellent work.

So then compare the above code block, to something like this following equal example instead:

Code: Select all

conky.text = [[

#leet chars: ┤┤└ └ ┴ ┴ ┐┐│ │┘ ┘┌ ┌ ├ ├ ┬ ┬ ┼ ┼ ┴ ┴ ── ││ ▽▼△▲▵▴▾▿
${exec do_unreal_battery_stuff}
]];
you called basically the same battery thing roughly 16 times, and over 1/3 of those times you also then called complex post-processing on it, more than numerous times the exact same processing. The first 2 lines are exactly the same, the only difference is the static text beside it. The next 2 lines are logic but are the same code, not horrible alone, but then the next 4 lines are working with the same info you already queried.

It's a problem with conky that we can't set a variable then use it later, so that's a bummer, but it makes it ruin the point when we have to accept the cpu, ON IDLE, is sitting at 20% or something because we're going to just repeatedly continue to hammer processing on the thing. LUA is available to overcome this problem, however, it doesn't compare well when talking about just using bash commands, WHEN YOU ARE ALREADY USING BASH COMMANDS AS IS! (you pretty much have all the bash code already sitting there.. minus the logic comparison only)

So, ok, I said it. It's all very cool stuff for sure. I can't run it though, I have an old pc, it eats it up.
Thanks for the kind words :)

I am always down to correct what I have to something more efficient!

First step was to get this accomplished at all without falling over.

Now that I have proof my idea was feasible I would be happy to learn how to convert this to a more efficient separate bash script.
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Koentje »

List what you need from your battery and i'll fix a bash script.
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Far out :)

there are three lines of display.

line one shows the current battery percentage as a number followed by the percentage symbol. If the laptop is charging, the text is white (#FFFFFF). If the laptop is discharging, the text is yellow (#FFFF00)

line two displays the state as "state: charging"/"state: discharging" If the laptop is charging, the text is white (#FFFFFF). If the laptop is discharging, the text is yellow (#FFFF00)

line 3 displays either "remaining" or "time to fill" based on state, time to fill is always white text. when displaying remaining, the text is yellow (#FFFF00) from 100-36% battery power, orange (#FF6E00) from 35-16% battery power, and red (#FF0000) from 15-0%

Here is the bash I am using to accomplish the above:

Code: Select all

${alignr}${voffset 16}${offset -216}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Charging"}${color1}${exec acpi | grep "Battery 0" | awk '{print $4}'}${battery_percent BAT0}%${endif}
${alignr}${voffset -13}${offset -216}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${color2}${exec acpi | grep "Battery 0" | awk '{print $4}'}${battery_percent BAT0}%${endif}
${alignr}${offset -170}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Charging"}${color1}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state" | awk '{$1=$1; print}'}${endif}
${alignr}${offset -170}${voffset -14}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${color2}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state" | awk '{$1=$1; print}'}${endif}
${alignr}${offset -72}${voffset 8}${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "to\ full"}
${alignr}${offset -156}${voffset -20}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} >= 36}${color2}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}
${alignr}${offset -156}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} <=35}${if_match ${battery_percent BAT0} >=16} ${color3}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}${endif}
${alignr}${offset -156}${voffset -20}${if_match "${exec cat /sys/class/power_supply/BAT0/status}" == "Discharging"}${if_match ${battery_percent BAT0} <=15} ${color4}remaining: ${exec upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "time to empty" | awk '{print $4" "$5}'}${endif}${endif}
Thanks so much and I hope you have fun doing the conversion :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Koentje »

Try this bash script. It will give you 3 files in the tempfiles directory.
bat-level.tmp level of battery without color code for the bar
bat-hwmon.tmp path to your hwmon sysfs files
bat-info.tmp Manufacturer, model, type, AC connected, colored charging text, colored level, colored remaining

So if you want the colored level then use the following syntax in conky:
${execp cat ./tempfiles/bat-info.tmp | head -n5 | tail -n1}

Have fun!

http://cobrasoft.myftp.org:1179/scripts ... 1.0.tar.gz
Last edited by Koentje on Tue May 21, 2024 8:31 pm, edited 2 times in total.
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Koentje wrote: Tue May 21, 2024 8:24 pm Try this bash script. It will give you 3 files in the tempfiles directory.
bat-level.tmp level of battery without color code for the bar
bat-hwmon.tmp path to your hwmon sysfs files
bat-info.tmp Manufacturer, model, type, AC connected, colored charging text, colored level, colored remaining

Have fun!

http://cobrasoft.myftp.org:1179/scripts ... 1.0.tar.gz
OOOOOOOOOOOO!!

an opportunity to add more display details :)

downloading and beginning work now, I will post results when I have them :)

Thank you Koentje :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Koentje wrote: Tue May 21, 2024 8:24 pm Try this bash script. It will give you 3 files in the tempfiles directory.
bat-level.tmp level of battery without color code for the bar
bat-hwmon.tmp path to your hwmon sysfs files
bat-info.tmp Manufacturer, model, type, AC connected, colored charging text, colored level, colored remaining

So if you want the colored level then use the following syntax in conky:
${execp cat ./tempfiles/bat-info.tmp | head -n5 | tail -n1}

Have fun!

http://cobrasoft.myftp.org:1179/scripts ... 1.0.tar.gz
I am starting as simply as possible. I used your provided code to see if I could start by displaying one line.
I have a blank display however. I am sure I have made some silly or obvious mistake but I don't see it.

The file paths are /home/logansfury/.conky/Mainte

I have put the battery-info dir at /home/logansfury/.conky/Mainte/battery-info

so temp file is located at /home/logansfury/.conky/Mainte/battery-info/tempfiles

I am using this code:

Code: Select all

conky.text = [[

${execp ./battery-info/battery_charging.sh}
${execp cat ./battery-info/tempfiles/bat-info.tmp | head -n5 | tail -n1}
]];
I remembered to make the bash executable, so I assume I botched the conky code? May I get a correction please?
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Koentje »

Logansfury wrote: Tue May 21, 2024 9:32 pm I have put the battery-info dir at /home/logansfury/.conky/Mainte/battery-info
Place the bash script in the same directory as the conky is placed in. Then in that same directory make a folder
called tempfiles. Or else you get to many subfolders going on...
${execp ./battery-info/battery_charging.sh}
I have said this many times. Only use the p if the bash script echo's conky commands back! Like ${color1} etc.. This script does not echo anything back, so remove the p from execp. With it, the command takes a little more cpuload!
${execp cat ./battery-info/tempfiles/bat-info.tmp | head -n5 | tail -n1}
In here the p is correct, because the text comming back has conky objects in it!
I remembered to make the bash executable, so I assume I botched the conky code? May I get a correction please?
Have you checked in that file on line 5 if there is an actual value?? Maybe the bash script couldn't find anything?
Have you ran the bash script on the terminal? Did it produce an error of any kind?
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Koentje wrote: Tue May 21, 2024 9:48 pm I have put the battery-info dir at /home/logansfury/.conky/Mainte/battery-info
Place the bash script in the same directory as the conky is placed in. Then in that same directory make a folder
called tempfiles. Or else you get to many subfolders going on...
Check!
${execp ./battery-info/battery_charging.sh}
I have said this many times. Only use the p if the bash script echo's conky commands back! Like ${color1} etc.. This script does not echo anything back, so remove the p from execp. With it, the command takes a little more cpuload!
Check! execp edited to exec
${execp cat ./battery-info/tempfiles/bat-info.tmp | head -n5 | tail -n1}
In here the p is correct, because the text comming back has conky objects in it!
Understood!
I remembered to make the bash executable, so I assume I botched the conky code? May I get a correction please?

Have you checked in that file on line 5 if there is an actual value?? Maybe the bash script couldn't find anything?
Have you ran the bash script on the terminal? Did it produce an error of any kind?
For crying out loud in an escalated tone of voice!!!!!

Ya sabotaged me Keontje :D

The command from you that I copy/pasted was cat ./battery-info/tempfiles/bat-info.tmp | head -n5 | tail -n1

The file isnt named bat-info.tmp it is named batt-info.tmp!!

I just put in the missing "T" and everything is working :D

Stand by while I do formatting and figure out how to best fit this into the existing display :)
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

OK, I have made progress. I added the % symbol into the echo so it would be displayed in color

The battery is currently charging, and the batt-info.tmp reads:

Code: Select all

ASUSTeK G751-60Li-ion
Li-ion

${color FFFFFF}Charging
${color FFFFFF}91%
${color FFFF00}
Time to full doesn't seem to be available.

Here is the working conkyrc:

Code: Select all

${exec ./battery_charging.sh}
${execp cat ./tempfiles/batt-info.tmp | head -n5 | tail -n1}
state: ${execp cat ./tempfiles/batt-info.tmp | head -n4 | tail -n1}
model: ${execp cat ./tempfiles/batt-info.tmp | head -n1 | tail -n1}
]];
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Battery filled and power cable is removed.

The file now says:

Code: Select all

ASUSTeK G751-60Li-ion
Li-ion

${color FFFFFF}Discharging
${color FFFFFF}91%
${color FFFF00}
Time remaining is missing it appears
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Koentje »

Logansfury wrote: Tue May 21, 2024 10:54 pm The file isnt named bat-info.tmp it is named batt-info.tmp!!

I just put in the missing "T" and everything is working :D

Stand by while I do formatting and figure out how to best fit this into the existing display :)
Ahh shoot.. my bad! I made a typo in the script. The battery level is saved in bat-level.tmp. (single t).
So i thought they were all with a single t. It was late (early in the morning) last night..

The last line in batt-info is the remaining tim. That often takes a minute to show up, because it needs to recalculate.

I see you're AC connected doesn't work.. i have to check another script i made for a better solution, but have to go now. Will do that tonight.


EDIT: Try this script
battery_info_v1.1.tar.gz
(892 Bytes) Downloaded 24 times
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Koentje wrote: Wed May 22, 2024 7:55 am
Logansfury wrote: Tue May 21, 2024 10:54 pm The file isnt named bat-info.tmp it is named batt-info.tmp!!

I just put in the missing "T" and everything is working :D

Stand by while I do formatting and figure out how to best fit this into the existing display :)
Ahh shoot.. my bad! I made a typo in the script. The battery level is saved in bat-level.tmp. (single t).
So i thought they were all with a single t. It was late (early in the morning) last night..

The last line in batt-info is the remaining tim. That often takes a minute to show up, because it needs to recalculate.

I see you're AC connected doesn't work.. i have to check another script i made for a better solution, but have to go now. Will do that tonight.


EDIT: Try this script
battery_info_v1.1.tar.gz
Just saw the edit. Grabbing new script now, thanks so much!

Will post results shortly
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

The new temp file now reads:

Code: Select all

ASUSTeK G751-60Li-ion
Li-ion

${color FFFF00}Discharging
${color FFFF00}22
${color FF6E00}
still no time remaining I'm afraid :(
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Now that I got my mp3 working to only play once, I have replaced the test mp3 with the real deal.

I went to a text2speech site and created 2 mp3's, one of a lady saying "disconnect the power cable" and the other saying "connect the power cable"

I then made a second instance of the code, so what I have now is IF battery power level is <= 5 and state is discharging, red text displays on the screen saying CONNECT POWER CABLE, and when it first hits this level, an mp3 plays saying to connect the cable

the second two lines check IF battery power level is >=95 and state is charging. When these conditions are first met the mp3 plays the voice saying "disconnect power cable" and a persistent red text appears reading DISCONNECT POWER CABLE.

It's coming along :D
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Koentje »

Good work!

Have you waited a minute (or 2) for the remaining time to show? It needs to recalculate.. takes a while.
Image
User avatar
Logansfury
Level 8
Level 8
Posts: 2375
Joined: Fri Oct 27, 2023 4:08 pm
Location: Las Vegas NV, USA

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Logansfury »

Koentje wrote: Wed May 22, 2024 4:26 pm Good work!

Have you waited a minute (or 2) for the remaining time to show? It needs to recalculate.. takes a while.
Thank you :)

I had not waited, I merely dub clicked the bash file then opened the tmp file in a text editor. I will repeat the process, but I will check the tmp file several times over 2-5 mins and see what I see!
Image <-- Cick for sudo inxi --usb -Fxxxnmprz output, updated hourly!
User avatar
Koentje
Level 8
Level 8
Posts: 2079
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Looking to add color coding and an alert to battery meter [SOLVED]

Post by Koentje »

Or try this conky and see what you will see and what not..
https://www.cobrasoft.nl/download/conky ... 1.1.tar.gz
Image
Post Reply

Return to “Compiz, Conky, Docks & Widgets”