TDE base libraries and programs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

phase1.cpp 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /***************************************************************************
  2. * Copyright (C) 2012 Timothy Pearson <kb9vqf@pearsoncomputing.net> *
  3. * *
  4. * This program is free software; you can redistribute it and/or modify *
  5. * it under the terms of the GNU General Public License as published by *
  6. * the Free Software Foundation; either version 2 of the License, or *
  7. * (at your option) any later version. *
  8. * *
  9. * This program is distributed in the hope that it will be useful, *
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  12. * GNU General Public License for more details. *
  13. * *
  14. * You should have received a copy of the GNU General Public License *
  15. * along with this program; if not, write to the *
  16. * Free Software Foundation, Inc., *
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
  18. ***************************************************************************/
  19. #include <config.h>
  20. #include <unistd.h>
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <tdeapplication.h>
  24. #include <tdeaboutdata.h>
  25. #include <tdecmdlineargs.h>
  26. #include <kstandarddirs.h>
  27. #include <tdelocale.h>
  28. #include <kdebug.h>
  29. #include <tdeconfig.h>
  30. #include <pwd.h>
  31. #include <signal.h>
  32. static const char description[] = I18N_NOOP("TDE Initialization Phase 1");
  33. static const char version[] = "0.1";
  34. static TDECmdLineOptions options[] =
  35. {
  36. TDECmdLineLastOption
  37. };
  38. int main(int argc, char **argv)
  39. {
  40. int return_code = -1;
  41. TDEAboutData about("tdeinit_phase1", I18N_NOOP("tdeinit_phase1"), version, description,
  42. TDEAboutData::License_GPL, "(C) 2012 Timothy Pearson", 0, 0, "kb9vqf@pearsoncomputing.net");
  43. about.addAuthor( "Timothy Pearson", 0, "kb9vqf@pearsoncomputing.net" );
  44. TDECmdLineArgs::init(argc, argv, &about);
  45. TDECmdLineArgs::addCmdLineOptions( options );
  46. TDEApplication::disableAutoDcopRegistration();
  47. TDEApplication app;
  48. TDEConfig config("twinrc", true);
  49. config.setGroup( "ThirdPartyWM" );
  50. TQString wmToLaunch = config.readEntry("WMExecutable", "");
  51. TQString wmArguments = config.readEntry("WMAdditionalArguments", "");
  52. // Check for TWIN override environment variable
  53. const char * twin_env = getenv("TWIN");
  54. if (twin_env) {
  55. wmToLaunch = twin_env;
  56. }
  57. // Make sure the specified WM exists
  58. if (TDEStandardDirs::findExe(wmToLaunch) == TQString::null) {
  59. wmToLaunch = "";
  60. }
  61. // Launch the WM!
  62. if (wmToLaunch == "") {
  63. return_code = system("kwrapper ksmserver");
  64. }
  65. else if (wmArguments == "") {
  66. return_code = system((TQString("kwrapper ksmserver --windowmanager %1").arg(wmToLaunch)).ascii());
  67. }
  68. else {
  69. return_code = system((TQString("kwrapper ksmserver --windowmanager %1 --windowmanageraddargs %2").arg(wmToLaunch).arg(wmArguments)).ascii());
  70. }
  71. return return_code;
  72. }