From fc02a4431b42881678c66702b2d81ac04be26964 Mon Sep 17 00:00:00 2001 From: dynobo Date: Sun, 14 Jan 2024 23:28:00 +0100 Subject: [PATCH] fix(gui): second instance triggers second capture window #580 --- CHANGELOG | 6 +++++- normcap/gui/tray.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 17e0f7d6..9557059a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,9 +2,13 @@ # Changelog -## v0.5.4 (upcoming) +## v0.5.4 (2024-01-15) +- All: Fix duplicate capture window if started twice + ([#580](https://github.com/dynobo/normcap/issues/580)) - Linux: Improve robustness of window positioning on Wayland. +- Linux: Improve debug output regarding clipboard methods. + ([#581](https://github.com/dynobo/normcap/issues/581)) ## v0.5.3 (2024-01-04) diff --git a/normcap/gui/tray.py b/normcap/gui/tray.py index dcf456ea..b17083d8 100644 --- a/normcap/gui/tray.py +++ b/normcap/gui/tray.py @@ -176,9 +176,14 @@ def _on_ready_read(self) -> None: """Process messages received from other NormCap instances.""" if not self._socket_in: return + message = self._socket_in.readAll() + # TODO: Test if `is message` check is necessary if message and message.data().decode("utf-8", errors="ignore") == "capture": logger.info("Received socket signal to capture.") + if self.windows: + logger.debug("Capture window(s) already open. Doing nothing.") + return self._show_windows(delay_screenshot=True) @QtCore.Slot(QtWidgets.QSystemTrayIcon.ActivationReason)