Skip to content

Toggle visibility of a module #2108

@tobeypeters

Description

@tobeypeters

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

I don't want, in my case, the mpd module to show unless I'm wanting to listen to music

Why does polybar need this feature?

It'd be nice to have. There's got to be other scenarios when you might want to do this. Like, maybe in case you just want a quick glance at memory usage or cpu usage or something and you don't want it in your face 100% of the time.

Describe the solution you'd like

Be able to send a polybar-msg to it from, in my case, i3 via a key binding.

You could even maybe create a new module container thing, which you'd list the modules you want grouped together.

# Create the following containers for me
[container/systemrelated]
# anything after contains are modules you have defined
contains = cpu memory temp
# Default visibility state - true
visible = false

or

# Define the containers you want
containers = systemrelated anothercontainer yetanothercontainer

# Then, inside of a module, you could assign it to a container
[module/cpu]
type = custom/script

... other cpu settings

container = systemrelated

... other cpu settings

[module/memory]
type = custom/script

... other memory settings

container = systemrelated

... other memory settings

Now, in my case i3, I can setup a keybinding which sends a cmd to polybar, which would hide or show the modules in the specified container. If it doesn't find the specified container, it'd default to looking for a single module with that name.

Describe alternatives you've considered

None

Additional context

None

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions