Skip to content

Commit 6fdb6b6

Browse files
Remove libnotify support; use Qt notifications
Drop libnotify integration and related build plumbing, simplify notification handling to use Qt only, and update docs/tests accordingly. Changes include: removed cmake/FindLibNotify.cmake and LibNotify detection/definitions from CMakeLists.txt; removed libnotify-dependent code paths, async threads, and notification bookkeeping from src/tray_qt.cpp and unused includes; simplified notify logic to always use QtTrayMenu; updated README to remove libnotify from platform dependency lists and simplified the icons table; and adjusted a unit test comment to reflect the new Qt-based callback behavior. Overall this removes the external libnotify dependency and cleans up associated code and build configuration.
1 parent 7e0194b commit 6fdb6b6

7 files changed

Lines changed: 55 additions & 309 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ option(BUILD_EXAMPLE "Build example app" ${TRAY_IS_TOP_LEVEL})
3333
set(CMAKE_COLOR_MAKEFILE ON)
3434
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
3535

36-
find_package(PkgConfig)
37-
3836
file(GLOB TRAY_SOURCES
3937
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.h"
4038
)
@@ -88,16 +86,6 @@ list(APPEND TRAY_SOURCES
8886
"${CMAKE_CURRENT_SOURCE_DIR}/src/QtTrayMenu.cpp"
8987
)
9088

91-
if(UNIX AND NOT APPLE)
92-
find_package(LibNotify)
93-
if(LIBNOTIFY_FOUND)
94-
list(APPEND TRAY_COMPILE_DEFINITIONS TRAY_USE_LIBNOTIFY=1)
95-
list(APPEND TRAY_EXTERNAL_LIBRARIES ${LIBNOTIFY_LIBRARIES})
96-
list(APPEND TRAY_EXTERNAL_DIRECTORIES ${LIBNOTIFY_LIBRARY_DIRS})
97-
list(APPEND TRAY_EXTERNAL_INCLUDES ${LIBNOTIFY_INCLUDE_DIRS})
98-
endif()
99-
endif()
100-
10189
add_library(${PROJECT_NAME} STATIC ${TRAY_SOURCES})
10290
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99)
10391
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
@@ -116,24 +104,10 @@ else()
116104
list(APPEND TRAY_EXTERNAL_LIBRARIES Qt5::Widgets Qt5::Svg)
117105
endif()
118106

119-
if(TRAY_EXTERNAL_INCLUDES)
120-
target_include_directories(${PROJECT_NAME}
121-
SYSTEM PRIVATE
122-
${TRAY_EXTERNAL_INCLUDES})
123-
endif()
124-
125107
if(TRAY_COMPILE_DEFINITIONS)
126108
target_compile_definitions(${PROJECT_NAME} PRIVATE ${TRAY_COMPILE_DEFINITIONS})
127109
endif()
128110

129-
if(TRAY_EXTERNAL_DIRECTORIES)
130-
foreach(tray_external_directory IN LISTS TRAY_EXTERNAL_DIRECTORIES)
131-
if(tray_external_directory)
132-
target_link_directories(${PROJECT_NAME} PRIVATE "${tray_external_directory}")
133-
endif()
134-
endforeach()
135-
endif()
136-
137111
add_library(tray::tray ALIAS ${PROJECT_NAME})
138112

139113
if(TRAY_IS_TOP_LEVEL AND BUILD_EXAMPLE)

README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,35 +46,35 @@ This fork adds the following features:
4646

4747
### Platform Dependencies
4848

49-
Install either Qt6 _or_ Qt5. Linux builds can also use libnotify when the development package is available.
49+
Install either Qt6 _or_ Qt5.
5050

5151
<div class="tabbed">
5252

5353
- <b class="tab-title">Arch</b>
5454
```bash
5555
# Qt6
56-
sudo pacman -S qt6-base qt6-svg libnotify
56+
sudo pacman -S qt6-base qt6-svg
5757

5858
# Qt5
59-
sudo pacman -S qt5-base qt5-svg libnotify
59+
sudo pacman -S qt5-base qt5-svg
6060
```
6161

6262
- <b class="tab-title">Debian/Ubuntu</b>
6363
```bash
6464
# Qt6
65-
sudo apt install qt6-base-dev qt6-svg-dev libnotify-dev
65+
sudo apt install qt6-base-dev qt6-svg-dev
6666
6767
# Qt5
68-
sudo apt install qtbase5-dev libqt5svg5-dev libnotify-dev
68+
sudo apt install qtbase5-dev libqt5svg5-dev
6969
```
7070

7171
- <b class="tab-title">Fedora</b>
7272
```bash
7373
# Qt6
74-
sudo dnf install qt6-qtbase-devel qt6-qtsvg-devel libnotify-devel
74+
sudo dnf install qt6-qtbase-devel qt6-qtsvg-devel
7575
7676
# Qt5
77-
sudo dnf install qt5-qtbase-devel qt5-qtsvg-devel libnotify-devel
77+
sudo dnf install qt5-qtbase-devel qt5-qtsvg-devel
7878
```
7979

8080
- <b class="tab-title">macOS</b>
@@ -133,14 +133,13 @@ The `icon` and `notification_icon` fields can be a path to an image file or an i
133133
are resolved from the process working directory, so applications should copy or install icon files where the running
134134
process can find them.
135135

136-
| Component | Backend | Supported inputs | Notes |
137-
|----------------------------------------------------------------------------------------|-------------------------------------------------------|------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
138-
| Tray icon (`icon`) | Qt `QSystemTrayIcon` / `QIcon` on all platforms | SVG, ICO, PNG, Qt theme icon names | Loaded through Qt's `QIcon` path; SVG, ICO, and PNG are tested. Theme icon names are resolved by Qt when the platform/theme supports them. |
139-
| Notification icon (`notification_icon`) on Windows, macOS, and Linux without libnotify | Qt `QSystemTrayIcon::showMessage` / `QIcon` | SVG, ICO, PNG, Qt theme icon names | Loaded through Qt's `QIcon` path; SVG, ICO, and PNG are tested. Theme icon names are resolved by Qt when the platform/theme supports them. |
140-
| Notification icon (`notification_icon`) on Linux with libnotify | libnotify / freedesktop notification server | SVG, PNG, or icon theme name | libnotify accepts an icon theme name or filename, but the notification server and installed image loaders decide which file formats render. Do not rely on ICO for libnotify notifications. |
136+
| Component | Backend | Supported inputs | Notes |
137+
|-----------------------------------------|--------------------------------------------------------------|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
138+
| Tray icon (`icon`) | Qt `QSystemTrayIcon` / `QIcon` on all platforms | SVG, ICO, PNG, Qt theme icon names | Loaded through Qt's `QIcon` path; SVG, ICO, and PNG are tested. Theme icon names are resolved by Qt when the platform/theme supports them. |
139+
| Notification icon (`notification_icon`) | Qt `QSystemTrayIcon::showMessage` / `QIcon` on all platforms | SVG, ICO, PNG, Qt theme icon names | Loaded through Qt's `QIcon` path; SVG, ICO, and PNG are tested. Theme icon names are resolved by Qt when the platform/theme supports them. |
141140

142141
For the most predictable cross-platform behavior, use SVG or PNG files for both tray and notification icons. ICO is
143-
supported by the Qt-backed paths tested by this project, but it is not portable for libnotify notifications.
142+
supported by the Qt-backed paths tested by this project.
144143
Qt theme icons should be passed as icon name strings, such as `mail-message-new`.
145144

146145
## API

cmake/FindLibNotify.cmake

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)