From e3787efd9f69b036b424ccf451fe617f4f6aa1e5 Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 23 May 2007 16:07:58 +0000 Subject: added :attach command --- ChangeLog | 4 ++++ src/FbCommandFactory.cc | 6 ++++++ src/WorkspaceCmd.cc | 26 +++++++++++++++++++++++--- src/WorkspaceCmd.hh | 8 ++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5ec168..7a0d7f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 1.1: +*07/05/23: + * Added key command :Attach which groups all windows matching the + given pattern (Mark) + FbCommandFactory.cc WorkspaceCmd.cc/hh *07/05/20: * Added resources session.screen.maxDisable{Move,Resize}: , which prevent maximized windows from being moved/resized (Mark) diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 0daec6d..1e5b506 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -85,6 +85,7 @@ FbCommandFactory::FbCommandFactory() { // setup commands that we can handle const char* commands[] = { "arrangewindows", + "attach", "bindkey", "clientmenu", "close", @@ -487,6 +488,11 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, cerr<<"*** WARNING: 'Workspace' actions are deprecated! Use 'Workspace ' instead"<keyScreen(); if (screen != 0) { - FocusControl::Focusables *win_list = &screen->focusControl().creationOrderWinList(); + FocusControl::Focusables win_list(screen->focusControl().creationOrderWinList()); - FocusControl::Focusables::iterator it = win_list->begin(), - it_end = win_list->end(); + FocusControl::Focusables::iterator it = win_list.begin(), + it_end = win_list.end(); for (; it != it_end; ++it) { if (m_pat.match(**it) && (*it)->fbwindow()) m_cmd->execute(*(*it)->fbwindow()); @@ -60,6 +60,26 @@ void WindowListCmd::execute() { } } +void AttachCmd::execute() { + BScreen *screen = Fluxbox::instance()->keyScreen(); + if (screen != 0) { + FocusControl::Focusables win_list(screen->focusControl().focusedOrderWinList()); + + FocusControl::Focusables::iterator it = win_list.begin(), + it_end = win_list.end(); + FluxboxWindow *first = 0; + for (; it != it_end; ++it) { + if (m_pat.match(**it) && (*it)->fbwindow()) { + if (first == 0) + first = (*it)->fbwindow(); + else + first->attachClient((*it)->fbwindow()->winClient()); + } + } + + } +} + void NextWindowCmd::execute() { BScreen *screen = Fluxbox::instance()->keyScreen(); if (screen != 0) diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh index 7687175..e1727f5 100644 --- a/src/WorkspaceCmd.hh +++ b/src/WorkspaceCmd.hh @@ -46,6 +46,14 @@ private: ClientPattern m_pat; }; +class AttachCmd: public FbTk::Command { +public: + explicit AttachCmd(const std::string &pat): m_pat(pat.c_str()) { } + void execute(); +private: + const ClientPattern m_pat; +}; + class NextWindowCmd: public FbTk::Command { public: explicit NextWindowCmd(int option, std::string &pat): -- cgit v0.11.2