add reconfigure and restart keys
rathnor rathnor
4 files changed,
29 insertions(+),
10 deletions(-)
M
ChangeLog
→
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)
M
src/Keys.cc
→
src/Keys.cc
@@ -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: 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 @@ {"VerticalDecrement", VERTDEC},
{"ToggleDecor", TOGGLEDECOR}, {"ToggleTab", TOGGLETAB}, {"RootMenu", ROOTMENU}, + {"Reconfigure", RECONFIGURE}, + {"Restart", RESTART}, {"Quit", QUIT}, {0, LASTKEYGRAB} };@@ -294,12 +296,14 @@ }
last_key->action = m_actionlist[i].action; switch(last_key->action) { + case Keys::RESTART: case Keys::EXECUTE: last_key->execcommand = const_cast<char *> - (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 @@ if (m_keylist[i]->keylist.size()) {
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 @@ if (temp_key->keylist.size()) {
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; }
M
src/Keys.hh
→
src/Keys.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: 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 @@ HORIZINC, VERTINC, HORIZDEC, VERTDEC,
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 @@ @return string of action
*/ 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; }
M
src/fluxbox.cc
→
src/fluxbox.cc
@@ -22,7 +22,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: 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"@@ -1299,6 +1299,13 @@ }
break; case Keys::EXECUTE: { //execute command on keypress 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: