I3status-rust: Battery block ignores warning_fg color

Created on 5 Jun 2020  Â·  14Comments  Â·  Source: greshake/i3status-rust

This morning my laptop battery drained down into the Warning zone and the block's background color changed to the warning_bg color, but the foreground color was not what it should be. It looks like #aaaaff ?

2020-06-05 09-48-39 flameshot

My settings:

[theme]
name = "plain"

[theme.overrides]
idle_bg = "#000000"
idle_fg = "#bbbbbb"
separator_fg = "#000000"
good_fg = "#24aa24"
good_bg = "#000000"
info_fg = "#aaaaaa"
info_bg = "#000000"
warning_bg = "#aaaa00"
warning_fg = "#0000ff"
critical_bg = "#ff6600"
critical_fg = "#000000"

bug fonts-and-rendering help wanted

Most helpful comment

Hi there. I'm now having trouble reproducing the issue!

It's possible that when I reproduced it with the latest code on Oct 23, I had alternating_tint_fg set and that was making it seem unfixed even though it was fixed. OK to close this for now, I say.

All 14 comments

Can you run i3status-rust from a terminal and check the output there? Assuming it's still like that.

OK, I had to drain the battery again before testing.

Then, first it complained "failed to open file: /home/eater/.config/i3status-rust/config.toml.\nCause: No such file or directory" until I made a symlink for it. Then:

