Tab command, thanks Steeve Lennmark, steeve dot lennmark at mediasvar dot se
fluxgen fluxgen
3 files changed,
30 insertions(+),
1 deletions(-)
M
src/CurrentWindowCmd.cc
→
src/CurrentWindowCmd.cc
@@ -60,6 +60,18 @@ if ( workspace_num < 0 ) workspace_num+= fbwindow().screen().getNumberOfWorkspaces();
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
M
src/CurrentWindowCmd.hh
→
src/CurrentWindowCmd.hh
@@ -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:
M
src/FbCommandFactory.cc
→
src/FbCommandFactory.cc
@@ -131,6 +131,7 @@ "shadewindow",
"showdesktop", "stick", "stickwindow", + "tab", "toggledecor", "windowmenu", "workspace",@@ -286,7 +287,13 @@ else if (command == "sendtoprevworkspace")
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);