Ubuntu 24.04(Raspberry Pi 5 arm64+Wayland)下编写启动脚本模拟快捷键消除ZapZap后台启动通知的需求
Hey folks, let me walk you through this annoying little issue and the fixes I worked out for it.
I’m running Ubuntu 24.04 Noble on a Raspberry Pi 5 (arm64), using Wayland as my window manager. I rely on the Snap package of ZapZap for WhatsApp, which is set to auto-start when my system boots. The problem? Every time it launches, Ubuntu pops up a system notification saying "ZapZap started in the background"—and ZapZap’s dock icon treats this alert exactly like an unread message. Even when I’ve cleared all my WhatsApp chats, that stubborn "1" stays glued to the dock icon because of this silly startup notice.
I did reach out to the ZapZap developer community about this, but the issue was closed without a fix that worked for my setup. So I decided to roll up my sleeves and solve it myself.
First, here’s the manual workaround: to get rid of that notification, you can use these keyboard shortcuts:
- Press
Super+Vto open the notification center - Locate the "ZapZap started in the background" notification, then hit
Deleteto dismiss it
But doing this every boot is a hassle, right? Let’s automate it with a startup script.
Option 1: Simulate Keyboard Shortcuts (Wayland-compatible)
Since xdotool doesn’t play nice with Wayland, we’ll use ydotool instead. First, install it:
sudo apt install ydotool
Next, create a script file (I named mine zapzap-clean-notification.sh) with this content:
#!/bin/bash # Wait a few seconds for ZapZap to launch and show the notification (adjust this delay if needed) sleep 5 # Simulate Super+V to open the notification center ydotool key Super_L+v # Give the notification center a moment to load sleep 1 # Simulate Delete to remove the first notification (which should be the startup alert) ydotool key Delete # Optional: Close the notification center by pressing Super+V again sleep 0.5 ydotool key Super_L+v
Make the script executable:
chmod +x zapzap-clean-notification.sh
Now set it to run on startup:
- Open "Startup Applications" from your system menu
- Click "Add"
- Name it something like "ZapZap Notification Cleaner", set the command to the full path of your script (e.g.,
/home/your-username/zapzap-clean-notification.sh), and add a note like "Clears ZapZap's startup system notification" - Ensure ZapZap's auto-start is enabled, and if your desktop environment allows, set this script to run after ZapZap (if not, just tweak the
sleeptime in the script to give ZapZap enough time to launch first)
Option 2: Use DBus to Target the Exact Notification (More Precise)
This method avoids simulating keyboard presses entirely and directly interacts with the notification system via DBus—way more reliable, and no risk of deleting other notifications.
Create a script with this content:
#!/bin/bash # Wait for the notification to appear sleep 5 # Find the ID of the ZapZap startup notification NOTIFICATION_ID=$(gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.GetNotifications | grep -oP '(?<="ZapZap started in the background", )\d+' | head -n1) # If we found the notification ID, dismiss it if [ ! -z "$NOTIFICATION_ID" ]; then gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.CloseNotification $NOTIFICATION_ID fi
Again, make it executable and add it to startup applications like the first option. This is my go-to solution since it’s targeted and won’t interfere with other alerts.
备注:内容来源于stack exchange,提问作者Ryan Smith

