all repos — fluxbox @ 5a91d8747e4ab0bb25b85c82e49f6f74d8e14e05

custom fork of the fluxbox windowmanager

bindkey command
fluxgen fluxgen
commit

5a91d8747e4ab0bb25b85c82e49f6f74d8e14e05

parent

d86f0e36bb6c09e2b3e097f26a6f2ddf0e751e55

3 files changed, 29 insertions(+), 4 deletions(-)

jump to
M src/FbCommandFactory.ccsrc/FbCommandFactory.cc

@@ -20,7 +20,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbCommandFactory.cc,v 1.23 2003/12/19 18:17:08 fluxgen Exp $ +// $Id: FbCommandFactory.cc,v 1.24 2003/12/20 17:42:04 fluxgen Exp $ #include "FbCommandFactory.hh"

@@ -61,6 +61,7 @@ FbCommandFactory::FbCommandFactory() {

// setup commands that we can handle const char* commands[] = { "arrangewindows", + "bindkey", "close", "commanddialog", "detachclient",

@@ -153,6 +154,8 @@ else if (command == "quit")

return new FbTk::SimpleCommand<Fluxbox>(*Fluxbox::instance(), &Fluxbox::shutdown); else if (command == "commanddialog") // run specified fluxbox command return new CommandDialogCmd(); + else if (command == "bindkey") + return new BindKeyCmd(arguments); else if (command == "setresourcevalue") { // we need to parse arguments as: // <remove whitespace here><resname><one whitespace><value>
M src/FbCommands.ccsrc/FbCommands.cc

@@ -19,13 +19,14 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbCommands.cc,v 1.21 2003/12/19 17:22:04 fluxgen Exp $ +// $Id: FbCommands.cc,v 1.22 2003/12/20 17:41:32 fluxgen Exp $ #include "FbCommands.hh" #include "fluxbox.hh" #include "Screen.hh" #include "CommandDialog.hh" #include "Workspace.hh" +#include "Keys.hh" #include "FbTk/Theme.hh" #include "FbTk/Menu.hh"

@@ -33,6 +34,7 @@

#include <sys/types.h> #include <unistd.h> +#include <fstream> #include <iostream> using namespace std;

@@ -106,7 +108,6 @@

} void SetStyleCmd::execute() { - cerr<<"SetStyle: "<<m_filename<<endl; Fluxbox::instance()->saveStyleFilename(m_filename.c_str()); Fluxbox::instance()->save_rc(); FbTk::ThemeManager::instance().load(m_filename);

@@ -235,5 +236,18 @@

FbTk::FbWindow *win = new CommandDialog(*screen, "Type resource name and the value", "SetResourceValue "); win->show(); }; + +BindKeyCmd::BindKeyCmd(const std::string &keybind):m_keybind(keybind) { } + +void BindKeyCmd::execute() { + if (Fluxbox::instance()->keys() != 0) { + if (Fluxbox::instance()->keys()->addBinding(m_keybind)) { + ofstream ofile(Fluxbox::instance()->keys()->filename().c_str(), ios::app); + if (!ofile) + return; + ofile<<m_keybind<<endl; + } + } +} }; // end namespace FbCommands
M src/FbCommands.hhsrc/FbCommands.hh

@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbCommands.hh,v 1.16 2003/12/19 17:19:56 fluxgen Exp $ +// $Id: FbCommands.hh,v 1.17 2003/12/20 17:41:32 fluxgen Exp $ // \file contains basic commands to restart, reconfigure, execute command and exit fluxbox

@@ -126,6 +126,14 @@

class SetResourceValueDialogCmd: public FbTk::Command { public: void execute(); +}; + +class BindKeyCmd: public FbTk::Command { +public: + BindKeyCmd(const std::string &keybind); + void execute(); +private: + const std::string m_keybind; }; #endif // FBCOMMANDS_HH