# include <sys/select.h>
#endif // HAVE_SYS_SELECT_H
-//#include <guile/gh.h>
-
-//extern void SWIG_init();
-
#include <Python.h>
// The initializer in openbox_wrap.cc
_argv0 = argv[0];
_doshutdown = false;
_rcfilepath = otk::expandTilde("~/.openbox/rc3");
+ _scriptfilepath = otk::expandTilde("~/.openbox/user.py");
parseCommandLine(argc, argv);
_cursors.ul_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ul_angle);
_cursors.ur_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ur_angle);
+ // start up python and run the user's startup script
+ Py_SetProgramName(argv[0]);
+ Py_Initialize();
+ init_otk();
+ init_openbox();
+ // i wish...
+ //PyRun_String("from _otk import *; from _openbox import *;", Py_file_input,
+ // Py_None, Py_None);
+ FILE *rcpyfd = fopen(_scriptfilepath.c_str(), "r");
+ if (!rcpyfd) {
+ printf("failed to load python file %s\n", _scriptfilepath.c_str());
+ } else {
+ PyRun_SimpleFile(rcpyfd, _scriptfilepath.c_str());
+ fclose(rcpyfd);
+ }
+
// initialize all the screens
OBScreen *screen;
screen = new OBScreen(0, _config);
::exit(1);
}
-/*
- // make our guile interfaces exist
- SWIG_init();
-
- // run the guile of d3th
- FILE *rcpyfd = fopen("/home/natas/.openbox/user.scm", "r");
- if (!rcpyfd) {
- printf("failed to load guile script /home/natas/.openbox/user.scm\n");
- } else {
- fclose(rcpyfd);
- gh_load("/home/natas/.openbox/user.scm");
- }
-*/
-
- Py_SetProgramName(argv[0]);
- Py_Initialize();
- init_otk();
- init_openbox();
- // i wish...
- //PyRun_String("from _otk import *; from _openbox import *;", Py_file_input,
- // Py_None, Py_None);
- FILE *rcpyfd = fopen("/home/natas/.openbox/user.py", "r");
- if (!rcpyfd) {
- printf("failed to load python file /home/natas/.openbox/user.py\n");
- } else {
- PyRun_SimpleFile(rcpyfd, "/home/natas/.openbox/user.py");
- fclose(rcpyfd);
- }
-
-
_state = State_Normal; // done starting
}
err = true;
else
_menufilepath = argv[i];
+ } else if (arg == "-script") {
+ if (++i >= argc)
+ err = true;
+ else
+ _scriptfilepath = argv[i];
} else if (arg == "-version") {
showVersion();
::exit(0);
-display <string> use display connection.\n\
-rc <string> use alternate resource file.\n\
-menu <string> use alternate menu file.\n\
+ -script <string> use alternate startup script file.\n\
-version display version and exit.\n\
-help display this help text and exit.\n\n"), _argv0);
Defaults to $(HOME)/.openbox/menu3
*/
std::string _menufilepath;
+ //! Path to the script file to execute on startup
+ /*!
+ Defaults to $(HOME)/.openbox/user.py
+ */
+ std::string _scriptfilepath;
//! The display requested by the user, or null to use the DISPLAY env var
char *_displayreq;
//! The value of argv[0], i.e. how this application was executed