I love cmus and it provides a cool way to get a notification through a third party command .
To enable this feature in cmus just type in the command field:
:set status_display_program=YourSciptName
then press enter. Now let’s build our polybar ipc module because we’re going to use the hook function
of polybar witch is better than some silly interval that might heat the cpu’s.
But before we have to provide this in the master.conf, section [bar/master]
enable-ipc = true
Now edit the module.conf file:
[module/cmus]
type = custom/ipc
hook-0 = cat $HOME/.config/cmus/cmus_output
initial = 1
format-prefix = "CMUS: "
format-prefix-foreground = ${colors.blue}
click-right = cmus-remote -s
click-left = cmus-remote -p
And then create a script that will send an hook to polybar telling "please update the [module/cmus]
#!/bin/bash
# Define the output file path & name
opFile="$HOME/.config/cmus/cmus_output"
# cmus loop
while test $# -ge 2
do
eval _$1='$2'
shift
shift
done
echo "$_title - $_artist" > "$opFile"
sleep 0.2
# This sends a polybar hook to execute
# hook-0
polybar-msg hook cmus 1 >/dev/null 2>&1 &