You are not logged in.

#1 2023-06-10 19:59:37

JasonMehmel
Member
Registered: 2015-10-06
Posts: 186

tint2 battery text formatting? (2nd listing is only partial visible)

So, I've been tweaking my system as we are wont to do, and I decided I liked the ability for the battery indicator to both show the battery percentage and the time left.

Going with the tint2 option of displaying both Bat1 and Bat2 with their defaults, this is exactly what I get!

But... the display of these two things isn't always consistently shown. I can always see the battery percentage, but often the time remaining is pushed below, mostly off-screen.

I've played a bit with the padding but haven't found an option that will work.

I don't know if there's a way to 'center' the display so both are always shown, that I can't yet determine from the tint2 docs.

I had the idea of trying to have a double-listing of the battery indicators, one with the pecentage and another with the time left, something like panel_items = PTESBBCP. But I'm not sure how to list that in the rc file... just a second block of code for the second battery?

I'm not sure what else to google to find solutions, either!


Fortune favours the bold.
ThinkPad T15 Gen 2i

Offline

#2 2023-06-10 20:28:05

PackRat
jgmenu user Numero Uno
Registered: 2015-10-02
Posts: 2,611

Re: tint2 battery text formatting? (2nd listing is only partial visible)

Use the battery format string instead of two battery blocks -  https://gitlab.com/o9000/tint2/blob/mas … md#battery

bat1_format = FORMAT_STRING : Format for battery line 1. Default: %p. (since 1.0) Format specification:

%s: State (charging, discharging, full, unknown).
%m: Minutes left until completely charged/discharged (estimated).
%h: Hours left until completely charged/discharged (estimated).
%t: Time left. Shows "hrs:mins" when charging/discharging, or "Ful" when full.
%p: Percentage. Includes the % sign.
%P: Percentage. Without the % sign.
#-------------------------------------
# Battery
battery_tooltip = 1
# battery_hide = 40
battery_low_status = 40
battery_low_cmd = notify-send 'Battery low!!'
battery_full_cmd = 
bat1_font = Roboto Mono Regular 11
bat2_font = Roboto Mono Regular 0
battery_font_color = #C5C6C8 100
bat1_format = %p %s %t
bat2_format = 
battery_padding = 16 0
battery_background_id = 0
battery_lclick_command = 
battery_rclick_command = 
battery_mclick_command = 
battery_uwheel_command = 
battery_dwheel_command = 
ac_connected_cmd = 
ac_disconnected_cmd = 

2023-06-10-162545-397x136-scrot.png

If you prefer vertical stack, you'll probably need to tweak the font sizes for the battery info and maybe the panel height for the desired aesthetic.

Last edited by PackRat (2023-06-10 20:33:06)


You must unlearn what you have learned.
    -- yoda

Offline

#3 2023-06-10 21:15:48

JasonMehmel
Member
Registered: 2015-10-06
Posts: 186

Re: tint2 battery text formatting? (2nd listing is only partial visible)

PackRat wrote:

Use the battery format string instead of two battery blocks .

This (and the rest of your description) is perfect! And a good reminder: those options are strings, not single choices!)

Thank you!

Now I'm finding it's not always showing the time remaining while charging... (because I've been playing with this during the recharge phase) but that's not as critical. I'm going to keep an eye on it the next time I'm discharging to see if there's any issues.


Fortune favours the bold.
ThinkPad T15 Gen 2i

Offline

Board footer

Powered by FluxBB