From 1e097242f948c424585fc087900c8657695ca1fa Mon Sep 17 00:00:00 2001 From: fluxgen Date: Tue, 1 Jul 2003 09:47:41 +0000 Subject: added left and right workspace cmd --- src/FbCommandFactory.cc | 12 +++++++++--- src/WorkspaceCmd.cc | 14 +++++++++++++- src/WorkspaceCmd.hh | 18 +++++++++++++++++- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 097c3cd..c4bacae 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: FbCommandFactory.cc,v 1.6 2003/07/01 01:49:09 rathnor Exp $ +// $Id: FbCommandFactory.cc,v 1.7 2003/07/01 09:47:39 fluxgen Exp $ #include "FbCommandFactory.hh" @@ -37,7 +37,7 @@ FbCommandFactory FbCommandFactory::s_autoreg; FbCommandFactory::FbCommandFactory() { // setup commands that we can handle - const char commands[][25] = { + const char commands[][30] = { "setstyle", "saverc", "reconfigure", @@ -69,6 +69,8 @@ FbCommandFactory::FbCommandFactory() { "prevtab", "detachclient", "nextworkspace", + "rightworkspace", + "leftworkspace", "prevworkspace", "workspace", "nextwindow", @@ -107,7 +109,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, // // Current focused window commands // - else if (command == "minimizewindow" || command == "mimimize" || command == "iconify") + else if (command == "minimizewindow" || command == "minimize" || command == "iconify") return new CurrentWindowCmd(&FluxboxWindow::iconify); else if (command == "maximizewindow" || command == "maximize") return new CurrentWindowCmd(&FluxboxWindow::maximize); @@ -152,6 +154,10 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, return new NextWorkspaceCmd(); else if (command == "prevworkspace" && arguments.size() == 0) return new PrevWorkspaceCmd(); + else if (command == "rightworkspace") + return new RightWorkspaceCmd(atoi(arguments.c_str())); + else if (command == "leftworkspace") + return new LeftWorkspaceCmd(atoi(arguments.c_str())); else if (command == "workspace") { int num = 1; // workspaces appear 1-indexed to the user if (!arguments.empty()) diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index f8f39da..45bf7a2 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WorkspaceCmd.cc,v 1.1 2003/06/30 14:38:42 fluxgen Exp $ +// $Id: WorkspaceCmd.cc,v 1.2 2003/07/01 09:47:41 fluxgen Exp $ #include "WorkspaceCmd.hh" #include "Workspace.hh" @@ -85,6 +85,18 @@ void PrevWorkspaceCmd::execute() { screen->prevWorkspace(); } +void LeftWorkspaceCmd::execute() { + BScreen *screen = Fluxbox::instance()->keyScreen(); + if (screen != 0) + screen->leftWorkspace(m_param); +} + +void RightWorkspaceCmd::execute() { + BScreen *screen = Fluxbox::instance()->keyScreen(); + if (screen != 0) + screen->rightWorkspace(m_param); +} + JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { } void JumpToWorkspaceCmd::execute() { diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh index cc5702b..8a23bff 100644 --- a/src/WorkspaceCmd.hh +++ b/src/WorkspaceCmd.hh @@ -20,7 +20,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: WorkspaceCmd.hh,v 1.1 2003/06/30 14:38:42 fluxgen Exp $ +// $Id: WorkspaceCmd.hh,v 1.2 2003/07/01 09:47:41 fluxgen Exp $ #ifndef WORKSPACECMD_HH #define WORKSPACECMD_HH @@ -52,6 +52,22 @@ public: void execute(); }; +class LeftWorkspaceCmd: public FbTk::Command { +public: + explicit LeftWorkspaceCmd(int num=1):m_param(num == 0 ? 1 : num) { } + void execute(); +private: + const int m_param; +}; + +class RightWorkspaceCmd: public FbTk::Command { +public: + explicit RightWorkspaceCmd(int num=1):m_param(num == 0 ? 1 : num) { } + void execute(); +private: + const int m_param; +}; + class JumpToWorkspaceCmd: public FbTk::Command { public: explicit JumpToWorkspaceCmd(int workspace_num); -- cgit v0.11.2