Skip to content

Instantly share code, notes, and snippets.

@cekstam
Created March 26, 2026 13:31
Show Gist options
  • Select an option

  • Save cekstam/45c3c93ea01a9b065c1308c34c4533c3 to your computer and use it in GitHub Desktop.

Select an option

Save cekstam/45c3c93ea01a9b065c1308c34c4533c3 to your computer and use it in GitHub Desktop.
Make swaync notifications disappear for visible apps in sway
{
...
"scripts": {
"swaync-mute": {
"exec": "/path/to/swaync-mute.sh",
"run-on": "receive"
}
},
...
}
#!/bin/bash
#echo "swaync_body: $SWAYNC_BODY"
#echo "swaync_desktop_entry: $SWAYNC_DESKTOP_ENTRY"
#echo "swaync_urgency: $SWAYNC_URGENCY"
#echo "swaync_time: $SWAYNC_TIME"
#echo "swaync_app_name: $SWAYNC_APP_NAME"
#echo "swaync_category: $SWAYNC_CATEGORY"
#echo "swaync_replaces_id: $SWAYNC_REPLACES_ID"
#echo "swaync_id: $SWAYNC_ID"
#echo "swaync_summary: $SWAYNC_SUMMARY"
for APP in $(swaymsg -t get_tree|jq -r '(recurse(.nodes[]) | select(.visible)).app_id'); do
echo $app;
if [[ "$SWAYNC_APP_NAME" == "$APP" ]]; then
swaync-client --close-latest
fi
done
@cekstam
Copy link
Copy Markdown
Author

cekstam commented Mar 26, 2026

Place swaync-mute.sh somewhere and make it executable, and reference that path i .config/swaync/config.json as above. Works like a charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment