Skip to content

[FEATURE] Initialize basic variables with shell output #883

@ulinja

Description

@ulinja

Description of the requested feature

It is currently not possible to initialize basic variables using the output of a shell command. Basic variables can only be initialized using a literal value assignment:

(defvar current-volume 100)

My current workaround is to first spawn a window containing a widget which references the variable, and then updating the variable externally:

eww open my-bar && eww update current-volume=$(pamixer --get-volume)

It would be a nice addition to be able to initialize basic variables from shell output directly in eww.yuck.

Proposed configuration syntax

This could be accomplished by adding a simple boolean parameter, called for example execute, to the defvar-directive:

(defvar current-volume :execute true `pamixer --get-volume`)

If the parameter is true, the specified string gets executed in a spawned shell, and the shell's output gets assigned to the variable.

Additional context

No response

Edit: fix example code snippet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions