aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkt <markt>2007-05-23 16:07:58 (GMT)
committermarkt <markt>2007-05-23 16:07:58 (GMT)
commite3787efd9f69b036b424ccf451fe617f4f6aa1e5 (patch)
treee434b08dd443123e4a201dacf5ab855701798848
parent4e0eb904385b06271e0a41b1e46bcc2d94bc2896 (diff)
downloadfluxbox-e3787efd9f69b036b424ccf451fe617f4f6aa1e5.zip
fluxbox-e3787efd9f69b036b424ccf451fe617f4f6aa1e5.tar.bz2
added :attach command
-rw-r--r--ChangeLog4
-rw-r--r--src/FbCommandFactory.cc6
-rw-r--r--src/WorkspaceCmd.cc26
-rw-r--r--src/WorkspaceCmd.hh8
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 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.1: 2Changes for 1.1:
3*07/05/23:
4 * Added key command :Attach <pattern> which groups all windows matching the
5 given pattern (Mark)
6 FbCommandFactory.cc WorkspaceCmd.cc/hh
3*07/05/20: 7*07/05/20:
4 * Added resources session.screen<N>.maxDisable{Move,Resize}: <boolean>, which 8 * Added resources session.screen<N>.maxDisable{Move,Resize}: <boolean>, which
5 prevent maximized windows from being moved/resized (Mark) 9 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() {
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):