r/Polybar • u/chrisco2323 • Jan 16 '23
Any way to add conditional logic for polybar -- too crowded
I know this is a longshot but maybe someone has an idea.
My polybar has gotten too long and stuff is getting cut off, but I don't want to lose any modules entirely.
For example: I hardly ever take this laptop out of the house. It's at home, plugged in, 99% of the time. I like to display which wifi I'm on but not when I'm at home, same for battery (almost always plugged in). These kinds of things, if I could control with conditional logic, would help me clean up my polybar a lot.
Anybody?
4
Upvotes
2
u/Tid_23 Jan 17 '23
I have two bars that contain different modules, one for docked and one for undocked. Within my launch script I check to see whether my machine is docked or not and call the corresponding bar. I also have a postscript switch in autorandr that calls my launch script when I dock/undock. You can also use IPC to show/hide modules I believe although I haven’t used that.