dj95/zjstatus

battery status

Closed this issue · 5 comments

is this possible

on my laptop it would be nice to have battery status

dj95 commented

Hey,

at this point it's just possible with the command widget. You could write a script or command that outputs the percentage and zjstatus will display it with the widget.

Another option is not possible, unfortunately, due to the WASM sandbox

rip

@AmySour
@dj95

Thanks to the command widget, I managed to show system info with conky.

the info from left to right are:

  • uptime
  • disk usage
  • load average
  • memory usage
  • battery percentage

the command is

conky -i1 -c ~/.conky/conky.conf

conky.conf is as follow:

conky.config = {
	units_spacer = '',
    short_units = true,
    out_to_console = true,
    total_run_times = 1,
};
conky.text = [[�[0m�[38;2;0;0;0m�[48;2;122;168;159m${uptime_short}�[38;2;122;168;159m�[48;2;152;187;108m�[38;2;0;0;0m�[48;2;152;187;108m${fs_used_perc}% ${fs_free}�[38;2;152;187;108m�[48;2;126;156;216m�[38;2;0;0;0m�[48;2;126;156;216m${loadavg 1}�[38;2;126;156;216m�[48;2;156;134;191m�[38;2;0;0;0m�[48;2;156;134;191m${memperc}% ${memmax} 󰁹${battery_percent}%�[0m]]

You guys will notice that I get several information in one shot, because it is fast.
conky do support fg: bg: syntax, but it don't work with jzstatus out of the box.
Thus, I have to write my raw color code explicitly in the conf. But It is worth to do so in terms of performance.

Besides, I modified the command widget in order to output the raw color code.
I'm still working on integrating my code to zjstatus in a better way.
@dj95 would you tell me how to run the benchmark ? I need this before summiting a PR.
thanks!

Screenshot from 2023-12-22 16-11-35

Hello @benzwt

thank you for your effort! I really appreciate your work and contribution.

In my last coding session I didn't implement a benchmark for the command widget because it only rendered the output and benchmarking the zellij part with run_command does not make sense IMO. However, I've added the benchmark for it right now, such that you can validate the performance impact of your implementation.

You can run just bench in case you have just installed. Otherwise you could directly run the command printed in the justfile (https://github.com/dj95/zjstatus/blob/main/justfile#L2).

In case you need any advice or review, feel free to open a draft pull request, so we can directly work on it together.

@AmySour
@dj95

Merry X'mas !
my PR is submitted #28