aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/WorkspaceCmd.cc22
-rw-r--r--src/WorkspaceCmd.hh3
2 files changed, 13 insertions, 12 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index aba5914..4bd9c7e 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -173,7 +173,8 @@ FbTk::Command<void> *parseWindowList(const string &command,
173 else if (command == "prevgroup") { 173 else if (command == "prevgroup") {
174 opts |= FocusableList::LIST_GROUPS; 174 opts |= FocusableList::LIST_GROUPS;
175 return new PrevWindowCmd(opts, pat); 175 return new PrevWindowCmd(opts, pat);
176 } 176 } else if (command == "arrangewindows")
177 return new ArrangeWindowsCmd(pat);
177 return 0; 178 return 0;
178} 179}
179 180
@@ -182,6 +183,7 @@ REGISTER_COMMAND_PARSER(nextwindow, parseWindowList, void);
182REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void); 183REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void);
183REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void); 184REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void);
184REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void); 185REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void);
186REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void);
185 187
186}; // end anonymous namespace 188}; // end anonymous namespace
187 189
@@ -353,8 +355,6 @@ void JumpToWorkspaceCmd::execute() {
353 } 355 }
354} 356}
355 357
356REGISTER_COMMAND(arrangewindows, ArrangeWindowsCmd, void);
357
358/** 358/**
359 try to arrange the windows on the current workspace in a 'clever' way. 359 try to arrange the windows on the current workspace in a 'clever' way.
360 we take the shaded-windows and put them ontop of the workspace and put the 360 we take the shaded-windows and put them ontop of the workspace and put the
@@ -366,9 +366,8 @@ void ArrangeWindowsCmd::execute() {
366 return; 366 return;
367 367
368 Workspace *space = screen->currentWorkspace(); 368 Workspace *space = screen->currentWorkspace();
369 size_t win_count = space->windowList().size();
370 369
371 if (win_count == 0) 370 if (space->windowList().empty())
372 return; 371 return;
373 372
374 // TODO: choice between 373 // TODO: choice between
@@ -382,20 +381,19 @@ void ArrangeWindowsCmd::execute() {
382 Workspace::Windows shaded_windows; 381 Workspace::Windows shaded_windows;
383 for(win = space->windowList().begin(); win != space->windowList().end(); win++) { 382 for(win = space->windowList().begin(); win != space->windowList().end(); win++) {
384 int winhead = screen->getHead((*win)->fbWindow()); 383 int winhead = screen->getHead((*win)->fbWindow());
385 if (winhead == head || winhead == 0) { 384 if ((winhead == head || winhead == 0) && m_pat.match(**win)) {
386 if (!(*win)->isShaded()) 385 if ((*win)->isShaded())
387 normal_windows.push_back(*win);
388 else
389 shaded_windows.push_back(*win); 386 shaded_windows.push_back(*win);
387 else
388 normal_windows.push_back(*win);
390 } 389 }
391 } 390 }
392 391
393 // to arrange only shaded windows is a bit pointless imho (mathias) 392 // to arrange only shaded windows is a bit pointless imho (mathias)
394 if (normal_windows.size() == 0) 393 size_t win_count = normal_windows.size();
394 if (win_count == 0)
395 return; 395 return;
396 396
397 win_count = normal_windows.size();
398
399 const unsigned int max_width = screen->maxRight(head) - screen->maxLeft(head); 397 const unsigned int max_width = screen->maxRight(head) - screen->maxLeft(head);
400 unsigned int max_height = screen->maxBottom(head) - screen->maxTop(head); 398 unsigned int max_height = screen->maxBottom(head) - screen->maxTop(head);
401 399
diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh
index d50c0bf..ad63d04 100644
--- a/src/WorkspaceCmd.hh
+++ b/src/WorkspaceCmd.hh
@@ -170,7 +170,10 @@ private:
170/// arranges windows in current workspace to rows and columns 170/// arranges windows in current workspace to rows and columns
171class ArrangeWindowsCmd: public FbTk::Command<void> { 171class ArrangeWindowsCmd: public FbTk::Command<void> {
172public: 172public:
173 ArrangeWindowsCmd(std::string &pat): m_pat(pat.c_str()) { }
173 void execute(); 174 void execute();
175private:
176 const ClientPattern m_pat;
174}; 177};
175 178
176class ShowDesktopCmd: public FbTk::Command<void> { 179class ShowDesktopCmd: public FbTk::Command<void> {