da-rth / yasb

A highly configurable cross-platform (Windows) status bar written in Python.
MIT License
1.42k stars 80 forks source link

feat: add env-variable-aware cat widget #45

Closed LGUG2Z closed 2 years ago

LGUG2Z commented 2 years ago

Description

This PR adds a simple "CatWidget" which cats out contents from a file at a fixed interval. Example config here with a widget:

  kanata:
    kind: CatWidget
    class: yasb_kanata
    label: "layer: ${data}"
    target:
      file: "$TEMP/kanata_layer"
      interval: 1000

As you can see, environment variables get expanded (they require the $ prefix instead of %X% due to the format of the underlying lib), and the target file can be referenced with either Unix-y / path separators or Windows \ path separators.

da-rth commented 2 years ago

Closing this since its now possible to cat files and access environment variables via the CustomWidget

Thanks for your contribution 👍