Jump to content

Projects/Snorenotify/Windows-Toast-Notification

From KDE TechBase

For this backend we ship a our command line application SnoreToast, which is used to display the notification. The reason for using a command line application is, that applications enabled for notifications on Windows must be compiled exclusively for Windows 8 or later and written in a way that is not yet supported by Qt.

Screenshot

Windows 10

Usage

Basic Usage

Without any use of special settings this backend will create and register a special schortcut in the Windows startmenu pointing to your application, located at "%APPDATA%\\Microsoft\\Windows\\Start Menu\\Programs\\SnoreNotify\\" + qApp->applicationName().

Advanced usage

To prevent that you have to set the application hint "windows-app-id" a documentation for the app Id can be found here. Now in order to make the notifications work you need to install the shortcut yourself, during the installation process of the application. If you are using a nsis based installer we recommend to use the script provided on this page, see the section Nsis scirpt, for msis or other installer toolkits you will find additional information at the MSDN page.

Nsis scirpt

This scripts depends on a Nsis 3 or a later release.

!include WinVer.nsh
!define SnoreToastExe "$INSTDIR\SnoreToast.exe"
!macro SnoreShortcut path exe appID
  ${If} ${AtLeastWin8}
    nsExec::ExecToLog '"${SnoreToastExe}" -install "${path}" "${exe}" "${appID}"'
  ${Else}
    CreateShortCut "${path}" "${exe}"
  ${EndIf}
!macroend
%%%%%%%%%%%%%%%%%%%%%%%%%
!define MyApp_AppUserModelId  QuasselProject.QuasselIRC
!insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel.lnk" "$INSTDIR\quassel.exe" "${MyApp_AppUserModelId}"