aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommandFactory.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbCommandFactory.cc')
-rw-r--r--src/FbCommandFactory.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index 7dc7fc8..4e6adf9 100644
--- a/src/FbCommandFactory.cc
+++ b/src/FbCommandFactory.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: FbCommandFactory.cc,v 1.35 2004/09/16 14:58:28 rathnor Exp $ 23// $Id: FbCommandFactory.cc,v 1.36 2004/10/06 11:40:28 akir Exp $
24 24
25#include "FbCommandFactory.hh" 25#include "FbCommandFactory.hh"
26 26
@@ -66,6 +66,7 @@ FbCommandFactory::FbCommandFactory() {
66 "commanddialog", 66 "commanddialog",
67 "deiconify", 67 "deiconify",
68 "detachclient", 68 "detachclient",
69 "export",
69 "exec", 70 "exec",
70 "execcommand", 71 "execcommand",
71 "execute", 72 "execute",
@@ -116,6 +117,7 @@ FbCommandFactory::FbCommandFactory() {
116 "rightworkspace", 117 "rightworkspace",
117 "rootmenu", 118 "rootmenu",
118 "saverc", 119 "saverc",
120 "setenv",
119 "sendtoworkspace", 121 "sendtoworkspace",
120 "sendtonextworkspace", 122 "sendtonextworkspace",
121 "sendtoprevworkspace", 123 "sendtoprevworkspace",
@@ -176,8 +178,21 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
176 return new SaveResources(); 178 return new SaveResources();
177 else if (command == "execcommand" || command == "execute" || command == "exec") 179 else if (command == "execcommand" || command == "execute" || command == "exec")
178 return new ExecuteCmd(arguments); // execute command on key screen 180 return new ExecuteCmd(arguments); // execute command on key screen
179 else if (command == "exit") 181 else if (command == "exit")
180 return new ExitFluxboxCmd(); 182 return new ExitFluxboxCmd();
183 else if (command == "setenv" || command == "export") {
184
185 std::string name = arguments;
186 FbTk::StringUtil::removeFirstWhitespace(name);
187 FbTk::StringUtil::removeTrailingWhitespace(name);
188 size_t pos = name.find_first_of(command == "setenv" ? " \t" : "=");
189 if (pos == std::string::npos || pos == name.size())
190 return 0;
191
192 std::string value = name.substr(pos + 1);
193 name = name.substr(0, pos);
194 return new ExportCmd(name, value);
195 }
181 else if (command == "quit") 196 else if (command == "quit")
182 return new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), &Fluxbox::shutdown); 197 return new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), &Fluxbox::shutdown);
183 else if (command == "commanddialog") // run specified fluxbox command 198 else if (command == "commanddialog") // run specified fluxbox command