From 6ae54986b1611f096c955ba00336a801633c77d0 Mon Sep 17 00:00:00 2001 From: Lubos Vozdecky Date: Fri, 20 May 2022 23:28:45 +0100 Subject: [PATCH 1/5] defined FLAMESHOT_ICON variable --- src/CMakeLists.txt | 4 ++++ src/utils/systemnotification.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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..6a3b212932 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -12,6 +12,10 @@ #include "src/core/flameshotdaemon.h" #endif +#ifndef FLAMESHOT_ICON + #define FLAMESHOT_ICON "flameshot" +#endif + SystemNotification::SystemNotification(QObject* parent) : QObject(parent) , m_interface(nullptr) @@ -63,7 +67,7 @@ void SystemNotification::sendMessage(const QString& text, } args << (qAppName()) // appname << static_cast(0) // id - << "flameshot" // icon + << FLAMESHOT_ICON // icon << title // summary << text // body << QStringList() // actions From 50cce046eb6b8581d70d1a6ba6bca9e9f90500c3 Mon Sep 17 00:00:00 2001 From: Lubos Vozdecky Date: Sat, 21 May 2022 01:18:06 +0100 Subject: [PATCH 2/5] print statements --- src/CMakeLists.txt | 1 + src/utils/systemnotification.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2dd49c3278..d61fdae889 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -66,6 +66,7 @@ endif () add_executable(Flameshot::flameshot ALIAS flameshot) if(FLAMESHOT_ICON) + message(STATUS "FLAMESHOT_ICON=${FLAMESHOT_ICON}") target_compile_definitions(flameshot PUBLIC FLAMESHOT_ICON="${FLAMESHOT_ICON}") endif() diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index 6a3b212932..6aa2ca3437 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -12,6 +12,8 @@ #include "src/core/flameshotdaemon.h" #endif +#include + #ifndef FLAMESHOT_ICON #define FLAMESHOT_ICON "flameshot" #endif @@ -65,6 +67,9 @@ void SystemNotification::sendMessage(const QString& text, hintsMap[QStringLiteral("x-kde-urls")] = QStringList({ fullPath.toString() }); } + + std::cout << "icon path: " << FLAMESHOT_ICON << std::endl; + args << (qAppName()) // appname << static_cast(0) // id << FLAMESHOT_ICON // icon From 1b9b831c491d5ceefae3dbeea4359a6dfb21e09b Mon Sep 17 00:00:00 2001 From: Lubos Vozdecky Date: Sat, 21 May 2022 01:54:53 +0100 Subject: [PATCH 3/5] remove print statements --- src/CMakeLists.txt | 1 - src/utils/systemnotification.cpp | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d61fdae889..2dd49c3278 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -66,7 +66,6 @@ endif () add_executable(Flameshot::flameshot ALIAS flameshot) if(FLAMESHOT_ICON) - message(STATUS "FLAMESHOT_ICON=${FLAMESHOT_ICON}") target_compile_definitions(flameshot PUBLIC FLAMESHOT_ICON="${FLAMESHOT_ICON}") endif() diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index 6aa2ca3437..4ae431f8c2 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -12,8 +12,6 @@ #include "src/core/flameshotdaemon.h" #endif -#include - #ifndef FLAMESHOT_ICON #define FLAMESHOT_ICON "flameshot" #endif @@ -67,8 +65,6 @@ void SystemNotification::sendMessage(const QString& text, hintsMap[QStringLiteral("x-kde-urls")] = QStringList({ fullPath.toString() }); } - - std::cout << "icon path: " << FLAMESHOT_ICON << std::endl; args << (qAppName()) // appname << static_cast(0) // id From 4bfee82e226175454fea92cf248d66a229ee2133 Mon Sep 17 00:00:00 2001 From: Lubos Vozdecky Date: Sat, 21 May 2022 02:05:15 +0100 Subject: [PATCH 4/5] adding FLAMESHOT_ICON to snap yaml file --- snapcraft.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 From 4114251b048f43a44af57334c4abd4fc78bb6120 Mon Sep 17 00:00:00 2001 From: Lubos Vozdecky Date: Sat, 21 May 2022 02:53:34 +0100 Subject: [PATCH 5/5] code format; comment --- src/utils/systemnotification.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/systemnotification.cpp b/src/utils/systemnotification.cpp index 4ae431f8c2..f593464a9a 100644 --- a/src/utils/systemnotification.cpp +++ b/src/utils/systemnotification.cpp @@ -12,8 +12,11 @@ #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" +#define FLAMESHOT_ICON "flameshot" #endif SystemNotification::SystemNotification(QObject* parent) @@ -65,7 +68,7 @@ void SystemNotification::sendMessage(const QString& text, hintsMap[QStringLiteral("x-kde-urls")] = QStringList({ fullPath.toString() }); } - + args << (qAppName()) // appname << static_cast(0) // id << FLAMESHOT_ICON // icon