You are not logged in.
Hi All!
I have the following in my conkyrc:
${if_existing /sys/class/power_supply/ADP1/online 1}\
${execpi 3 $HOME/.config/conky/scripts/lastwakeup}
${execpi 3 $HOME/.config/conky/scripts/networks}
${execpi 3 $HOME/.config/conky/scripts/cpus}
${execpi 3 $HOME/.config/conky/scripts/mem}
${execpi 3 $HOME/.config/conky/scripts/drives}\
${else}\
${execpi 6 $HOME/.config/conky/scripts/lastwakeup}
${execpi 6 $HOME/.config/conky/scripts/networks}
${execpi 6 $HOME/.config/conky/scripts/cpus}
${execpi 6 $HOME/.config/conky/scripts/mem}
${execpi 6 $HOME/.config/conky/scripts/drives}\
${endif}
The different commands are some dash scripts checking on several stuff, and the idea is that if /sys/class/power_supply/ADP1/online file contains 1 then the laptop is plugged in and this I want 3 second refresh, but if something else is in that file (e.g. 0), then the laptop is powered from battery and then I want every refresh to happen only at 6 seconds.
According to http://conky.sourceforge.net/variables.html a second parameter should be supported. However, it doesn't work. It always refreshes everything every 3 minutes. I tried several ways: putting the parameters into double quotation marks, even changed the second parameter to 0, and switched the 3s and 6s, and still, refresh happens every 3 seconds.
Does anyone have any idea how this is supposed to work and/or what I'm doing wrong?
Thanks,
ghorvath
Edit: apparently, replacing the first line by
${if_match "${acpiacadapter}"=="on-line"}\
should work for any laptop. This latter one works if I try to echo something, but doesn't work with the 3 vs 6 seconds timings above. So it seems this is not a conditional but rather a timing issue?
Last edited by ghorvath (2021-02-28 22:07:56)
Offline
^acpiacadapter never worked for me (it is computer specific)
i think you need to run this twice
${if_existing /sys/class/power_supply/ADP1/online 0}
...
${else}
${if_existing /sys/class/power_supply/ADP1/online 1}
...
${endif}${endif}
although (doubt,doubt), the if_existing statement doesn't work on a system with BAT
if_match would be correct
Last edited by unklar (2021-03-01 11:51:08)
Offline
This works as expected on 1.11.5_pre.
I don't have a battery, I tested with /sys/devices/system/node/online and a normal file.
Maybe this isn't conky specific? Do you have /sys/class/power_supply/ADP1/online and does its value change accordingly?
Please use CODE tags for code.
Search youtube without a browser: repo | thread
BL quote proposals to this thread please.
my repos / my repos
Offline
@unklar, @ohnonot:
Thanks for the replies. Unfortunately, unklar's suggestion doesn't work. The file itself exists and has the proper 0 vs 1 values depending on whether I'm on battery or plugged in.
Tried these with ${if_match "${acpiacadapter}"=="on-line"} as well, still didn't work.
The main issue (why I do this whole workaround) is that update_interval_on_battery doesn't work if your battery is not BAT0. (Mine is BAT1.) This is fixed in conky 11, but not yet in conky 10.
I took a close look at what is written on execpi by the manual:
"Note that the output from the $execpi command is still parsed and evaluated at every interval."
It probably means I'm out of luck: as long as I define the update interval as 3 seconds, it will run all commands within 3 seconds again. If I set it to 6 seconds, it only runs the commands in every 6 seconds. I might need to wait until bullseye comes out to get this properly working.
Offline
battery = Battery status and remaining percentage capacity of ACPI or APM battery. ACPI battery number can be given as argument and points to "/proc/acpi/battery/BAT0/state". Default is battery "BAT0".
Not being an English speaker, I don't really understand what you want.
The main issue (why I do this whole workaround) is that update_interval_on_battery doesn't work if your battery is not BAT0. (Mine is BAT1.) This is fixed in conky 11, but not yet in conky 10.
I have never heard of this before. Of course, if you don't have BAT0, BAT1 must be specified. I've never seen it done any other way. But, I am not omniscient.
Tried these with ${if_match "${acpiacadapter}"=="on-line"} as well, still didn't work.
Maybe he expects concretely
${if_match "${acpiacadapter adp1}"=="on-line"}
What results
inxi -Bxxx
Offline