Advertisement
KukuRuzo

add actions

Jun 3rd, 2024
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. diff --git a/linux/psi-extra-action1.desktop b/linux/psi-extra-action1.desktop
  2. index b76b07f9..e57c6c7a 100644
  3. --- a/linux/psi-extra-action1.desktop
  4. +++ b/linux/psi-extra-action1.desktop
  5. @@ -3,3 +3,13 @@
  6.  Exec=psi --choose-profile
  7.  Name=Start with another profile
  8.  Icon=psi
  9. +
  10. +[Desktop Action SoftwareRendering]
  11. +Exec=psi --swrender
  12. +Name=Start with OpenGL software rendering
  13. +Icon=psi
  14. +
  15. +[Desktop Action Quit]
  16. +Exec=psi --quit
  17. +Name=Quit application
  18. +Icon=application-exit
  19. diff --git a/src/main.cpp b/src/main.cpp
  20. index 9753120d..ea5fca31 100644
  21. --- a/src/main.cpp
  22. +++ b/src/main.cpp
  23. @@ -155,6 +155,8 @@ void PsiMain::useLocalInstance()
  24.      } else if (cmdline.contains("version")) {
  25.          PsiCli().showVersion();
  26.          QTimer::singleShot(0, this, SLOT(bail()));
  27. +    } else if (cmdline.contains("quit")) {
  28. +        QTimer::singleShot(0, this, [this](){sessionQuit(PsiCon::QuitProgram);});
  29.      } else if (cmdline.contains("choose-profile")) {
  30.          // Select a profile
  31.          QTimer::singleShot(0, this, SLOT(chooseProfile()));
  32. diff --git a/src/psicli.h b/src/psicli.h
  33. index e2ffee87..d5852b09 100644
  34. --- a/src/psicli.h
  35. +++ b/src/psicli.h
  36. @@ -50,6 +50,8 @@ public:
  37.              tr("Use software widgets rendering. In some cases default hardware rendering may lead to graphical "
  38.                 "glitches and crashes. This option may help."));
  39.  
  40. +        defineSwitch("quit", tr("Quit running application"));
  41. +
  42.          defineSwitch("help", tr("Show this help message and exit."));
  43.          defineAlias("h", "help");
  44.          defineAlias("?", "help");
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement