Projects/Snorenotify/Windows-Toast-Notification: Difference between revisions

From KDE TechBase
(Created page with "For this backend we ship a our command line application [SnoreToast](https://github.com/Snorenotify/Snoretoast), which is used to display the notification. The reason for usin...")
 
(Fix import from github.)
Line 1: Line 1:
For this backend we ship a our command line application [SnoreToast](https://github.com/Snorenotify/Snoretoast), which is used to display the notification.
For this backend we ship a our command line application [https://github.com/Snorenotify/Snoretoast 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.
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
= Screenshot =
## Windows 10
== Windows 10 ==
[![Windows 10](http://patrick.von-reth.de/other/snore/wiki/screenshots/windows-toast-win10.png)](http://patrick.von-reth.de/other/snore/wiki/screenshots/windows-toast-win10.png)
[[File:Windows-toast-win10.png |800px|thumb|left]]


# Usage
= Usage =
## Basic 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().
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
== Advanced usage ==
To prevent that you have to set the application [hint](http://patrick.von-reth.de/other/snore/latest/doc/html/class_snore_1_1_application.html#a3f107ea8422f63eab71a56195ed3921c) "windows_app_id" a documentation for the app Id can be found [here](http://msdn.microsoft.com/en-us/library/windows/apps/dd378459.aspx).
To prevent that you have to set the application [http://api.kde.org/playground-api/libs-apidocs/snorenotify/html/classSnore_1_1Application.html#ad49cb713f0689b7cafbbec6677624bfa hint] "windows-app-id" a documentation for the app Id can be found [http://msdn.microsoft.com/en-us/library/windows/apps/dd378459.aspx here].
Now in order to make the notifications work you need to install the shortcut yourself, during the installation process of the application.
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](https://msdn.microsoft.com/en-us/library/windows/apps/dd378459.aspx#where).
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 [https://msdn.microsoft.com/en-us/library/windows/apps/dd378459.aspx#where MSDN page].
 
# Nsis scirpt
This scripts depends on a Nsis 3 or later release.


= Nsis scirpt =
This scripts depends on a Nsis 3 or a later release.
<syntaxhighlight lang="nsis">
!include WinVer.nsh
!include WinVer.nsh
!define SnoreToastExe "$INSTDIR\SnoreToast.exe"
!define SnoreToastExe "$INSTDIR\SnoreToast.exe"
!macro SnoreShortcut path exe appID
!macro SnoreShortcut path exe appID
${If} ${AtLeastWin8}
  ${If} ${AtLeastWin8}
nsExec::ExecToLog '"${SnoreToastExe}" -install "${path}" "${exe}" "${appID}"'
    nsExec::ExecToLog '"${SnoreToastExe}" -install "${path}" "${exe}" "${appID}"'
${Else}
  ${Else}
CreateShortCut "${path}" "${exe}"
    CreateShortCut "${path}" "${exe}"
${EndIf}
  ${EndIf}
!macroend
!macroend
%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%
Line 31: Line 31:
!define MyApp_AppUserModelId  QuasselProject.QuasselIRC
!define MyApp_AppUserModelId  QuasselProject.QuasselIRC
!insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel.lnk" "$INSTDIR\quassel.exe" "${MyApp_AppUserModelId}"
!insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel.lnk" "$INSTDIR\quassel.exe" "${MyApp_AppUserModelId}"
</syntaxhighlight>

Revision as of 14:14, 24 August 2015

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}"