From b6b02b6d3df54f64a0389af0d8338214d8d6b2bf Mon Sep 17 00:00:00 2001 From: Keeyou Date: Tue, 23 Jul 2024 13:11:14 +0800 Subject: [PATCH] qt: fix broken autostart feature --- src/gtk/yass.cpp | 2 +- src/gtk4/yass.cpp | 2 +- src/qt6/yass.cpp | 6 ++++++ src/win32/yass.cpp | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/gtk/yass.cpp b/src/gtk/yass.cpp index fe13f1092..c8a2396cc 100644 --- a/src/gtk/yass.cpp +++ b/src/gtk/yass.cpp @@ -29,7 +29,7 @@ namespace config { const ProgramType pType = YASS_CLIENT_GUI; } // namespace config -ABSL_FLAG(bool, background, false, "start up backgroundd"); +ABSL_FLAG(bool, background, false, "start up background"); YASSApp* mApp = nullptr; diff --git a/src/gtk4/yass.cpp b/src/gtk4/yass.cpp index faf8d2db1..bee88fa28 100644 --- a/src/gtk4/yass.cpp +++ b/src/gtk4/yass.cpp @@ -31,7 +31,7 @@ namespace config { const ProgramType pType = YASS_CLIENT_GUI; } // namespace config -ABSL_FLAG(bool, background, false, "start up backgroundd"); +ABSL_FLAG(bool, background, false, "start up background"); YASSApp* mApp = nullptr; diff --git a/src/qt6/yass.cpp b/src/qt6/yass.cpp index 0fd444bb4..c2aedef0f 100644 --- a/src/qt6/yass.cpp +++ b/src/qt6/yass.cpp @@ -30,6 +30,8 @@ namespace config { const ProgramType pType = YASS_CLIENT_GUI; } // namespace config +ABSL_FLAG(bool, background, false, "start up background"); + #ifdef _WIN32 void YASSApp::commitData(QSessionManager& manager) { if (auto main = App()->main_window_.get()) { @@ -184,6 +186,10 @@ bool YASSApp::Init() { main_window_->show(); main_window_->moveToCenter(); + if (absl::GetFlag(FLAGS_background)) { + main_window_->hide(); + } + tray_icon_ = new TrayIcon(this); tray_icon_->show(); diff --git a/src/win32/yass.cpp b/src/win32/yass.cpp index 732dd26b4..756df4349 100644 --- a/src/win32/yass.cpp +++ b/src/win32/yass.cpp @@ -29,7 +29,7 @@ namespace config { const ProgramType pType = YASS_CLIENT_GUI; } // namespace config -ABSL_FLAG(bool, background, false, "start up backgroundd"); +ABSL_FLAG(bool, background, false, "start up background"); #define MULDIVDPI(x) MulDiv(x, uDpi, 96)