diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-24 14:08:05 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-07-24 14:08:05 (GMT) |
commit | 281a59d37f688cc316ef37e47234c645acbb717c (patch) | |
tree | c4821b96cd372e6214721c12f09c29b803d26ace /src/FbCommands.cc | |
parent | 2127e4045fbaf1c10acf1df6f43216b4c6df2235 (diff) | |
download | fluxbox_pavel-281a59d37f688cc316ef37e47234c645acbb717c.zip fluxbox_pavel-281a59d37f688cc316ef37e47234c645acbb717c.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.cc | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index b54afd9..6e9fed8 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.cc | |||
@@ -248,23 +248,6 @@ void SetStyleCmd::execute() { | |||
248 | *Fluxbox::instance()->getStyleResource() = m_filename; | 248 | *Fluxbox::instance()->getStyleResource() = m_filename; |
249 | } | 249 | } |
250 | 250 | ||
251 | REGISTER_COMMAND_WITH_ARGS(keymode, FbCommands::KeyModeCmd, void); | ||
252 | |||
253 | KeyModeCmd::KeyModeCmd(const string &arguments):m_keymode(arguments),m_end_args("None Escape") { | ||
254 | string::size_type second_pos = m_keymode.find_first_of(" \t", 0); | ||
255 | if (second_pos != string::npos) { | ||
256 | // ok we have arguments, parsing them here | ||
257 | m_end_args = m_keymode.substr(second_pos); | ||
258 | m_keymode.erase(second_pos); // remove argument from command | ||
259 | } | ||
260 | if (m_keymode != "default") | ||
261 | Fluxbox::instance()->keys()->addBinding(m_keymode + ": " + m_end_args + " :keymode default"); | ||
262 | } | ||
263 | |||
264 | void KeyModeCmd::execute() { | ||
265 | Fluxbox::instance()->keys()->keyMode(m_keymode); | ||
266 | } | ||
267 | |||
268 | REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd, void); | 251 | REGISTER_COMMAND(hidemenus, FbCommands::HideMenuCmd, void); |
269 | 252 | ||
270 | void HideMenuCmd::execute() { | 253 | void HideMenuCmd::execute() { |
@@ -437,21 +420,6 @@ void SetResourceValueDialogCmd::execute() { | |||
437 | win->show(); | 420 | win->show(); |
438 | } | 421 | } |
439 | 422 | ||
440 | REGISTER_UNTRUSTED_COMMAND_WITH_ARGS(bindkey, FbCommands::BindKeyCmd, void); | ||
441 | |||
442 | BindKeyCmd::BindKeyCmd(const string &keybind):m_keybind(keybind) { } | ||
443 | |||
444 | void BindKeyCmd::execute() { | ||
445 | if (Fluxbox::instance()->keys() != 0) { | ||
446 | if (Fluxbox::instance()->keys()->addBinding(m_keybind)) { | ||
447 | ofstream ofile(Fluxbox::instance()->getKeysResource()->c_str(), ios::app); | ||
448 | if (!ofile) | ||
449 | return; | ||
450 | ofile<<m_keybind<<endl; | ||
451 | } | ||
452 | } | ||
453 | } | ||
454 | |||
455 | FbTk::Command<void> *DeiconifyCmd::parse(const string &command, const string &args, | 423 | FbTk::Command<void> *DeiconifyCmd::parse(const string &command, const string &args, |
456 | bool trusted) { | 424 | bool trusted) { |
457 | FbTk_istringstream iss(args.c_str()); | 425 | FbTk_istringstream iss(args.c_str()); |