diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-02 22:05:05 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2011-11-01 09:57:20 (GMT) |
commit | 96d14bf5abde4faf7312d43bfd3e339f75fabc0d (patch) | |
tree | b8fec2dfa81630417df279fc0559d96e6def5846 /src/FbCommands.hh | |
parent | 9ca7bf6a038eb40824b43d59b3754c0ac96fee3f (diff) | |
download | fluxbox_paul-96d14bf5abde4faf7312d43bfd3e339f75fabc0d.zip fluxbox_paul-96d14bf5abde4faf7312d43bfd3e339f75fabc0d.tar.bz2 |
Add a new command which executes lua functions
Diffstat (limited to 'src/FbCommands.hh')
-rw-r--r-- | src/FbCommands.hh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/FbCommands.hh b/src/FbCommands.hh index b6b1f7f..ef9812b 100644 --- a/src/FbCommands.hh +++ b/src/FbCommands.hh | |||
@@ -32,6 +32,10 @@ | |||
32 | #include "ClientPattern.hh" | 32 | #include "ClientPattern.hh" |
33 | #include "FocusableList.hh" | 33 | #include "FocusableList.hh" |
34 | 34 | ||
35 | namespace lua { | ||
36 | class state; | ||
37 | } | ||
38 | |||
35 | namespace FbCommands { | 39 | namespace FbCommands { |
36 | 40 | ||
37 | /// executes a system command | 41 | /// executes a system command |
@@ -218,6 +222,24 @@ private: | |||
218 | Destination m_dest; | 222 | Destination m_dest; |
219 | }; | 223 | }; |
220 | 224 | ||
225 | /// Command that runs a lua function | ||
226 | class LuaCmd: public FbTk::Command<void> { | ||
227 | public: | ||
228 | /// parses the string as a lua chunk | ||
229 | LuaCmd(const std::string &chunk); | ||
230 | |||
231 | /// expect the function to be on the lua stack (as a function or a string) | ||
232 | LuaCmd(lua::state &l); | ||
233 | |||
234 | ~LuaCmd(); | ||
235 | |||
236 | void execute(); | ||
237 | private: | ||
238 | int m_ref; | ||
239 | |||
240 | void init(lua::state &l); | ||
241 | }; | ||
242 | |||
221 | } // end namespace FbCommands | 243 | } // end namespace FbCommands |
222 | 244 | ||
223 | #endif // FBCOMMANDS_HH | 245 | #endif // FBCOMMANDS_HH |