aboutsummaryrefslogtreecommitdiff
path: root/src/FbCommands.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-07-24 14:08:05 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-11-01 09:57:23 (GMT)
commit8ee8a7798c73731724a8e982ed027394a45f6b58 (patch)
treeea12ca08f17eea045301d0be846b170eb35deaad /src/FbCommands.cc
parentab0fd035167f053966225a239dae189d5f439ecd (diff)
downloadfluxbox_paul-8ee8a7798c73731724a8e982ed027394a45f6b58.zip
fluxbox_paul-8ee8a7798c73731724a8e982ed027394a45f6b58.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 7d6b994..131b6d8 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());