Skip to content

[Feature request] Support long running commands #93

@Artemigos

Description

@Artemigos

Current status:
The extension polls for updates by repeatedly running the same command in set intervals. This introduces a delay between actual change and display.

Solution idea:
Support long running commands that push updates as new output lines. Every time the executed command would write a line of text to stdout, executor would immediately show that line on the widget. The command doesn't end between output lines, instead it goes to sleep until some external operation wakes it up - the command then evaluates changes to the state and writes another line to stdout and goes to sleep again. After detecting a new line, executor would update the text on the widget with new content.

This effectively changes the update model from poll to push. I don't know how widespread the pattern is, but I know Waybar supports it.

Impact:
We get immediate updates when things change - I have a few widgets (like my currently playing song or volume) with 3/5s poll. In return, the process handling/spawning code would become a little more complicated.

Good test case:
playerctl has a --follow flag that behaves exactly like this - writes a new line only when something needs to change in the preview.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions