Skip to content

Notification system forked from SnoreToast which is utilized in applications such as KeeWeb and ntfy-desktop.

License

MIT, LGPL-3.0 licenses found

Licenses found

MIT
LICENSE.txt
LGPL-3.0
COPYING.LGPL-3
Notifications You must be signed in to change notification settings

Aetherinox/ntfy-toast

Repository files navigation

♾️ NtfyToast ♾️


NtfyToast is a forked verison of SnoreToast which has been modified to fit a certain list of criteria, including notifications that do not time out.


This library is packaged with ntfy-desktop




Version Build Status Downloads Size Last Commit







About

NtfyToast is a command line application capable of creating Windows Toast notifications on Windows 8 or later. This app is part of a family of applications called Ntfy or Notify.


What is ntfy?

ntfy.sh (pronounced "notify") is a simple HTTP-based pub-sub notification service. With ntfy, you can send notifications to your phone or desktop via scripts from any computer, without having to sign up or pay any fees. If you'd like to run your own instance of the service, you can easily do so since ntfy is open source.


View


What is ntfy-desktop

NtfyDesktop allows you to access the official free / paid notification service ntfy.sh, or your own self-hosted version of ntfy from within a desktop application which utilizes Electron as the wrapper.

This version of ntfy-desktop is based on the package ntfy-electron created by xdpirate, however, this version brings some changes in functionality, as well as some additional edits that I personally needed.

View


What is ntfy-toast

NtfyToast (the app in this repo) is a notification system for Windows 10/11 which is used within ntfy-desktop to display notifications for users.

It is based on SnoreToast, but has been updated with numerous features.




Features

  • Single binary file which works with x32 and x64 bit operating systems
  • New -persistent option which allows a notification to stay on a user's screen indefinitely until the user closes it.
  • Many small bug fixes



Usage

When using the command-line to show notifications, you can push a notification by opening Command Prompt and running:

cd X:\path\to\ntfytoast

Then push a notification with:

ntfytoast.exe -t "Title" -m "Message"

To make a notification stay on screen until the user dismisses it, add -persistent.

ntfytoast.exe -t "Title" -m "Message" -persistent

To make a notifiation stay on-screen for 25 seconds, use -d long

ntfytoast.exe -t "Title" -m "Message" -d long

To make a notifiation stay on-screen for 7 seconds, use -d short

ntfytoast.exe -t "Title" -m "Message" -d short

Other available options are listed below within the section CLI Arguments.




CLI Arguments

Argument Type Description
-t <title string> Title / first line of text in notification
-m <message string> Message displayed in notification
-b <btn1;btn2 string> Buttons
List multiple buttons separated by ;
-tb Textbox on the bottom line, only if buttons are not specified
-p <image URI> Picture / image, local files only
-id <id> sets id for a notification to be able to close it later
-s <sound URI> Sound when notification opened

Possible options
-silent Disable playing sound when notification appears
-persistent Force notification to stay on screen
-d short, long How long a notification stays on screen.

Only works if -persistent not specified.

Can only pick two options:
- short (7 seconds)
- long (25 seconds)
-appID <App.ID> Don't create a shortcut but use the provided app id
-pid <pid> Query the appid for the process , use -appID as fallback. (Only relevant for applications that might be packaged for the store
-pipeName <\.\pipe\pipeName\> Name pipe which is used for callbacks
-application <C:\foo\bar.exe> App to start if the pipe does not exist
-close <id> Close an existing notification



Customizing App Name

Windows Toast notifications will show the name of the application calling the notification at the top of each popup. Out-of-box, the application name will be NtfyToast.

If you wish to brand notifications with your own application name, then there are a few steps you must complete.


Create App Shortcut

You must create a windows shortcut (.lnk) within your windows Start Menu. This is a requirement by Microsoft.

NtfyToast includes a command which will help you create the shortcut link automatically. To do this, open Command Prompt and run the command:

ntfytoast.exe -install "MyApp\MyApp.lnk" "C:\path\to\myApp.exe" "My.APP_ID"

Argument Description
"MyApp\MyApp.lnk" Where the lnk shortcut will be placed.

C:\Users\USER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MyApp\MyApp.lnk
"C:\path\to\myApp.exe" Path to the executable you want to show the name for at the top of notifications
"My.APP_ID" Your .exe app id

To get the appID for the application you want to use, you can open Powershell and run the command:

get-StartApps | Where-Object {$_.Name -like '*YourAppName*'}

In our example, we can run

get-StartApps | Where-Object {$_.Name -like '*Ntfytoast*'}

Which returns the following:

Name      AppID
----      -----
ntfytoast com.ntfytoast.id

This means that if I wanted to use NtfyToast as the app which sends notifications, my final command would be:

ntfytoast.exe -install "Ntfytoast\Ntfytoast.lnk" "C:\path\to\ntfytoast.exe" "com.ntfytoast.id"

When the .lnk is created, it will be placed in:

C:\Users\USER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs


Call App

Now that you have your app shortcut created, you can simply call the app every time you want to send a notification using -appID. Remember to use your own app's id.

ntfytoast.exe -t "Notification" -m "This is a test message" -appID "com.ntfytoast.id"

If you do not specify -appID <your.app.id>, then NtfyToast will be used as the default.




Build

These instructions are only for people who wish to make changes to the NtfyToast source code / commit changes to the repo via pull requests. If you have no interest in editing the source code, then you can skip this section.


The easiest way to build this package is to download the source and place it somewhere on your system. Then install Visual Studio and launch the application.

Go to File -> Open -> Folder.



Select the folder where you downloaded NtfyToast and open it. After a few moments, a few new folders will be created in your project directory:

  • 📁 .vs
  • 📁 out

You can now start writing your code. Once you are finished, you need to build the application in Visual Studio.



Your binary will be built and placed inside:

  • project-folder/out/build/x64-Debug/bin/ntfytoast.exe






About

Notification system forked from SnoreToast which is utilized in applications such as KeeWeb and ntfy-desktop.

Topics

Resources

License

MIT, LGPL-3.0 licenses found

Licenses found

MIT
LICENSE.txt
LGPL-3.0
COPYING.LGPL-3

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published