[dev] [slstatus] is there a way to print a string just once? (or "a better way to working with i3bar?")

From: Gildásio Júnior <gildasiojunior_AT_riseup.net>
Date: Sat, 5 Aug 2023 11:59:14 -0300

Hi all,

I use i3wm for now and want to test slstatus. I configured it easily,
but to colors works (as I understand) i3bar has to receive its input as
json, starting it with a version then an endless array such as:

    {"version":1}
    [
    [],
    ["name":"time","full_text":"bla","color":"#FF0000"],
    ["name":"time","full_text":"bla","color":"#FF0000"],

Where each line in the endless array is the status line i3bar will
shows.

I just configured the slstatus format string to properly returns a json
like:

    { datetime, ",{\"name\":\"time\",\"full_text\":\"%s\",\"color\":\"#f1fa8c\"}]", "%F %T" },

But to show the `{"version":1}[` part just once I need to use an script.
So my current configuration is something like this:

    $ grep 'status_command' ~/.config/i3/config
    #status_command i3status
    status_command /home/gildasio/.gits/config/dotfiles/scripts/slstatus.sh
    #status_command slstatus -s
    $ cat /home/gildasio/.gits/config/dotfiles/scripts/slstatus.sh
    #!/usr/bin/env bash

    echo '{"version":1}'
    echo '['
    echo '[]'
    slstatus -s

Is there a proper way to slstatus print this `{"version":1}[` only once?

-- 
[]'s
Gildásio Júnior

Received on Sat Aug 05 2023 - 16:59:14 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 05 2023 - 17:00:12 CEST