Skip to content

[Feature request] Environment field in custom scripts #2090

@bbaserdem

Description

@bbaserdem

Is your feature request related to a problem? Please describe.

I have a set of scripts which I use in my polybar config. I have a wrapper script to format them correctly; so i usually call them using the following syntax; ~/.config/sysinfo/sysinfo.sh -n pulseaudio -a cyan. The reason I do have a wrapper script is I use these scripts across different setups.

Some other tools allow to custom set environment variables; so I do some customization of environment variables. (For example; the sysinfo.sh -n <name> is analogous to name=<name> sysinfo.sh)

Why does polybar need this feature?

This would help users organize their custom scripts; as there can be one main block like the following;

[module/skeleton]
type = custom/script
tail = true
interval = 0
label = %output%
format = <label>
exec = ~/.config/sysinfo/sysinfo.sh

And then each custom script section could be defined like following;

[module/clock-script]
inherit = module/skeleton
environment = 'name=clock accent=cyan'

Which would make the config file more modular and organized.

Describe the solution you'd like

Add a config option environment to a script that gets parsed to the beginning of a custom script's exec line.

Describe alternatives you've considered

I currently read command line arguments; but it takes more work to do so.

Additional context

Not really a vital or needed improvement; but I was thinking it could be trivial to implement.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions