glzr-io / zebar

Zebar is a tool for creating customizable and cross-platform taskbars, desktop widgets, and popups.
GNU General Public License v3.0
317 stars 26 forks source link

[Feature Request] Shell / text provider #75

Open robertmoelker opened 1 month ago

robertmoelker commented 1 month ago

Summary

Request to add support for reading from text files and/or executing scripts at scheduled intervals in Zebar.

Description

I've used GlazeWM v2 to display time tracking information from Toggl. I've created a shell script to output the status of a CLI to a text file, which was then read by the status bar. A cronjob on my local machine ran the script every two minutes to keep it up-to-date. Can Zebar include a feature to read from a text file or possibly execute a script at scheduled intervals?

Use Case

This feature would be useful for displaying dynamic and real-time information from various sources, such as time tracking tools, system monitoring scripts, or any other data that can be output to a text file or script.


PS: I've just installed the new version of GlazeWM & Zebar and it works great!

lars-berger commented 3 weeks ago

100% agree this would be a nice feature. Perhaps a config like this?

providers:
  - type: 'shell'
    alias: 'music'
    command: 'node music_player_backend.js'
    update_method:
      continuous: false
      interval: 5000
template: |
  {{ music.output }}
  {{ music.prevOutputs }}

An idea is to expose a shell.exec({ commandOverride?: string }) function to explicitly run it and even override the command so that different flags could be passed.

robertmoelker commented 3 weeks ago

100% agree this would be a nice feature. Perhaps a config like this?

providers:
  - type: 'shell'
    alias: 'music'
    command: 'node music_player_backend.js'
    update_method:
      continuous: false
      interval: 5000
template: |
  {{ music.output }}
  {{ music.prevOutputs }}

An idea is to expose a shell.exec({ commandOverride?: string }) function to explicitly run it and even override the command so that different flags could be passed.

That sounds perfect to me!

HeyItsGilbert commented 2 weeks ago

Parsing a text file would be handy. Then users could script in whatever language they want and write to a file. Personally I'd want to exec PowerShell, but I'm perfectly happy writing to a file and having zebar read it.