WslNotifyd is an implementation of the Desktop Notifications Specification using Windows native functionality.
- WSL2 (WSL1 is not confirmed to work)
- WSL2 settings
- systemd enabled
- localhostForwarding enabled
- Windows interop enabled
- can connect D-Bus user session (check
$DBUS_SESSION_BUS_ADDRESS
) iconv
is installedgtk3
is installed if you want to display images
- Install .NET sdk on WSL2
- .NET 8 is confirmed to work
- Clone the repo
git clone https://github.com/ultrabig/WslNotifyd.git
- Build the app
cd WslNotifyd dotnet publish WslNotifyd -o out && dotnet publish WslNotifydWin --runtime win-x64 -o out/WslNotifydWin --self-contained
- Run the app
./out/WslNotifyd
- Send notifications from any app!
notify-send 'Hello' 'World!'
There are usage examples with images on the Wiki with images.
- Wait dismiss/action
notify-send -w foo
- Actions
notify-send -A 'action1=aaa' foo # with icons notify-send -h 'boolean:action-icons:true' -A 'firefox=Firefox' foo
- Urgency (critical only)
notify-send -u critical foo
- Custom icons
notify-send -i firefox foo
- Custom images
# 1*1 blue pixel (width, height, rowstride, has_alpha, bits_per_sample, channels, rgb data array) notify-send -h 'variant:image-data:(int32 1, int32 1, int32 3, false, int32 8, int32 3, [byte 0, 0, 255])' foo # specify custom image path notify-send -h 'string:image-path:/path/to/image.png' foo
- Custom sounds
- You need to choose from the predefined sounds for the
sound-name
notify-send -h 'string:sound-name:ms-winsoundevent:Notification.Reminder' foo
- You need to choose from the predefined sounds for the
- Suppress sounds
notify-send -h 'boolean:suppress-sound:true' foo
- Replace existing notifications
$ notify-send -p foo 1 $ notify-send -r 1 bar
- Add an inline reply textbox (non-standard KDE feature)
Use the following script to monitor replies.
notify-send -h 'string:x-kde-reply-placeholder-text:AAA' -A inline-reply='Reply' foo
busctl --user \ --match="type='signal', interface='org.freedesktop.Notifications', path='/org/freedesktop/Notifications', member='NotificationReplied'" \ monitor
- Build the app first
- Run the installer script
./install.sh
- This script installs following files into
~/.local
- D-Bus session service file
~/.local/share/dbus-1/services/org.freedesktop.Notifications.service
- systemd user unit service file
~/.local/share/systemd/user/WslNotifyd.service
- WslNotifyd
~/.local/lib/WslNotifyd
- D-Bus session service file
- This script installs following files into
- Sending notification automatically runs WslNotifyd by systemd/D-Bus
notify-send foo
- Maybe you need to restart WSL
- Use
systemctl
command to stop WslNotifydsystemctl --user stop WslNotifyd
- Map sound naming specification
sound-name
toms-winsoundevent
name
- Remove
out
directory- If you used
install.sh
, then remove following files/dirs~/.local/share/dbus-1/services/org.freedesktop.Notifications.service
~/.local/share/systemd/user/WslNotifyd.service
~/.local/lib/WslNotifyd
- If you used
- Delete the registry key
HKCU\Software\Classes\AppUserModelId\WslNotifyd
Remove quotes when you want to use cmd.exereg.exe delete 'HKCU\Software\Classes\AppUserModelId\WslNotifyd'
- Markup is not supported
- Expiration timeout is not respected much
- You cannot use arbitary audio files as notification sounds