diff options
author | fluxgen <fluxgen> | 2004-12-10 09:49:01 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2004-12-10 09:49:01 (GMT) |
commit | 6ba7744f65453a2705ba1bb88ce355c4cfde9276 (patch) | |
tree | f8ce7cf3fc2be0ab624edaa827ea73dab4ae436c | |
parent | cc486c194f862bf0d8d8b3644c321446b0d3f051 (diff) | |
download | fluxbox_paul-6ba7744f65453a2705ba1bb88ce355c4cfde9276.zip fluxbox_paul-6ba7744f65453a2705ba1bb88ce355c4cfde9276.tar.bz2 |
Tab command, thanks Steeve Lennmark, steeve dot lennmark at mediasvar dot se
-rw-r--r-- | src/CurrentWindowCmd.cc | 12 | ||||
-rw-r--r-- | src/CurrentWindowCmd.hh | 10 | ||||
-rw-r--r-- | src/FbCommandFactory.cc | 9 |
3 files changed, 30 insertions, 1 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc index e68ec8f..a07dbb2 100644 --- a/src/CurrentWindowCmd.cc +++ b/src/CurrentWindowCmd.cc | |||
@@ -60,6 +60,18 @@ void SendToPrevWorkspaceCmd::real_execute() { | |||
60 | fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); | 60 | fbwindow().screen().sendToWorkspace(workspace_num, &fbwindow()); |
61 | } | 61 | } |
62 | 62 | ||
63 | void GoToTabCmd::real_execute() { | ||
64 | if (fbwindow().numClients() <= 1 || m_tab_num > fbwindow().numClients()) | ||
65 | return; | ||
66 | |||
67 | FluxboxWindow::ClientList::iterator it = fbwindow().clientList().begin(); | ||
68 | |||
69 | int num = m_tab_num; | ||
70 | while (--num > 0) ++it; | ||
71 | |||
72 | fbwindow().setCurrentClient(**it, true); | ||
73 | } | ||
74 | |||
63 | void WindowHelperCmd::execute() { | 75 | void WindowHelperCmd::execute() { |
64 | WinClient *client = Fluxbox::instance()->getFocusedWindow(); | 76 | WinClient *client = Fluxbox::instance()->getFocusedWindow(); |
65 | if (client && client->fbwindow()) // guarantee that fbwindow() exists too | 77 | if (client && client->fbwindow()) // guarantee that fbwindow() exists too |
diff --git a/src/CurrentWindowCmd.hh b/src/CurrentWindowCmd.hh index 2bc2c81..9b8e8fb 100644 --- a/src/CurrentWindowCmd.hh +++ b/src/CurrentWindowCmd.hh | |||
@@ -87,6 +87,16 @@ private: | |||
87 | const int m_workspace_num; | 87 | const int m_workspace_num; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | // goto tab | ||
91 | class GoToTabCmd: public WindowHelperCmd { | ||
92 | public: | ||
93 | explicit GoToTabCmd(int tab_num):m_tab_num(tab_num) { } | ||
94 | protected: | ||
95 | void real_execute(); | ||
96 | private: | ||
97 | const int m_tab_num; | ||
98 | }; | ||
99 | |||
90 | // move cmd, relative position | 100 | // move cmd, relative position |
91 | class MoveCmd: public WindowHelperCmd { | 101 | class MoveCmd: public WindowHelperCmd { |
92 | public: | 102 | public: |
diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 5c0794e..a70e09b 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc | |||
@@ -131,6 +131,7 @@ FbCommandFactory::FbCommandFactory() { | |||
131 | "showdesktop", | 131 | "showdesktop", |
132 | "stick", | 132 | "stick", |
133 | "stickwindow", | 133 | "stickwindow", |
134 | "tab", | ||
134 | "toggledecor", | 135 | "toggledecor", |
135 | "windowmenu", | 136 | "windowmenu", |
136 | "workspace", | 137 | "workspace", |
@@ -286,7 +287,13 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, | |||
286 | return new SendToPrevWorkspaceCmd(atoi(arguments.c_str())); | 287 | return new SendToPrevWorkspaceCmd(atoi(arguments.c_str())); |
287 | else if (command == "killwindow" || command == "kill") | 288 | else if (command == "killwindow" || command == "kill") |
288 | return new KillWindowCmd(); | 289 | return new KillWindowCmd(); |
289 | else if (command == "nexttab") | 290 | else if (command == "tab") { |
291 | // XXX | ||
292 | int num = 1; | ||
293 | if (!arguments.empty()) | ||
294 | num = atoi(arguments.c_str()); | ||
295 | return new GoToTabCmd(num); | ||
296 | } else if (command == "nexttab") | ||
290 | return new CurrentWindowCmd(&FluxboxWindow::nextClient); | 297 | return new CurrentWindowCmd(&FluxboxWindow::nextClient); |
291 | else if (command == "prevtab") | 298 | else if (command == "prevtab") |
292 | return new CurrentWindowCmd(&FluxboxWindow::prevClient); | 299 | return new CurrentWindowCmd(&FluxboxWindow::prevClient); |