Intro

I think a tasteful blur and a bit of transparency can really spice up a good setup. However, there are times that I don’t want to have the blur on. Whether this be for a specific color theme, or just to make reading code easier, I like having easy access to my blur settings without memorizing huge commands.

Solution

Since I already have a similar module for dunst notifications, I decided to attempt to replicate the same thing for picom. We can add the following module to our polybar config.

[module/blur-toggle]
type = custom/ipc
hook-0 = echo 
hook-1 = echo 
click-left = /home/gideon/dotfiles/dotfiles/scripts/blurtoggle.sh
initial = 1
format-foreground = ${colors.color4}

Now you can change the filepath on the click-left variable to point at wherever you keep your scripts. But point it at a script that has the following contents:

#!/usr/bin/sh
if (($(ps -aux | grep [p]icom | wc -l) > 0))
then
  polybar-msg hook blur-toggle 1
  pkill -9 picom
else
  polybar-msg hook blur-toggle 2
  picom -b --config=/home/gideon/.config/picom/picom.conf --experimental-backends --backend glx --blur-method dual_kawase &
fi

Again, you can replace the path used in the --config flag with wherever you keep your picom config.

Conclusion

I have found this method to work rather well with a couple exceptions. I find that if I leave the blur on for extended periods, the “button” indicator in polybar will flip to inactive even though the blur remains.

When this “desyncing” occurs, I simply flip the toggle twice and it resets things to normal. If anyone knows a fix or cause for this, I’d be glad to hear it.