emersion / mako

A lightweight Wayland notification daemon
https://wayland.emersion.fr/mako
MIT License
2.17k stars 137 forks source link

App specific notification settings #503

Closed Ay1tsMe closed 5 months ago

Ay1tsMe commented 6 months ago

I am trying to configure mako to play a notification sound for every application except Spotify. I thought maybe I can specify in the config the following:

[app-name="Spotify"]
on-notify=exec true

However, I get the following error when I try to restart mako

[1] 225527
Setting `max_visible` is allowed only for `output` and/or `anchor`                      
Invalid configuration in criteria: [app-name="Spotify"]
Failed to parse config
[1]  + 225527 exit 1     mako

My current config is as follows:

# GLOBAL CONFIGURATION OPTIONS
max-history=100
sort=-time

# BINDING OPTIONS
on-button-left=dismiss
on-button-middle=none
on-button-right=dismiss-all
on-touch=dismiss
on-notify=exec mpv /usr/share/sounds/freedesktop/stereo/message.oga

[app-name="Spotify"]
on-notify=exec true

# STYLE OPTIONS
font=JetBrains Mono 10
width=300
height=100
margin=10
padding=15
border-size=2
border-radius=10
icons=1
max-icon-size=48
icon-location=left
markup=1
actions=1
history=1
text-alignment=left
default-timeout=5000
ignore-timeout=0
max-visible=5
layer=overlay
anchor=top-center

background-color=#0f121a89
text-color=#c9c3c1
border-color=#557588
progress-color=over #89dceb

Is it possible to do this? Or am I not able to invoke on-notify for specific apps?

emersion commented 5 months ago

The [app-name="Spotify"] block needs to appear at the end of the config file, or else everything under # STYLE OPTIONS is parsed as config options under that block instead of being globally applied.

Ay1tsMe commented 5 months ago

The [app-name="Spotify"] block needs to appear at the end of the config file, or else everything under # STYLE OPTIONS is parsed as config options under that block instead of being globally applied.

Yep that worked. Spotify no longer played a sound. Thank you.