added left and right workspace cmd

This commit is contained in:
fluxgen 2003-07-01 09:47:41 +00:00
parent 6ad9158c4f
commit 1e097242f9
3 changed files with 39 additions and 5 deletions

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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" #include "FbCommandFactory.hh"
@ -37,7 +37,7 @@ FbCommandFactory FbCommandFactory::s_autoreg;
FbCommandFactory::FbCommandFactory() { FbCommandFactory::FbCommandFactory() {
// setup commands that we can handle // setup commands that we can handle
const char commands[][25] = { const char commands[][30] = {
"setstyle", "setstyle",
"saverc", "saverc",
"reconfigure", "reconfigure",
@ -69,6 +69,8 @@ FbCommandFactory::FbCommandFactory() {
"prevtab", "prevtab",
"detachclient", "detachclient",
"nextworkspace", "nextworkspace",
"rightworkspace",
"leftworkspace",
"prevworkspace", "prevworkspace",
"workspace", "workspace",
"nextwindow", "nextwindow",
@ -107,7 +109,7 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
// //
// Current focused window commands // 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); return new CurrentWindowCmd(&FluxboxWindow::iconify);
else if (command == "maximizewindow" || command == "maximize") else if (command == "maximizewindow" || command == "maximize")
return new CurrentWindowCmd(&FluxboxWindow::maximize); return new CurrentWindowCmd(&FluxboxWindow::maximize);
@ -152,6 +154,10 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
return new NextWorkspaceCmd(); return new NextWorkspaceCmd();
else if (command == "prevworkspace" && arguments.size() == 0) else if (command == "prevworkspace" && arguments.size() == 0)
return new PrevWorkspaceCmd(); 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") { else if (command == "workspace") {
int num = 1; // workspaces appear 1-indexed to the user int num = 1; // workspaces appear 1-indexed to the user
if (!arguments.empty()) if (!arguments.empty())

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 "WorkspaceCmd.hh"
#include "Workspace.hh" #include "Workspace.hh"
@ -85,6 +85,18 @@ void PrevWorkspaceCmd::execute() {
screen->prevWorkspace(); 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) { } JumpToWorkspaceCmd::JumpToWorkspaceCmd(int workspace_num):m_workspace_num(workspace_num) { }
void JumpToWorkspaceCmd::execute() { void JumpToWorkspaceCmd::execute() {

View file

@ -20,7 +20,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // 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 #ifndef WORKSPACECMD_HH
#define WORKSPACECMD_HH #define WORKSPACECMD_HH
@ -52,6 +52,22 @@ public:
void execute(); 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 { class JumpToWorkspaceCmd: public FbTk::Command {
public: public:
explicit JumpToWorkspaceCmd(int workspace_num); explicit JumpToWorkspaceCmd(int workspace_num);