Index: src/WorkspaceCmd.hh =================================================================== --- src/WorkspaceCmd.hh (Revision 3927) +++ src/WorkspaceCmd.hh (Arbeitskopie) @@ -25,6 +25,7 @@ #ifndef WORKSPACECMD_HH #define WORKSPACECMD_HH #include "Command.hh" +#include "ClientPattern.hh" #include "Screen.hh" class NextWindowCmd: public FbTk::Command { @@ -51,6 +52,14 @@ const BScreen::FocusDir m_dir; }; +class FocusToCmd : public FbTk::Command { +public: + explicit FocusToCmd(const std::string&); + void execute(); +private: + const ClientPattern m_pattern; +}; + class NextWorkspaceCmd: public FbTk::Command { public: void execute(); Index: src/WorkspaceCmd.cc =================================================================== --- src/WorkspaceCmd.cc (Revision 3927) +++ src/WorkspaceCmd.cc (Arbeitskopie) @@ -29,6 +29,7 @@ #include "Screen.hh" #include "fluxbox.hh" #include "WinClient.hh" +#include "ClientPattern.hh" #include "FbTk/KeyUtil.hh" @@ -43,9 +44,9 @@ void NextWindowCmd::execute() { - BScreen *screen = Fluxbox::instance()->keyScreen(); + Fluxbox *fb = Fluxbox::instance(); + BScreen *screen = fb->keyScreen(); if (screen != 0) { - Fluxbox *fb = Fluxbox::instance(); // special case for commands from key events if (fb->lastEvent().type == KeyPress) { unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); @@ -56,7 +57,7 @@ // the release of exactly these modifiers if (!fb->watchingScreen() && !(m_option & BScreen::CYCLELINEAR)) - Fluxbox::instance()->watchKeyRelease(*screen, mods); + fb->watchKeyRelease(*screen, mods); screen->nextFocus(m_option); } } else @@ -65,9 +66,10 @@ } void PrevWindowCmd::execute() { - BScreen *screen = Fluxbox::instance()->keyScreen(); + + Fluxbox *fb = Fluxbox::instance(); + BScreen *screen = fb->keyScreen(); if (screen != 0) { - Fluxbox *fb = Fluxbox::instance(); // special case for commands from key events if (fb->lastEvent().type == KeyPress) { unsigned int mods = FbTk::KeyUtil::instance().cleanMods(fb->lastEvent().xkey.state); @@ -78,7 +80,7 @@ // the release of exactly these modifiers if (!fb->watchingScreen() && !(m_option & BScreen::CYCLELINEAR)) - Fluxbox::instance()->watchKeyRelease(*screen, mods); + fb->watchKeyRelease(*screen, mods); screen->prevFocus(m_option); } } else @@ -87,17 +89,42 @@ } void DirFocusCmd::execute() { - BScreen *screen = Fluxbox::instance()->keyScreen(); + + Fluxbox *fb = Fluxbox::instance(); + BScreen *screen = fb->keyScreen(); if (screen == 0) return; - WinClient *client = Fluxbox::instance()->getFocusedWindow(); + WinClient *client = fb->getFocusedWindow(); if (client == 0 || client->fbwindow() == 0) return; screen->dirFocus(*client->fbwindow(), m_dir); } +FocusToCmd::FocusToCmd(const std::string& pattern) : m_pattern(pattern.c_str()) { + +} + +void FocusToCmd::execute() { + + Fluxbox *fb = Fluxbox::instance(); + BScreen *screen = fb->keyScreen(); + if (screen) { + Workspace *ws = screen->currentWorkspace(); + if (ws) { + Workspace::Windows::const_iterator it; + for (it = ws->windowList().begin(); it != ws->windowList().end(); it++) { + if (m_pattern == (*it)->winClient()) { + (*it)->raiseAndFocus(); + return; + } + } + } + } +} + + void NextWorkspaceCmd::execute() { BScreen *screen = Fluxbox::instance()->mouseScreen(); if (screen != 0) Index: src/FbCommandFactory.cc =================================================================== --- src/FbCommandFactory.cc (Revision 3927) +++ src/FbCommandFactory.cc (Arbeitskopie) @@ -63,6 +63,7 @@ "focusdown", "focusleft", "focusright", + "focusto", "fullscreen", "iconify", "killwindow", @@ -333,6 +334,8 @@ return new DirFocusCmd(BScreen::FOCUSLEFT); else if (command == "focusright") return new DirFocusCmd(BScreen::FOCUSRIGHT); + else if (command == "focusto") + return new FocusToCmd(arguments); else if (command == "nextgroup") return new NextWindowCmd(atoi(arguments.c_str()) ^ BScreen::CYCLEGROUPS); else if (command == "prevgroup")