Tab command, thanks Steeve Lennmark, steeve dot lennmark at mediasvar dot se
This commit is contained in:
parent
cc486c194f
commit
6ba7744f65
3 changed files with 30 additions and 1 deletions
|
@ -60,6 +60,18 @@ void SendToPrevWorkspaceCmd::real_execute() {
|
|||
fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow());
|
||||
}
|
||||
|
||||
void GoToTabCmd::real_execute() {
|
||||
if (fbwindow().numClients() <= 1 || m_tab_num > fbwindow().numClients())
|
||||
return;
|
||||
|
||||
FluxboxWindow::ClientList::iterator it = fbwindow().clientList().begin();
|
||||
|
||||
int num = m_tab_num;
|
||||
while (--num > 0) ++it;
|
||||
|
||||
fbwindow().setCurrentClient(**it, true);
|
||||
}
|
||||
|
||||
void WindowHelperCmd::execute() {
|
||||
WinClient *client = Fluxbox::instance()->getFocusedWindow();
|
||||
if (client && client->fbwindow()) // guarantee that fbwindow() exists too
|
||||
|
|
|
@ -87,6 +87,16 @@ private:
|
|||
const int m_workspace_num;
|
||||
};
|
||||
|
||||
// goto tab
|
||||
class GoToTabCmd: public WindowHelperCmd {
|
||||
public:
|
||||
explicit GoToTabCmd(int tab_num):m_tab_num(tab_num) { }
|
||||
protected:
|
||||
void real_execute();
|
||||
private:
|
||||
const int m_tab_num;
|
||||
};
|
||||
|
||||
// move cmd, relative position
|
||||
class MoveCmd: public WindowHelperCmd {
|
||||
public:
|
||||
|
|
|
@ -131,6 +131,7 @@ FbCommandFactory::FbCommandFactory() {
|
|||
"showdesktop",
|
||||
"stick",
|
||||
"stickwindow",
|
||||
"tab",
|
||||
"toggledecor",
|
||||
"windowmenu",
|
||||
"workspace",
|
||||
|
@ -286,7 +287,13 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
|
|||
return new SendToPrevWorkspaceCmd(atoi(arguments.c_str()));
|
||||
else if (command == "killwindow" || command == "kill")
|
||||
return new KillWindowCmd();
|
||||
else if (command == "nexttab")
|
||||
else if (command == "tab") {
|
||||
// XXX
|
||||
int num = 1;
|
||||
if (!arguments.empty())
|
||||
num = atoi(arguments.c_str());
|
||||
return new GoToTabCmd(num);
|
||||
} else if (command == "nexttab")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::nextClient);
|
||||
else if (command == "prevtab")
|
||||
return new CurrentWindowCmd(&FluxboxWindow::prevClient);
|
||||
|
|
Loading…
Reference in a new issue