aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/FbCommandFactory.cc6
-rw-r--r--src/WorkspaceCmd.cc26
-rw-r--r--src/WorkspaceCmd.hh8
3 files changed, 37 insertions, 3 deletions
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() {
85 // setup commands that we can handle 85 // setup commands that we can handle
86 const char* commands[] = { 86 const char* commands[] = {
87 "arrangewindows", 87 "arrangewindows",
88 "attach",
88 "bindkey", 89 "bindkey",
89 "clientmenu", 90 "clientmenu",
90 "close", 91 "close",
@@ -487,6 +488,11 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command,
487 cerr<<"*** WARNING: 'Workspace<n>' actions are deprecated! Use 'Workspace <n>' instead"<<endl; 488 cerr<<"*** WARNING: 'Workspace<n>' actions are deprecated! Use 'Workspace <n>' instead"<<endl;
488 return new JumpToWorkspaceCmd(getint(command.substr(9).c_str(), 1) - 1); 489 return new JumpToWorkspaceCmd(getint(command.substr(9).c_str(), 1) - 1);
489 490
491 } else if (command == "attach") {
492 int opts; // not used
493 string pat;
494 parseNextWindowArgs(arguments, opts, pat);
495 return new AttachCmd(pat);
490 } else if (command == "nextwindow") { 496 } else if (command == "nextwindow") {
491 int opts; 497 int opts;
492 string pat; 498 string pat;
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 75cf4d3..a9b7aca 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -49,10 +49,10 @@ void WindowListCmd::execute() {
49 49
50 BScreen *screen = Fluxbox::instance()->keyScreen(); 50 BScreen *screen = Fluxbox::instance()->keyScreen();
51 if (screen != 0) { 51 if (screen != 0) {
52 FocusControl::Focusables *win_list = &screen->focusControl().creationOrderWinList(); 52 FocusControl::Focusables win_list(screen->focusControl().creationOrderWinList());
53 53
54 FocusControl::Focusables::iterator it = win_list->begin(), 54 FocusControl::Focusables::iterator it = win_list.begin(),
55 it_end = win_list->end(); 55 it_end = win_list.end();
56 for (; it != it_end; ++it) { 56 for (; it != it_end; ++it) {
57 if (m_pat.match(**it) && (*it)->fbwindow()) 57 if (m_pat.match(**it) && (*it)->fbwindow())
58 m_cmd->execute(*(*it)->fbwindow()); 58 m_cmd->execute(*(*it)->fbwindow());
@@ -60,6 +60,26 @@ void WindowListCmd::execute() {
60 } 60 }
61} 61}
62 62
63void AttachCmd::execute() {
64 BScreen *screen = Fluxbox::instance()->keyScreen();
65 if (screen != 0) {
66 FocusControl::Focusables win_list(screen->focusControl().focusedOrderWinList());
67
68 FocusControl::Focusables::iterator it = win_list.begin(),
69 it_end = win_list.end();
70 FluxboxWindow *first = 0;
71 for (; it != it_end; ++it) {
72 if (m_pat.match(**it) && (*it)->fbwindow()) {
73 if (first == 0)
74 first = (*it)->fbwindow();
75 else
76 first->attachClient((*it)->fbwindow()->winClient());
77 }
78 }
79
80 }
81}
82
63void NextWindowCmd::execute() { 83void NextWindowCmd::execute() {
64 BScreen *screen = Fluxbox::instance()->keyScreen(); 84 BScreen *screen = Fluxbox::instance()->keyScreen();
65 if (screen != 0) 85 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:
46 ClientPattern m_pat; 46 ClientPattern m_pat;
47}; 47};
48 48
49class AttachCmd: public FbTk::Command {
50public:
51 explicit AttachCmd(const std::string &pat): m_pat(pat.c_str()) { }
52 void execute();
53private:
54 const ClientPattern m_pat;
55};
56
49class NextWindowCmd: public FbTk::Command { 57class NextWindowCmd: public FbTk::Command {
50public: 58public:
51 explicit NextWindowCmd(int option, std::string &pat): 59 explicit NextWindowCmd(int option, std::string &pat):