{"version": 1, "click_events": true}
[[{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":" ","markup":"pango","name":"on_collapsed_click","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  ","markup":"pango","name":"bd11153d1a554e62844c9e371160fab7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  ","markup":"pango","name":"960f9d568b814c90afd9983bf1069b60","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":"","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" D ","markup":"pango","name":"5865092e4fb94c0e86b59f118a12a9e9","separator":false,"separator_block_width":0}],
[{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":" ","markup":"pango","name":"on_collapsed_click","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" 210% ","markup":"pango","name":"bd11153d1a554e62844c9e371160fab7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":"","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  ","markup":"pango","name":"960f9d568b814c90afd9983bf1069b60","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":"","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" D ","markup":"pango","name":"5865092e4fb94c0e86b59f118a12a9e9","separator":false,"separator_block_width":0}],
[{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  ","markup":"pango","name":"2b0543db1bfc4c5c89528be2b95abb83","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":" ","markup":"pango","name":"on_collapsed_click","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" 210% ","markup":"pango","name":"bd11153d1a554e62844c9e371160fab7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":"  74° ","markup":"pango","name":"74f23a41784b43ddb294b58ab21e23b7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" Fri June 05  12:08:18 ","markup":"pango","name":"960f9d568b814c90afd9983bf1069b60","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#AAAA00FF","color":"#AAAAFFFF","full_text":"  30% ","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  D ","markup":"pango","name":"5865092e4fb94c0e86b59f118a12a9e9","separator":false,"separator_block_width":0}],
[{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  ","markup":"pango","name":"2b0543db1bfc4c5c89528be2b95abb83","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":" ","markup":"pango","name":"on_collapsed_click","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" 210% ","markup":"pango","name":"bd11153d1a554e62844c9e371160fab7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":"  74° ","markup":"pango","name":"74f23a41784b43ddb294b58ab21e23b7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" Fri June 05  12:08:18 ","markup":"pango","name":"960f9d568b814c90afd9983bf1069b60","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#AAAA00FF","color":"#AAAAFFFF","full_text":"  30% ","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  D ","markup":"pango","name":"5865092e4fb94c0e86b59f118a12a9e9","separator":false,"separator_block_width":0}],
[{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  ","markup":"pango","name":"2b0543db1bfc4c5c89528be2b95abb83","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":" ","markup":"pango","name":"on_collapsed_click","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" 210% ","markup":"pango","name":"bd11153d1a554e62844c9e371160fab7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":"  74° ","markup":"pango","name":"74f23a41784b43ddb294b58ab21e23b7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" Fri June 05  12:08:18 ","markup":"pango","name":"960f9d568b814c90afd9983bf1069b60","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#AAAA00FF","color":"#AAAAFFFF","full_text":"  30% ","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  D ","markup":"pango","name":"5865092e4fb94c0e86b59f118a12a9e9","separator":false,"separator_block_width":0}],
[{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  ","markup":"pango","name":"2b0543db1bfc4c5c89528be2b95abb83","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":" ","markup":"pango","name":"on_collapsed_click","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" 210% ","markup":"pango","name":"bd11153d1a554e62844c9e371160fab7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000FF","color":"#FFFFFFFF","full_text":"  74° ","markup":"pango","name":"74f23a41784b43ddb294b58ab21e23b7","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":" Fri June 05  12:08:18 ","markup":"pango","name":"960f9d568b814c90afd9983bf1069b60","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#AAAA00FF","color":"#AAAAFFFF","full_text":"  30% ","separator":false,"separator_block_width":0},{"background":"#000000","color":"#000000","full_text":" ","markup":"pango","separator":false,"separator_block_width":0},{"background":"#000000","color":"#bbbbbb","full_text":"  D ","markup":"pango","name":"5865092e4fb94c0e86b59f118a12a9e9","separator":false,"separator_block_width":0}],

I haven't been able to reproduce this yet :(

OK I was able to reproduce using this config:

[theme]
name = "plain"

[theme.overrides]
idle_bg = "#000000"
idle_fg = "#bbbbbb"
separator_fg = "#000000"
good_fg = "#24aa24"
good_bg = "#000000"
info_fg = "#aaaaaa"
info_bg = "#000000"
warning_bg = "#aaaa00"
warning_fg = "#0000ff"
critical_bg = "#ff6600"
critical_fg = "#000000"

[[block]]
block = "custom"
command = "echo '{\"icon\":\"weather_thunder\",\"state\":\"Warning\", \"text\": \"Test1\"}'"
json = true

[[block]]
block = "custom"
command = "echo '{\"icon\":\"weather_thunder\",\"state\":\"Warning\", \"text\": \"Test2\"}'"
json = true

The first rendered block has the values from the config:

{"background":"#000000","color":"#000000","full_text":"|","markup":"pango","separator":false,"separator_block_width":0},{"background":"#aaaa00","color":"#0000ff","full_text":" STORM Test1","markup":"pango","name":"da104fa10e3d4dd385f077c987c3579b","separator":false,"separator_block_width":0},

The second rendered block has different values:

{"background":"#000000","color":"#000000","full_text":"|","markup":"pango","separator":false,"separator_block_width":0},{"background":"#AAAA00FF","color":"#0000FFFF","full_text":" STORM Test2","markup":"pango","name":"e16a343c790043df85014f8b66803881","separator":false,"separator_block_width":0}],

So this is due to the alternating tinting of the blocks. I haven't wrapped my head around that part of the code-base but either it's working as intended or the tinting calculations have a bug in them. Although looking at the alternating_tint_bg and alternating_tint_fg values for the plain theme they are both #000000 so I'm not sure it should be doing anything?
@GladOSkar Do you have any insight? (Previously you submitted #242 so I am just assuming you know a bit about how this alternating tint stuff is meant to behave)

Oof that was a while ago but I'll have a look at it when I have a bit of time later or tomorrow

I can't reproduce using neither config...

[
  {
    "background": "#000000",
    "color": "#000000",
    "full_text": "|",
    "markup": "pango",
    "separator": false,
    "separator_block_width": 0
  },
  {
    "background": "#aaaa00",
    "color": "#0000ff",
    "full_text": " STORM Test1 ",
    "markup": "pango",
    "name": "f63bf4a525554e3e92f4ed3eac0272ca",
    "separator": false,
    "separator_block_width": 0
  },
  {
    "background": "#000000",
    "color": "#000000",
    "full_text": "|",
    "markup": "pango",
    "separator": false,
    "separator_block_width": 0
  },
  {
    "background": "#AAAA00FF",
    "color": "#0000FFFF",
    "full_text": " STORM Test2 ",
    "markup": "pango",
    "name": "6c3beea42dc249599cbc785e83be704e",
    "separator": false,
    "separator_block_width": 0
  }
]

I also just went through the entire coloring & tinting logic and can't find any faults. Next step would be using a debugger but as long as i can't reproduce it i can't really be of help

Oh and looking at @ammgws' output again - those colors are entirely correct (the tinting just adds an alpha channel but that's not a problem. The problem is that @eater's system somehow outputs #AAAAFF (+alpha) - which is wrong and shouldn't happen. That actually looks as if bg and fg were added together, but that can't really happen. And it happens on neither @ammgws' nor my system.

@eater on which version are you? Current git master? If not please try again with that

Just pulled and I'll let you know. It's so convenient that the compile process consumes almost enough laptop battery to get me down into the Warning color zone -- clever design!

lol. In case you didn't know you can just set warning = 99 on the battery block to trigger the warning coloring sooner or use ammgws' custom blocks

That's even easier! Yes, it is still white-on-yellow with the latest master.
2020-10-23 13-35-44 flameshot

Well that truly is very weird. I'm stumped, sorry ¯\_(ツ)_/¯

@eater does it also happen with the test config using config blocks that I posted above?

@eater Gentle ping.

Hi there. I'm now having trouble reproducing the issue!

It's possible that when I reproduced it with the latest code on Oct 23, I had alternating_tint_fg set and that was making it seem unfixed even though it was fixed. OK to close this for now, I say.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ellsclytn picture ellsclytn  Â·  6Comments

lovesegfault picture lovesegfault  Â·  7Comments

greshake picture greshake  Â·  6Comments

Thra11 picture Thra11  Â·  6Comments

Nukesor picture Nukesor  Â·  5Comments