From 8c9ec7ec6af1e26a965bdba547baa6e9c5b03507 Mon Sep 17 00:00:00 2001 From: "eretrus@outlook.com" Date: Mon, 13 Nov 2023 20:57:38 +0200 Subject: [PATCH] Change behavior when tray icon is clicked qBittorrent will be hidden only when it is in focus. --- src/gui/mainwindow.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index ef8458ef88f..4f79c9c24d2 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -399,7 +399,23 @@ MainWindow::MainWindow(IGUIApplication *app, WindowState initialState) if (!isVisible()) activate(); #else - toggleVisibility(); + if (isActiveWindow()) + { + hide(); + } + else + { + if (m_uiLocked && !unlockUI()) // Ask for UI lock password + return; + + // Make sure the window is not minimized + setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); + + // Then show it + show(); + raise(); + activateWindow(); + } #endif });