Created
March 26, 2026 13:31
-
-
Save cekstam/45c3c93ea01a9b065c1308c34c4533c3 to your computer and use it in GitHub Desktop.
Make swaync notifications disappear for visible apps in sway
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| ... | |
| "scripts": { | |
| "swaync-mute": { | |
| "exec": "/path/to/swaync-mute.sh", | |
| "run-on": "receive" | |
| } | |
| }, | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Place swaync-mute.sh somewhere and make it executable, and reference that path i
.config/swaync/config.jsonas above. Works like a charm