aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommands.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-24 14:08:05 (GMT)
committerPaul Tagliamonte <paultag@fluxbox.org>2012-04-07 02:11:33 (GMT)
commit63043b396d4fb5b5d71dc1c5c92a293abc9254ca (patch)
tree2494ae54ffabdaccb984dca032e63129b3a3e7cc /src/FbCommands.cc
parent801df07362a4d4b0038d2410be001e43cdc74395 (diff)
downloadfluxbox_paul-63043b396d4fb5b5d71dc1c5c92a293abc9254ca.zip
fluxbox_paul-63043b396d4fb5b5d71dc1c5c92a293abc9254ca.tar.bz2
(More-or-less complete) conversion of keys file to lua
keybindings are added by calling the addBinding method of default_keymode. It keys two parameters: the keys to which the action is bound to and the action itself. The action can be specified as a string (which is passed to CommandParser) or as a lua function. Support for multiple keymodes is forthcoming. For the time being, I removed the BindKey and KeyMode commands, as they will take a bit different form.
Diffstat (limited to 'src/FbCommands.cc')
-rw-r--r--src/FbCommands.cc32
1 files changed, 0 insertions, 32 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 2c9805c..7b989bb 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -260,23 +260,6 @@ void SetStyleCmd::execute() {
260 *Fluxbox::instance()->getStyleResource() = m_filename; 260 *Fluxbox::instance()->getStyleResource() = m_filename;
261} 261}
262 262
263REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void);
264
265KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") {
266 string::size_type second_pos = m_keymode.find_first_of(" \t", 0);
267 if (second_pos != string::npos) {
268 // ok we have arguments, parsing them here
269 m_end_args = m_keymode.substr(second_pos);
270 m_keymode.erase(second_pos); // remove argument from command
271 }
272 if (m_keymode != "default")
273 Fluxbox::instance()->keys()->addBinding(m_keymode + ": " + m_end_args + " :keymode default");
274}
275
276void KeyModeCmd::execute() {
277 Fluxbox::instance()->keys()->keyMode(m_keymode);
278}
279
280REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd, void); 263REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd, void);
281 264
282void HideMenuCmd::execute() { 265void HideMenuCmd::execute() {
@@ -449,21 +432,6 @@ void SetResourceValueDialogCmd::execute() {
449 win->show(); 432 win->show();
450} 433}
451 434
452REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, void);
453
454BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { }
455
456void BindKeyCmd::execute() {
457 if (Fluxbox::instance()->keys() != 0) {
458 if (Fluxbox::instance()->keys()->addBinding(m_keybind)) {
459 ofstream ofile(Fluxbox::instance()->getKeysResource()->c_str(), ios::app);
460 if (!ofile)
461 return;
462 ofile<<m_keybind<<endl;
463 }
464 }
465}
466
467FbTk::Command<void> *DeiconifyCmd::parse(const string &command, const string &args, 435FbTk::Command<void> *DeiconifyCmd::parse(const string &command, const string &args,
468 bool trusted) { 436 bool trusted) {
469 FbTk_istringstream iss(args.c_str()); 437 FbTk_istringstream iss(args.c_str());