Skip to content

WslNotifyd is an implementation of the Desktop Notifications Specification using Windows native functionality.

License

Notifications You must be signed in to change notification settings

ultrabig/WslNotifyd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WslNotifyd

WslNotifyd is an implementation of the Desktop Notifications Specification using Windows native functionality.

Requirements

Usage

  1. Install .NET sdk on WSL2
    • .NET 8 is confirmed to work
  2. Clone the repo
    git clone https://github.com/ultrabig/WslNotifyd.git
  3. Build the app
    cd WslNotifyd
    dotnet publish WslNotifyd -o out && dotnet publish WslNotifydWin --runtime win-x64 -o out/WslNotifydWin --self-contained
  4. Run the app
    ./out/WslNotifyd
  5. Send notifications from any app!
    notify-send 'Hello' 'World!'
    hello-world

Supported features

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
    notify-send -h 'string:sound-name:ms-winsoundevent:Notification.Reminder' foo
  • 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)
    notify-send -h 'string:x-kde-reply-placeholder-text:AAA' -A inline-reply='Reply' foo
    Use the following script to monitor replies.
    busctl --user \
        --match="type='signal',
            interface='org.freedesktop.Notifications',
            path='/org/freedesktop/Notifications',
            member='NotificationReplied'" \
        monitor

Integration with systemd/D-Bus

  1. Build the app first
  2. 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
  3. Sending notification automatically runs WslNotifyd by systemd/D-Bus
    notify-send foo
    • Maybe you need to restart WSL
  4. Use systemctl command to stop WslNotifyd
    systemctl --user stop WslNotifyd

Todo

Uninstall

  1. 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
  2. Delete the registry key HKCU\Software\Classes\AppUserModelId\WslNotifyd
    reg.exe delete 'HKCU\Software\Classes\AppUserModelId\WslNotifyd'
    Remove quotes when you want to use cmd.exe

Limitations

  • Markup is not supported
  • Expiration timeout is not respected much
  • You cannot use arbitary audio files as notification sounds

About

WslNotifyd is an implementation of the Desktop Notifications Specification using Windows native functionality.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published