create some globals for use in the python scripts
This commit is contained in:
parent
a6661d587c
commit
103372b02f
3 changed files with 26 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
||||||
scriptdir = $(libdir)/openbox/python
|
scriptdir = $(libdir)/openbox/python
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
script_DATA = clientmotion.py clicks.py
|
script_DATA = clientmotion.py clicks.py globals.py
|
||||||
EXTRA_DIST = $(script_DATA)
|
EXTRA_DIST = $(script_DATA)
|
||||||
|
|
||||||
distclean-local:
|
distclean-local:
|
||||||
|
|
9
scripts/globals.py
Normal file
9
scripts/globals.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
# openbox - pointer to the current Openbox instance
|
||||||
|
openbox = Openbox_instance()
|
||||||
|
|
||||||
|
# screen - list of all screens in the current openbox instance
|
||||||
|
screen = []
|
||||||
|
for i in range(Openbox_screenCount(openbox)):
|
||||||
|
screen.append(Openbox_screen(openbox, i))
|
||||||
|
|
||||||
|
print "Loaded globals.py"
|
|
@ -159,24 +159,11 @@ Openbox::Openbox(int argc, char **argv)
|
||||||
_cursors.ul_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ul_angle);
|
_cursors.ul_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ul_angle);
|
||||||
_cursors.ur_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ur_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();
|
|
||||||
PyRun_SimpleString("from _otk import *; from _openbox import *;");
|
|
||||||
PyRun_SimpleString("openbox = Openbox_instance()");
|
|
||||||
|
|
||||||
runPython(SCRIPTDIR"/clientmotion.py"); // moving and resizing clients
|
|
||||||
runPython(SCRIPTDIR"/clicks.py"); // titlebar/root clicks and dblclicks
|
|
||||||
runPython(_scriptfilepath.c_str());
|
|
||||||
|
|
||||||
// initialize all the screens
|
// initialize all the screens
|
||||||
OBScreen *screen;
|
OBScreen *screen;
|
||||||
screen = new OBScreen(0, _config);
|
screen = new OBScreen(0, _config);
|
||||||
if (screen->managed()) {
|
if (screen->managed()) {
|
||||||
_screens.push_back(screen);
|
_screens.push_back(screen);
|
||||||
_screens[0]->manageExisting();
|
|
||||||
// XXX: "change to" the first workspace on the screen to initialize stuff
|
// XXX: "change to" the first workspace on the screen to initialize stuff
|
||||||
} else
|
} else
|
||||||
delete screen;
|
delete screen;
|
||||||
|
@ -186,6 +173,22 @@ Openbox::Openbox(int argc, char **argv)
|
||||||
::exit(1);
|
::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// start up python and run the user's startup script
|
||||||
|
Py_SetProgramName(argv[0]);
|
||||||
|
Py_Initialize();
|
||||||
|
init_otk();
|
||||||
|
init_openbox();
|
||||||
|
PyRun_SimpleString("from _otk import *; from _openbox import *;");
|
||||||
|
|
||||||
|
runPython(SCRIPTDIR"/globals.py"); // create/set global vars
|
||||||
|
runPython(SCRIPTDIR"/clientmotion.py"); // moving and resizing clients
|
||||||
|
runPython(SCRIPTDIR"/clicks.py"); // titlebar/root clicks and dblclicks
|
||||||
|
runPython(_scriptfilepath.c_str());
|
||||||
|
|
||||||
|
ScreenList::iterator it, end = _screens.end();
|
||||||
|
for (it = _screens.begin(); it != end; ++it)
|
||||||
|
(*it)->manageExisting();
|
||||||
|
|
||||||
// grab any keys set up before the screens existed
|
// grab any keys set up before the screens existed
|
||||||
_bindings->grabKeys(true);
|
_bindings->grabKeys(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue