@@ -141,7 +141,12 @@ void FlameshotDaemon::createPin(const QPixmap& capture, QRect geometry)
141141
142142void FlameshotDaemon::copyToClipboard (const QPixmap& capture)
143143{
144+ #if defined(Q_OS_MACOS) && defined(USE_KDSINGLEAPPLICATION)
145+ auto kdsa = KDSingleApplication (QStringLiteral (" org.flameshot.Flameshot" ));
146+ if (kdsa.isPrimaryInstance () && instance ()) {
147+ #else
144148 if (instance ()) {
149+ #endif
145150 instance ()->attachScreenshotToClipboard (capture);
146151 return ;
147152 }
@@ -151,7 +156,9 @@ void FlameshotDaemon::copyToClipboard(const QPixmap& capture)
151156
152157#if defined(USE_KDSINGLEAPPLICATION) && \
153158 (defined (Q_OS_MACOS) || defined (Q_OS_WIN))
159+ #if defined(Q_OS_WIN)
154160 auto kdsa = KDSingleApplication (QStringLiteral (" org.flameshot.Flameshot" ));
161+ #endif
155162 stream << QStringLiteral (" attachScreenshotToClipboard" ) << capture;
156163 kdsa.sendMessage (data);
157164#else
@@ -167,14 +174,21 @@ void FlameshotDaemon::copyToClipboard(const QPixmap& capture)
167174void FlameshotDaemon::copyToClipboard (const QString& text,
168175 const QString& notification)
169176{
177+ #if defined(Q_OS_MACOS) && defined(USE_KDSINGLEAPPLICATION)
178+ auto kdsa = KDSingleApplication (QStringLiteral (" org.flameshot.Flameshot" ));
179+ if (kdsa.isPrimaryInstance () && instance ()) {
180+ #else
170181 if (instance ()) {
182+ #endif
171183 instance ()->attachTextToClipboard (text, notification);
172184 return ;
173185 }
174186
175187#if defined(USE_KDSINGLEAPPLICATION) && \
176188 (defined (Q_OS_MACOS) || defined (Q_OS_WIN))
189+ #if defined(Q_OS_WIN)
177190 auto kdsa = KDSingleApplication (QStringLiteral (" org.flameshot.Flameshot" ));
191+ #endif
178192 QByteArray data;
179193 QDataStream stream (&data, QIODevice::WriteOnly);
180194 stream << QStringLiteral (" attachTextToClipboard" ) << text << notification;
0 commit comments