Hi,
I have been doing some hacking on blackbox and wanted to share my
patches.
bb_exec.patch
This patch will modify blackbox.cc so that you can fire off a command
from your blackboxrc file. Use the line: session.execCommand: <your
command here>
If you have multiple things to fire off then you will have to trigger a
script from the .blackboxrc file that will do that for you.
bbkeys_readExec.patch
You may not have noticed but you cannot put paranthesis inside of the
'doThis' command in the .bbkeyrc file. Specifically you cannot have a
closing ')'. I made a patch that fixes this. So if you want to do
something wonky like:
doThis(/usr/bin/foo (some args | other args))
You can now do this and bbkeys will ingest it and excrete it to the
command line properly. (If you are thinking "Why the heck would I do
that?", then you use find differently than me :) )
Hope these are usefull to other people.
Eric H.
--
Eric Hanson
Junior Programmer
Universal Talkware Corp.
--- blackbox.cc.old Wed May 9 17:47:19 2001
+++ blackbox.cc Wed May 9 17:41:14 2001
@@ -1641,6 +1641,23 @@
} else
screen->saveOpaqueMove(False);
+ // UTC Modification so that we can fire stuff off from the .blackboxrc file
+ // The line should be: session.execCommand: <some command>
+ if (XrmGetResource(database, "session.execCommand", "Session.execCommand",
+ &value_type, &value)) {
+#ifndef __EMX__
+ char displaystring[MAXPATHLEN] = "foo";
+ sprintf(displaystring, "DISPLAY=%s",
+ DisplayString(screen->getBaseDisplay()->getXDisplay()));
+ sprintf(displaystring + strlen(displaystring) - 1, "%d",
+ screen->getScreenNumber());
+
+ bexec(value.addr, displaystring);
+#else // __EMX__
+ spawnlp(P_NOWAIT, "cmd.exe", "cmd.exe", "/c", value.addr, NULL);
+#endif // !__EMX__
+ } // End of if session.execCommand
+
XrmDestroyDatabase(database);
}
--- bbkeys.cc.old Wed May 9 12:08:06 2001
+++ bbkeys.cc Wed May 9 12:04:15 2001
@@ -729,8 +729,9 @@
if (grabSet.KeyMap[count].action == grabExecute) {
execCmdBegin = strchr(actionBegin + 1, '(');
if (execCmdBegin) {
+ // UTC Modification, copies from the last occurance of ')'
strncpy(execCommand, execCmdBegin + 1,
- strcspn(execCmdBegin + 1, ")"));
+ strrchr(execCmdBegin, ')') - (execCmdBegin + 1));
grabSet.KeyMap[count].execCommand = strdup(execCommand);
}
} else {