ironbar icon indicating copy to clipboard operation
ironbar copied to clipboard

Allow Dynamic String parsing for "ironvar_defaults"

Open izelnakri opened this issue 5 months ago • 7 comments

While building my own very advanced & custom ironbar, I noticed currently ironvar_defaults doesnt accept Dynamic String parsing. This is a big missing feature I think because:

1- Although I can accomplish the retrieval of pretty much any value in my operation system with Dynamic Strings, scripts or bash one-liners, having all the important metadata in ironvar_defaults seems like a good/best practice. That way I can get basic information of my operating system outside my configuration file as well, by running $ ironbar get disk-usage-percentage etc. 2- Having them as a variable that can be watched/polled routinely would DRY up a lot of repetitive bash one liners or hand rolling custom scripts. Example:

{
  "ironvar_defaults": {
    "disk-usage-in-percentage": "{{30000:df -h / | awk 'NR==2 {print $5}'}}",
    "disk-usage-in-gb": "{{30000:df -h --output=used / | awk 'NR==2 {print $1}'}}"
  },
  "start":  [
        {
          "type": "label",
          "label": "🗄️ #disk-usage-in-percentage [#disk-usage-in-gb]"
    }
  ]
}

This way I can also access these variables from outside the configuration via:

$ ironbar get disk-usage-in-percentage, without having to repeat the expressions inside and outside of the ironbar configuration file.

izelnakri avatar Jan 25 '24 15:01 izelnakri