You are not logged in.

#1 2021-10-22 18:06:58

helvetica2
Member
Registered: 2021-08-27
Posts: 9

Color from zsh script not showing through on i3blocks (wayland)

This is probably a dumb question but I can't seem to find the solution online.

So say I have a simple zsh script for displaying screen brightness

! /usr/bin/zsh
BRIGHTGET=$(brightnessctl get)
CUR=$(($BRIGHTGET*100/255))
print -P "%B%F{166} Screen ${CUR}%%%f%b"

This prints with the right color when I run the script, but when I put it into my .config/i3blocks/config file, which looks like this

[brightness]
command=zsh blocks/brightness.sh
interval=10

It prints out white. I realize I can add `color=#1bdbe3` to the config but I want the option to vary color in future zsh scripts. How do I go about this? It seems like no one else is having this issue even though it seems like it would be a common problem. My sway/wayland config has

bar {
    position bottom
    status_command i3blocks
    colors {
        background #323232
    }
}

Which seems pretty basic to me. Any help would be appreciated!

Edit: updated tags to [ code ]

Last edited by helvetica2 (2021-10-22 23:58:13)

Offline

#2 2021-10-22 19:40:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,497
Website

Re: Color from zsh script not showing through on i3blocks (wayland)

Please use [ code ] tags for code not [ ins ] tags (which are pretty much unreadable on some of the forums themes / styles).

As for the issue - I don't use i3blocks, but according to the documentation your input can either be in "raw" format or "json" with the former being the default.  And the "raw" format requires the fulltext, shorttext, color, etc each to be on different lines.  Your script is generating what looks to be a form of format string.  Where is this documented?  Are you sure that's supported?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB