diff --git a/snapcraft.yaml b/snapcraft.yaml index 03ad90df49..75e2b9e995 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -46,9 +46,10 @@ parts: - kde-frameworks-5-qt-5-15-core20 source: https://github.com/flameshot-org/flameshot.git plugin: cmake - # This cannot be enabled until the KF5 toolkit in the snap is updated - #cmake-parameters: - # - -DUSE_WAYLAND_CLIPBOARD=1 + cmake-parameters: + - -DFLAMESHOT_ICON=/snap/flameshot/current/usr/local/share/icons/hicolor/scalable/apps/flameshot.svg + # This cannot be enabled until the KF5 toolkit in the snap is updated + #- -DUSE_WAYLAND_CLIPBOARD=1 source-type: git override-pull: | snapcraftctl pull diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 06bcd39672..2dd49c3278 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,6 +65,10 @@ endif () add_executable(Flameshot::flameshot ALIAS flameshot) +if(FLAMESHOT_ICON) + target_compile_definitions(flameshot PUBLIC FLAMESHOT_ICON="${FLAMESHOT_ICON}") +endif() + if (WIN32) set_property(TARGET flameshot PROPERTY WIN32_EXECUTABLE true) if (MSVC) diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index 16c19efab4..f593464a9a 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -12,6 +12,13 @@ #include "src/core/flameshotdaemon.h" #endif +// work-around for snap, which cannot install icons into +// the system folder, so instead the absolute path to the +// icon (saved somwhere in /snap/flameshot/...) is passed +#ifndef FLAMESHOT_ICON +#define FLAMESHOT_ICON "flameshot" +#endif + SystemNotification::SystemNotification(QObject* parent) : QObject(parent) , m_interface(nullptr) @@ -61,9 +68,10 @@ void SystemNotification::sendMessage(const QString& text, hintsMap[QStringLiteral("x-kde-urls")] = QStringList({ fullPath.toString() }); } + args << (qAppName()) // appname << static_cast(0) // id - << "flameshot" // icon + << FLAMESHOT_ICON // icon << title // summary << text // body << QStringList() // actions