Skip to content

Instantly share code, notes, and snippets.

@dbalabka
Last active March 12, 2024 09:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbalabka/20907893ba33f9ceebff3aaa8182f9c8 to your computer and use it in GitHub Desktop.
Save dbalabka/20907893ba33f9ceebff3aaa8182f9c8 to your computer and use it in GitHub Desktop.
Send notification from Windows WSL console similar to original Linux notify-send command πŸŽΆπŸ””
  1. Create a file in C:\bin\toast.ps1 from source https://gist.github.com/dend/5ae8a70678e3a35d02ecd39c12f99110:
    curl https://gist.githubusercontent.com/dend/5ae8a70678e3a35d02ecd39c12f99110/raw -o /mnt/c/bin/toast.ps1
  2. Create ~/.local/bin/notify-send from the following source:
    powershell.exe "& { . C:\\bin\\toast.ps1; Show-Notification -ToastTitle \"$1\" -ToastText \"$2\" }"
    like this:
    echo 'powershell.exe "& { . C:\\bin\\toast.ps1; Show-Notification -ToastTitle \"$1\" -ToastText \"$2\" }"' > ~/.local/bin/notify-send
  3. Add executable permission on script:
    chmod +x ~/.local/bin/notify-send

Usage example:

notify-send "Hello world!!!"
notify-send "Hello" "world!!!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment