all repos — openbox @ 053bb2d100c3db55a68a09f25ba96e6b1a149a96

openbox fork - make it a bit more like ryudo

rm the old guile stuff. let the user specify the path for the startup script. dont hardcode it to my home dir.
Dana Jansens danakj@orodu.net
commit

053bb2d100c3db55a68a09f25ba96e6b1a149a96

parent

70aa4b20d940d8bff1d36a251143fd73149e030c

2 files changed, 28 insertions(+), 34 deletions(-)

jump to
M src/openbox.ccsrc/openbox.cc

@@ -42,10 +42,6 @@ #ifdef HAVE_SYS_SELECT_H

# 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

@@ -100,6 +96,7 @@ _displayreq = (char*) 0;

_argv0 = argv[0]; _doshutdown = false; _rcfilepath = otk::expandTilde("~/.openbox/rc3"); + _scriptfilepath = otk::expandTilde("~/.openbox/user.py"); parseCommandLine(argc, argv);

@@ -146,6 +143,22 @@ _cursors.lr_angle = XCreateFontCursor(otk::OBDisplay::display, XC_lr_angle);

_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);

@@ -161,36 +174,6 @@ printf(_("No screens were found without a window manager. Exiting.\n"));

::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 }

@@ -228,6 +211,11 @@ if (++i >= argc)

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);

@@ -262,6 +250,7 @@ Options:\n\

-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);
M src/openbox.hhsrc/openbox.hh

@@ -87,6 +87,11 @@ /*!

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