From 81e4fe8d44a3f0bd8c104127d7785badab6f2bc8 Mon Sep 17 00:00:00 2001 From: rathnor Date: Sun, 8 Jun 2003 14:32:28 +0000 Subject: add reconfigure and restart keys --- ChangeLog | 3 +++ src/Keys.cc | 21 ++++++++++++++------- src/Keys.hh | 6 ++++-- src/fluxbox.cc | 9 ++++++++- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa38223..121d16a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ (Format: Year/Month/Day) Changes for 0.9.3: *03/06/08: + * Add Reconfigure and Restart Key actions, thanks Jann Fisher (Simon) + Also modify the patch to take argument on Restart action + Keys.hh/cc fluxbox.cc * Fix restart command to accept and use an argument again (Simon) Screen.cc FbCommands.hh/cc * Fix bug that sometimes left window frames after window closed (Simon) diff --git a/src/Keys.cc b/src/Keys.cc index a9879b5..48db064 100644 --- a/src/Keys.cc +++ b/src/Keys.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -//$Id: Keys.cc,v 1.27 2003/04/26 18:27:56 fluxgen Exp $ +//$Id: Keys.cc,v 1.28 2003/06/08 14:32:28 rathnor Exp $ #include "Keys.hh" @@ -135,6 +135,8 @@ Keys::t_actionstr Keys::m_actionlist[] = { {"ToggleDecor", TOGGLEDECOR}, {"ToggleTab", TOGGLETAB}, {"RootMenu", ROOTMENU}, + {"Reconfigure", RECONFIGURE}, + {"Restart", RESTART}, {"Quit", QUIT}, {0, LASTKEYGRAB} }; @@ -294,12 +296,14 @@ bool Keys::load(const char *filename) { last_key->action = m_actionlist[i].action; switch(last_key->action) { + case Keys::RESTART: case Keys::EXECUTE: last_key->execcommand = const_cast - (FbTk::StringUtil::strcasestr(linebuffer.c_str(), - getActionStr(Keys::EXECUTE))+ - strlen(getActionStr(Keys::EXECUTE))); + (FbTk::StringUtil::strcasestr( + linebuffer.c_str(), + getActionStr(last_key->action)) + + strlen(getActionStr(last_key->action)) + 1); break; case WORKSPACE: case SENDTOWORKSPACE: @@ -481,7 +485,8 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) { next_key = m_keylist[i]; break; //end for-loop } else { - if (m_keylist[i]->action == Keys::EXECUTE) + if (m_keylist[i]->action == Keys::EXECUTE || + m_keylist[i]->action == Keys::RESTART) m_execcmdstring = m_keylist[i]->execcommand; //update execcmdstring if action is grabExecute m_param = m_keylist[i]->param; return m_keylist[i]->action; @@ -496,14 +501,16 @@ Keys::KeyAction Keys::getAction(XKeyEvent *ke) { next_key = temp_key; } else { next_key = 0; - if (temp_key->action == Keys::EXECUTE) + if (temp_key->action == Keys::EXECUTE || + temp_key->action == Keys::RESTART) m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute return temp_key->action; } } else { temp_key = next_key; next_key = 0; - if (temp_key->action == Keys::EXECUTE) + if (temp_key->action == Keys::EXECUTE || + temp_key->action == Keys::RESTART) m_execcmdstring = temp_key->execcommand; //update execcmdstring if action is grabExecute return temp_key->action; } diff --git a/src/Keys.hh b/src/Keys.hh index d0eb344..b78f7e7 100644 --- a/src/Keys.hh +++ b/src/Keys.hh @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Keys.hh,v 1.23 2003/04/20 12:21:35 rathnor Exp $ +// $Id: Keys.hh,v 1.24 2003/06/08 14:32:28 rathnor Exp $ #ifndef KEYS_HH #define KEYS_HH @@ -64,6 +64,8 @@ public: TOGGLEDECOR,// toggle visibility of decor (title, frame, handles) TOGGLETAB, // toggle visibilty of tab ROOTMENU, // pop up rootmenu + RECONFIGURE, // reload configuration + RESTART, // restart fluxbox QUIT, // Die, quit, logout, shutdown LASTKEYGRAB //mark end of keygrabbs }; @@ -108,7 +110,7 @@ public: */ const char *getActionStr(KeyAction action); /** - Get command to execute (key action EXECUTE) + Get command to execute (key action EXECUTE/RESTART) @return string to command */ const std::string &getExecCommand() { return m_execcmdstring; } diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 9f5f1cc..7c834a6 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: fluxbox.cc,v 1.152 2003/06/08 00:13:41 rathnor Exp $ +// $Id: fluxbox.cc,v 1.153 2003/06/08 14:32:28 rathnor Exp $ #include "fluxbox.hh" @@ -1301,6 +1301,13 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { FbCommands::ExecuteCmd cmd(m_key->getExecCommand(), mousescreen->screenNumber()); cmd.execute(); } break; + case Keys::RECONFIGURE: + reload_rc(); + break; + case Keys::RESTART: { + FbCommands::RestartFluxboxCmd cmd(m_key->getExecCommand()); + cmd.execute(); + } break; case Keys::QUIT: shutdown(); break; -- cgit v0.11.2