Skip to content

Hide Window on Start-Up #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dabfalcon opened this issue Jan 10, 2016 · 4 comments
Closed

Hide Window on Start-Up #215

dabfalcon opened this issue Jan 10, 2016 · 4 comments

Comments

@dabfalcon
Copy link

Keep up the good work on ckb! My problem is that the ckb window appears every startup, which I then have to exit. I am running Manjaro KDE. I thought I was smart and make a startup script launching 'ckb --background' to only start the background process. This worked for the first reboot but not subsequent ones.

How can I autostart ckb but not have it seen?

@ccMSC
Copy link
Owner

ccMSC commented Jan 11, 2016

There's currently a bug where the session restore causes the window to pop up. You can fix it by going to System Settings > Startup and Shutdown > Desktop Session and adding ckb to "Applications to be excluded"

@dabfalcon
Copy link
Author

Thanks ccMSC. Legend.

@ccMSC ccMSC closed this as completed Jan 15, 2016
@diijkstra
Copy link

Regarding session restore bug, it is because QGuiApplication is modifying arguments provided to the Application - when creating QGuiApplication instance -session param is removed. I think the proper way to check if App is being run during session restore is to use QGuiApplication::isSessionRestored().

See following patch, works for me on Linux + KDE - ckb restored by KDE with -session xyz param is hidden on start.

diff --git a/src/ckb/main.cpp b/src/ckb/main.cpp
index 98cb2c1..37cb257 100644
--- a/src/ckb/main.cpp
+++ b/src/ckb/main.cpp
@@ -112,7 +112,7 @@ int main(int argc, char *argv[]){
     }

     // Launch in background if requested, or if re-launching a previous session
-    bool background = qApp->arguments().contains("--background") || qApp->arguments().contains("-session") || qApp->arguments().contains("--session");
+    bool background = qApp->arguments().contains("--background") || qApp->isSessionRestored();
     if(isRunning(background ? 0 : "Open")){
         printf("ckb is already running. Exiting.\n");
         return 0;

@ccMSC
Copy link
Owner

ccMSC commented May 10, 2016

@diijkstra bah, didn't know that. Could you send me a pull request for that change, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants