diff options
author | Pavel Labath <pavelo@centrum.sk> | 2011-07-02 22:05:05 (GMT) |
---|---|---|
committer | Pavel Labath <pavelo@centrum.sk> | 2013-02-17 09:36:37 (GMT) |
commit | 9d2f0d82bc305c081b54787fb49a90471a429000 (patch) | |
tree | 8c2f946d86bdb2ba1d437372328e52ff251acb0c /src/FbCommands.hh | |
parent | 240736c6f9e78e58f90a4291d7fe876a15e460c6 (diff) | |
download | fluxbox_pavel-9d2f0d82bc305c081b54787fb49a90471a429000.zip fluxbox_pavel-9d2f0d82bc305c081b54787fb49a90471a429000.tar.bz2 |
Add a new command which executes lua functions
Diffstat (limited to 'src/FbCommands.hh')
-rw-r--r-- | src/FbCommands.hh | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/FbCommands.hh b/src/FbCommands.hh index d9639ad..bd377f5 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,7 +222,6 @@ private: | |||
218 | Destination m_dest; | 222 | Destination m_dest; |
219 | }; | 223 | }; |
220 | 224 | ||
221 | |||
222 | /// test client pattern | 225 | /// test client pattern |
223 | class ClientPatternTestCmd: public FbTk::Command<void> { | 226 | class ClientPatternTestCmd: public FbTk::Command<void> { |
224 | public: | 227 | public: |
@@ -228,6 +231,24 @@ private: | |||
228 | std::string m_args; | 231 | std::string m_args; |
229 | }; | 232 | }; |
230 | 233 | ||
234 | /// Command that runs a lua function | ||
235 | class LuaCmd: public FbTk::Command<void> { | ||
236 | public: | ||
237 | /// parses the string as a lua chunk | ||
238 | LuaCmd(const std::string &chunk); | ||
239 | |||
240 | /// expect the function to be on the lua stack (as a function or a string) | ||
241 | LuaCmd(lua::state &l); | ||
242 | |||
243 | ~LuaCmd(); | ||
244 | |||
245 | void execute(); | ||
246 | private: | ||
247 | int m_ref; | ||
248 | |||
249 | void init(lua::state &l); | ||
250 | }; | ||
251 | |||
231 | } // end namespace FbCommands | 252 | } // end namespace FbCommands |
232 | 253 | ||
233 | #endif // FBCOMMANDS_HH | 254 | #endif // FBCOMMANDS_HH |