aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/WorkspaceCmd.cc39
-rw-r--r--src/WorkspaceCmd.hh8
2 files changed, 47 insertions, 0 deletions
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 6422c3f..3a1a3b4 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -23,6 +23,7 @@
23#include "WorkspaceCmd.hh" 23#include "WorkspaceCmd.hh"
24 24
25#include "Layer.hh" 25#include "Layer.hh"
26#include "MinOverlapPlacement.hh"
26#include "Workspace.hh" 27#include "Workspace.hh"
27#include "Window.hh" 28#include "Window.hh"
28#include "Screen.hh" 29#include "Screen.hh"
@@ -203,6 +204,8 @@ FbTk::Command<void> *parseWindowList(const string &command,
203 } else if (command == "arrangewindowsstackbottom") { 204 } else if (command == "arrangewindowsstackbottom") {
204 int method = ArrangeWindowsCmd::STACKBOTTOM; 205 int method = ArrangeWindowsCmd::STACKBOTTOM;
205 return new ArrangeWindowsCmd(method,pat); 206 return new ArrangeWindowsCmd(method,pat);
207 } else if (command == "unclutter") {
208 return new UnclutterCmd(pat);
206 } 209 }
207 210
208 return 0; 211 return 0;
@@ -220,6 +223,7 @@ REGISTER_COMMAND_PARSER(arrangewindowsstackleft, parseWindowList, void);
220REGISTER_COMMAND_PARSER(arrangewindowsstackright, parseWindowList, void); 223REGISTER_COMMAND_PARSER(arrangewindowsstackright, parseWindowList, void);
221REGISTER_COMMAND_PARSER(arrangewindowsstacktop, parseWindowList, void); 224REGISTER_COMMAND_PARSER(arrangewindowsstacktop, parseWindowList, void);
222REGISTER_COMMAND_PARSER(arrangewindowsstackbottom, parseWindowList, void); 225REGISTER_COMMAND_PARSER(arrangewindowsstackbottom, parseWindowList, void);
226REGISTER_COMMAND_PARSER(unclutter, parseWindowList, void);
223 227
224} // end anonymous namespace 228} // end anonymous namespace
225 229
@@ -588,6 +592,41 @@ void ArrangeWindowsCmd::execute() {
588 } 592 }
589} 593}
590 594
595void UnclutterCmd::execute() {
596 BScreen *screen = Fluxbox::instance()->mouseScreen();
597 if (screen == 0)
598 return;
599
600 Workspace *space = screen->currentWorkspace();
601
602 if (space->windowList().empty())
603 return;
604
605 const int head = screen->getCurrHead();
606 Workspace::Windows::iterator win;
607 Workspace::Windows placed_windows;
608
609 // list and clean up
610 for (win = space->windowList().begin(); win != space->windowList().end(); ++win) {
611 int winhead = screen->getHead((*win)->fbWindow());
612 if ((winhead == head || winhead == 0) && m_pat.match(**win)) {
613 placed_windows.push_back(*win);
614 (*win)->move(-(*win)->width(), -(*win)->height());
615 }
616 }
617
618 if (placed_windows.empty())
619 return;
620
621 // place
622 MinOverlapPlacement mopp;
623 int x, y;
624 for (win = placed_windows.begin(); win != placed_windows.end(); ++win) {
625 mopp.placeWindow(**win, head, x, y);
626 (*win)->move(x, y);
627 }
628}
629
591REGISTER_COMMAND(showdesktop, ShowDesktopCmd, void); 630REGISTER_COMMAND(showdesktop, ShowDesktopCmd, void);
592 631
593void ShowDesktopCmd::execute() { 632void ShowDesktopCmd::execute() {
diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh
index b118d02..4f294fe 100644
--- a/src/WorkspaceCmd.hh
+++ b/src/WorkspaceCmd.hh
@@ -187,6 +187,14 @@ private:
187 const ClientPattern m_pat; 187 const ClientPattern m_pat;
188}; 188};
189 189
190class UnclutterCmd: public FbTk::Command<void> {
191public:
192 explicit UnclutterCmd(std::string &pat): m_pat(pat.c_str()) { }
193 void execute();
194private:
195 const ClientPattern m_pat;
196};
197
190class ShowDesktopCmd: public FbTk::Command<void> { 198class ShowDesktopCmd: public FbTk::Command<void> {
191public: 199public:
192 void execute(); 200 void execute();