Projects/Snorenotify/Windows-Toast-Notification: Difference between revisions
TheOneRing (talk | contribs) 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..." |
TheOneRing (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
For this backend we ship a our command line application [ | 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 = | |||
== Windows 10 == | |||
[ | [[File:Windows-toast-win10.png |800px|thumb|left]] | ||
= 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 == | |||
To prevent that you have to set the application [ | 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 [ | 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 = | |||
Create a file called "SnoreNotify.nsh" with the following content. | |||
<syntaxhighlight lang="nsis"> | |||
!include LogicLib.nsh | |||
!include WordFunc.nsh | |||
Function SnoreWinVer | |||
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion | |||
${VersionCompare} "6.2" $R0 $R0 | |||
${If} $R0 == 1 | |||
Push "NotWin8" | |||
${Else} | |||
Push "AtLeastWin8" | |||
${EndIf} | |||
FunctionEnd | |||
!macro SnoreShortcut path exe appID | |||
Call SnoreWinVer | |||
Pop $0 | |||
${If} $0 == "AtLeastWin8" | |||
nsExec::ExecToLog '"${SnoreToastExe}" -install "${path}" "${exe}" "${appID}"' | |||
${Else} | |||
CreateShortCut "${path}" "${exe}" | |||
${EndIf} | |||
!macroend | |||
</syntaxhighlight> | |||
Use it as in the following example. | |||
<syntaxhighlight lang="nsis"> | |||
!include SnoreNotify.nsh | |||
!define SnoreToastExe "$INSTDIR\SnoreToast.exe" | |||
!insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel.lnk" "$INSTDIR\quassel.exe" "QasselProject.QuasselIRC" | |||
</syntaxhighlight> |
Latest revision as of 11:02, 3 September 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
Create a file called "SnoreNotify.nsh" with the following content.
!include LogicLib.nsh
!include WordFunc.nsh
Function SnoreWinVer
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
${VersionCompare} "6.2" $R0 $R0
${If} $R0 == 1
Push "NotWin8"
${Else}
Push "AtLeastWin8"
${EndIf}
FunctionEnd
!macro SnoreShortcut path exe appID
Call SnoreWinVer
Pop $0
${If} $0 == "AtLeastWin8"
nsExec::ExecToLog '"${SnoreToastExe}" -install "${path}" "${exe}" "${appID}"'
${Else}
CreateShortCut "${path}" "${exe}"
${EndIf}
!macroend
Use it as in the following example.
!include SnoreNotify.nsh
!define SnoreToastExe "$INSTDIR\SnoreToast.exe"
!insertmacro SnoreShortcut "$SMPROGRAMS\$StartMenuFolder\Quassel.lnk" "$INSTDIR\quassel.exe" "QasselProject.QuasselIRC"