summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-12-20 17:42:04 (GMT)
committerfluxgen <fluxgen>2003-12-20 17:42:04 (GMT)
commit5a91d8747e4ab0bb25b85c82e49f6f74d8e14e05 (patch)
tree1f03ec76a386ccced9fab202c5eab0f738c98303
parentd86f0e36bb6c09e2b3e097f26a6f2ddf0e751e55 (diff)
downloadfluxbox_lack-5a91d8747e4ab0bb25b85c82e49f6f74d8e14e05.zip
fluxbox_lack-5a91d8747e4ab0bb25b85c82e49f6f74d8e14e05.tar.bz2
bindkey command
-rw-r--r--src/FbCommandFactory.cc5
-rw-r--r--src/FbCommands.cc18
-rw-r--r--src/FbCommands.hh10
3 files changed, 29 insertions, 4 deletions
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc
index 91348fa..d3ea8ce 100644
--- a/src/FbCommandFactory.cc
+++ b/src/FbCommandFactory.cc
@@ -20,7 +20,7 @@
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21// DEALINGS IN THE SOFTWARE. 21// DEALINGS IN THE SOFTWARE.
22 22
23// $Id: FbCommandFactory.cc,v 1.23 2003/12/19 18:17:08 fluxgen Exp $ 23// $Id: FbCommandFactory.cc,v 1.24 2003/12/20 17:42:04 fluxgen Exp $
24 24
25#include "FbCommandFactory.hh" 25#include "FbCommandFactory.hh"
26 26
@@ -61,6 +61,7 @@ FbCommandFactory::FbCommandFactory() {
61 // setup commands that we can handle 61 // setup commands that we can handle
62 const char* commands[] = { 62 const char* commands[] = {
63 "arrangewindows", 63 "arrangewindows",
64 "bindkey",
64 "close", 65 "close",
65 "commanddialog", 66 "commanddialog",
66 "detachclient", 67 "detachclient",
@@ -153,6 +154,8 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
153 return new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), &Fluxbox::shutdown); 154 return new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), &Fluxbox::shutdown);
154 else if (command == "commanddialog") // run specified fluxbox command 155 else if (command == "commanddialog") // run specified fluxbox command
155 return new CommandDialogCmd(); 156 return new CommandDialogCmd();
157 else if (command == "bindkey")
158 return new BindKeyCmd(arguments);
156 else if (command == "setresourcevalue") { 159 else if (command == "setresourcevalue") {
157 // we need to parse arguments as: 160 // we need to parse arguments as:
158 // <remove whitespace here><resname><one whitespace><value> 161 // <remove whitespace here><resname><one whitespace><value>
diff --git a/src/FbCommands.cc b/src/FbCommands.cc
index 91ec11c..d4ad87e 100644
--- a/src/FbCommands.cc
+++ b/src/FbCommands.cc
@@ -19,13 +19,14 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbCommands.cc,v 1.21 2003/12/19 17:22:04 fluxgen Exp $ 22// $Id: FbCommands.cc,v 1.22 2003/12/20 17:41:32 fluxgen Exp $
23 23
24#include "FbCommands.hh" 24#include "FbCommands.hh"
25#include "fluxbox.hh" 25#include "fluxbox.hh"
26#include "Screen.hh" 26#include "Screen.hh"
27#include "CommandDialog.hh" 27#include "CommandDialog.hh"
28#include "Workspace.hh" 28#include "Workspace.hh"
29#include "Keys.hh"
29 30
30#include "FbTk/Theme.hh" 31#include "FbTk/Theme.hh"
31#include "FbTk/Menu.hh" 32#include "FbTk/Menu.hh"
@@ -33,6 +34,7 @@
33#include <sys/types.h> 34#include <sys/types.h>
34#include <unistd.h> 35#include <unistd.h>
35 36
37#include <fstream>
36#include <iostream> 38#include <iostream>
37using namespace std; 39using namespace std;
38 40
@@ -106,7 +108,6 @@ SetStyleCmd::SetStyleCmd(const std::string &filename):m_filename(filename) {
106} 108}
107 109
108void SetStyleCmd::execute() { 110void SetStyleCmd::execute() {
109 cerr<<"SetStyle: "<<m_filename<<endl;
110 Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); 111 Fluxbox::instance()->saveStyleFilename(m_filename.c_str());
111 Fluxbox::instance()->save_rc(); 112 Fluxbox::instance()->save_rc();
112 FbTk::ThemeManager::instance().load(m_filename); 113 FbTk::ThemeManager::instance().load(m_filename);
@@ -236,4 +237,17 @@ void SetResourceValueDialogCmd::execute() {
236 win->show(); 237 win->show();
237}; 238};
238 239
240BindKeyCmd::BindKeyCmd(const std::string &keybind):m_keybind(keybind) { }
241
242void BindKeyCmd::execute() {
243 if (Fluxbox::instance()->keys() != 0) {
244 if (Fluxbox::instance()->keys()->addBinding(m_keybind)) {
245 ofstream ofile(Fluxbox::instance()->keys()->filename().c_str(), ios::app);
246 if (!ofile)
247 return;
248 ofile<<m_keybind<<endl;
249 }
250 }
251}
252
239}; // end namespace FbCommands 253}; // end namespace FbCommands
diff --git a/src/FbCommands.hh b/src/FbCommands.hh
index 0355e7e..2d1d5da 100644
--- a/src/FbCommands.hh
+++ b/src/FbCommands.hh
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: FbCommands.hh,v 1.16 2003/12/19 17:19:56 fluxgen Exp $ 22// $Id: FbCommands.hh,v 1.17 2003/12/20 17:41:32 fluxgen Exp $
23 23
24// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox 24// \file contains basic commands to restart, reconfigure, execute command and exit fluxbox
25 25
@@ -128,4 +128,12 @@ public:
128 void execute(); 128 void execute();
129}; 129};
130 130
131class BindKeyCmd: public FbTk::Command {
132public:
133 BindKeyCmd(const std::string &keybind);
134 void execute();
135private:
136 const std::string m_keybind;
137};
138
131#endif // FBCOMMANDS_HH 139#endif // FBCOMMANDS_HH