### CMakeLists.txt for NtfyToast CLI Qt Example Source: https://github.com/aetherinox/ntfy-toast/blob/main/examples/qt/CMakeLists.txt This CMakeLists.txt file defines the build process for the NtfyToast CLI Qt Example. It specifies the minimum CMake version, project name, C++ standard, and enables Qt's automatic meta-object compilation. It finds required Qt5 modules (Core, Network) and the LibNtfyToast library, then links them to create the main executable. ```cmake cmake_minimum_required(VERSION 3.0.0) project(NtfyToastCliQtExample VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) find_package(Qt5Core REQUIRED) find_package(Qt5Network REQUIRED) # if build as part of ntfytoast project we don't look it up if (NOT TARGET NtfyToast::NtfyToastActions) find_package(LibNtfyToast REQUIRED) endif() add_executable(${PROJECT_NAME} "main.cpp") target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network NtfyToast::NtfyToastActions) ``` -------------------------------- ### Example App ID Retrieval Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md An example of using the PowerShell command to retrieve the AppID for 'Ntfytoast', showing the expected output format. ```powershell get-StartApps | Where-Object {$_.Name -like '*Ntfytoast*'} ``` ```console Name AppID ---- ----- ntfytoast com.ntfytoast.id ``` -------------------------------- ### ntfy-toast CMake Build Configuration Source: https://github.com/aetherinox/ntfy-toast/blob/main/CMakeLists.txt This snippet outlines the main CMake configuration for the ntfy-toast project. It sets the minimum CMake version, project details, GUID, module paths, build options (examples, static runtime), C++ standard, include directories, output directories, and includes other CMake modules and subdirectories. ```cmake cmake_minimum_required(VERSION 3.4) project(ntfytoast VERSION 0.9.0) # Always change the guid when the version is changed NTFYTOAST_CALLBACK_GUID set(NTFYTOAST_CALLBACK_GUID 849c2549-fe1e-4aa6-bb93-4690993ccb89) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) option(BUILD_EXAMPLES "Whether to build the examples" OFF) option(BUILD_STATIC_RUNTIME "Whether link statically to the msvc runtime" ON) include(GenerateExportHeader) include(NtfyMacros) include(cmakerc/CMakeRC) set(CMAKE_CXX_STANDARD 17) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) if (BUILD_STATIC_RUNTIME) #link runtime static if(MSVC) foreach(_bt DEBUG RELEASE RELWITHDEBINFO) string(REPLACE "/MD" "/MT" CMAKE_CXX_FLAGS_${_bt} ${CMAKE_CXX_FLAGS_${_bt}}) endforeach(_bt DEBUG RELEASE RELWITHDEBINFO) endif(MSVC) endif() add_subdirectory(data) add_subdirectory(src) if (BUILD_EXAMPLES) add_subdirectory(examples) endif() ``` -------------------------------- ### Install Targets and Headers Source: https://github.com/aetherinox/ntfy-toast/blob/main/src/CMakeLists.txt Installs the executable, library targets, and generated header files to their designated locations for distribution. It also sets up CMake export configuration for package management. ```cmake install(TARGETS ntfytoast NtfyToastActions EXPORT LibNtfyToastConfig RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) install(FILES ntfytoastactions.h ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/ntfytoast) install(EXPORT LibNtfyToastConfig DESTINATION lib/cmake/libntfytoast NAMESPACE NtfyToast::) ``` -------------------------------- ### Example Custom App Notification Call Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Demonstrates how to send a notification using a custom application ID, ensuring the notification displays the specified app name. ```shell ntfytoast.exe -t "Notification" -m "This is a test message" -appID "com.ntfytoast.id" ``` -------------------------------- ### Define NtfyToastActions Library Source: https://github.com/aetherinox/ntfy-toast/blob/main/src/CMakeLists.txt Defines an interface library for NtfyToastActions, specifying include directories for build and installation. It also creates an alias for easier referencing. ```cmake add_library(NtfyToastActions INTERFACE) target_include_directories(NtfyToastActions INTERFACE $ $ ) add_library(NtfyToast::NtfyToastActions ALIAS NtfyToastActions) ``` -------------------------------- ### App Shortcut Argument Details Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Details the arguments required for the `ntfytoast.exe -install` command, specifying the location for the shortcut, the path to the application executable, and the application's unique ID. ```APIDOC ntfy-toast -install Arguments: Argument: "MyApp\MyApp.lnk" - Description: Where the .lnk shortcut will be placed. Typically in `C:\Users\USER\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\MyApp\MyApp.lnk`. Argument: "C:\path\to\myApp.exe" - Description: Path to the executable you want to show the name for at the top of notifications. Argument: "My.APP_ID" - Description: Your application's unique ID. ``` -------------------------------- ### Build NtfyToast with Visual Studio Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Steps to build the NtfyToast project from source using Visual Studio. This involves opening the project folder and building the application within the IDE. ```markdown 1. Download the source code and place it on your system. 2. Install Visual Studio. 3. Launch Visual Studio. 4. Go to **File** -> **Open** -> **Folder**. 5. Select the folder where you downloaded NtfyToast and open it. 6. Once the project is loaded, build the application in Visual Studio. Your binary will be built and placed inside: - `project-folder/out/build/x64-Debug/bin/ntfytoast.exe` ``` -------------------------------- ### Create App Shortcut for Custom App Name Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Demonstrates the command to create a Windows shortcut (.lnk) for custom application branding in notifications. It requires the shortcut path, the target executable, and the application ID. ```shell ntfytoast.exe -install "MyApp\MyApp.lnk" "C:\path\to\myApp.exe" "My.APP_ID" ``` -------------------------------- ### Create Executable and Link Libraries Source: https://github.com/aetherinox/ntfy-toast/blob/main/src/CMakeLists.txt Creates an icon resource, builds the main executable 'ntfytoast', links it against the static library and other targets, and defines Windows-specific compile flags. An alias is created for the executable. ```cmake create_icon_rc(${PROJECT_SOURCE_DIR}/data/ntfytoast.ico TOAST_ICON) add_executable(ntfytoast WIN32 main.cpp ${TOAST_ICON}) target_link_libraries(ntfytoast PRIVATE NtfyToast::LibNtfyToast ntfyretoastsources) target_compile_definitions(ntfytoast PRIVATE UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX) add_executable(NtfyToast::NtfyToast ALIAS ntfytoast) ``` -------------------------------- ### ntfy-toast CLI Arguments Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Lists and describes the command-line arguments available for the ntfy-toast executable. These arguments control notification content, appearance, and behavior. ```APIDOC ntfy-toast CLI Arguments: -t - 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. See [Possible options](http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx). -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) or '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 <pid>, 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. ``` -------------------------------- ### Send Basic Notification with NtfyToast Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Demonstrates how to send a standard Windows Toast notification using the ntfytoast.exe command-line tool. It requires specifying a title and a message. ```shell ntfytoast.exe -t "Title" -m "Message" ``` -------------------------------- ### Configure and Build Static Library Source: https://github.com/aetherinox/ntfy-toast/blob/main/src/CMakeLists.txt Configures a header file, builds the static library 'libntfytoast' with source files, links necessary libraries and definitions, and sets export properties. An alias is created for the library. ```cmake configure_file(config.h.in config.h @ONLY) add_library(libntfytoast STATIC ntfytoasts.cpp toasteventhandler.cpp linkhelper.cpp utils.cpp) target_link_libraries(libntfytoast PUBLIC runtimeobject shlwapi NtfyToast::NtfyToastActions) target_compile_definitions(libntfytoast PRIVATE UNICODE _UNICODE __WRL_CLASSIC_COM_STRICT__ WIN32_LEAN_AND_MEAN NOMINMAX) target_compile_definitions(libntfytoast PUBLIC __WRL_CLASSIC_COM_STRICT__) target_include_directories(libntfytoast PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) set_target_properties(libntfytoast PROPERTIES EXPORT_NAME LibNtfyToast) add_library(NtfyToast::LibNtfyToast ALIAS libntfytoast) generate_export_header(libntfytoast) ``` -------------------------------- ### NtfyToast Command-Line Options Source: https://github.com/aetherinox/ntfy-toast/blob/main/data/help.txt Provides a comprehensive list of command-line arguments for the ntfy-toast tool. These options control the content, appearance, and behavior of toast notifications, including text, buttons, images, sounds, and persistence. ```APIDOC NtfyToast [Options] Options: [-t] <title string> | Displayed on the first line of the toast. [-m] <message string> | Displayed on the remaining lines, wrapped. [-b] <button1;button2 string> | Displayed on the bottom line, can list multiple buttons separated by ";" [-tb] | Displayed a textbox on the bottom line, only if buttons are not presented. [-p] <image URI> | Display toast with an image, local files only. [-id] <id> | Sets the id for a notification to be able to close it later. [-s] <sound URI> | Sets the sound of the notifications. See http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx for possible values. [-silent] | Don't play a sound file when showing the notifications. [-persistent] | Notifications don't time out | true or false [-d] (short | long) | Set the duration. Default is "short" (7s), "long" is 25s. [-appID] <App.ID> | Don't create a shortcut but use the provided app id. [-pid] <pid> | Query the appid for the process <pid>, use -appID as fallback. (Only relevant for applications that might be packaged for the store) [-pipeName] <\.\pipe\pipeName\> | Provide a name pipe which is used for callbacks. [-application] <C:\\foo.exe> | Provide a application that might be started if the pipe does not exist. -close <id> | Closes a currently displayed notification. -install <name> <application> <appID> | Creates a shortcut <name> in the start menu which point to the executable <application>, appID used for the notifications. -v | Print the version and copying information. -h | Print these instructions. Same as no args. ``` -------------------------------- ### Include Qt Subdirectory (CMake) Source: https://github.com/aetherinox/ntfy-toast/blob/main/examples/CMakeLists.txt This CMake command adds a subdirectory to the build. It processes the CMakeLists.txt file within the specified directory, typically used for including modules or external dependencies like Qt. ```cmake add_subdirectory(qt) ``` -------------------------------- ### Add Resource Library Source: https://github.com/aetherinox/ntfy-toast/blob/main/data/CMakeLists.txt This snippet demonstrates how to add a resource library using the cmrc_add_resource_library function. It specifies the resource name, the file path, and the namespace for the resources. ```custom cmrc_add_resource_library(ntfyretoastsources 256-256-ntfytoast.png help.txt NAMESPACE NtfyToastResource) ``` -------------------------------- ### Send Short Duration Notification with NtfyToast Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Demonstrates how to set a notification to display for a shorter duration, such as 7 seconds, by using the '-d short' argument. The exact duration for 'short' is configurable. ```shell ntfytoast.exe -t "Title" -m "Message" -d short ``` -------------------------------- ### NtfyToast Image Requirements Source: https://github.com/aetherinox/ntfy-toast/blob/main/data/help.txt Specifies the constraints for image files used with the ntfy-toast tool. These limitations are imposed by the underlying Windows Toast notification system to ensure compatibility and performance. ```APIDOC Image Notes: Images must be .png with: maximum dimensions of 1024x1024 size <= 200kb These limitations are due to the Toast notification system. ``` -------------------------------- ### Send Persistent Notification with NtfyToast Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Shows how to create a notification that remains visible on the screen until the user manually dismisses it. This is achieved by adding the '-persistent' flag. ```shell ntfytoast.exe -t "Title" -m "Message" -persistent ``` -------------------------------- ### Retrieve App ID using PowerShell Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Provides a PowerShell command to find the AppID for a given application, which is necessary for custom notification branding. It filters applications by name. ```powershell get-StartApps | Where-Object {$_.Name -like '*YourAppName*'} ``` -------------------------------- ### NtfyToast Exit Status Codes Source: https://github.com/aetherinox/ntfy-toast/blob/main/data/help.txt Defines the meaning of the exit codes returned by the ntfy-toast command. These codes indicate the outcome of the notification interaction, such as success, dismissal, or user interaction. ```APIDOC Exit Status: Success : 0 Hidden : 1 Dismissed : 2 TimedOut : 3 ButtonPressed : 4 TextEntered : 5 Failed : -1 ``` -------------------------------- ### Send Long Duration Notification with NtfyToast Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Illustrates how to set a notification to display for an extended period, such as 25 seconds, by using the '-d long' argument. The exact duration for 'long' is configurable. ```shell ntfytoast.exe -t "Title" -m "Message" -d long ``` -------------------------------- ### Default App ID Behavior Source: https://github.com/aetherinox/ntfy-toast/blob/main/README.md Explains that if the `-appID` argument is not specified when sending a notification, 'NtfyToast' will be used as the default application identifier. ```APIDOC Default AppID: - If `-appID <your.app.id>` is not specified, NtfyToast will be used as the default application ID for notifications. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.