aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/asciidoc/fluxbox-keys.txt10
-rw-r--r--src/WorkspaceCmd.cc17
-rw-r--r--src/WorkspaceCmd.hh9
3 files changed, 28 insertions, 8 deletions
diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt
index 16bc18c..69e17db 100644
--- a/doc/asciidoc/fluxbox-keys.txt
+++ b/doc/asciidoc/fluxbox-keys.txt
@@ -395,10 +395,12 @@ doing so.
395*FocusLeft* / *FocusRight* / *FocusUp* / *FocusDown*:: 395*FocusLeft* / *FocusRight* / *FocusUp* / *FocusDown*::
396 Focus to the next window which is located in the direction specified. 396 Focus to the next window which is located in the direction specified.
397 397
398*ArrangeWindows* 'pattern':: 398*ArrangeWindows* 'pattern' / *ArrangeWindowsVertical* 'pattern' / *ArrangeWindowsHorizontal* 'pattern'::
399 Tries to arrange all windows on the current workspace so that they 399 Tries to arrange all windows on the current workspace so that they overlap the
400 overlap the least amount possible. See *CLIENT PATTERNS* for more about 400 least amount possible. *ArrangeWindowsVertical* prefers vertical splits
401 the 'pattern' arguments. 401 (windows side by side), whereas *ArrangeWindowsHorizontal* prefers horizontal
402 splits (windows on top of eachother). See *CLIENT PATTERNS* for more about the
403 'pattern' arguments.
402 404
403*ShowDesktop*:: 405*ShowDesktop*::
404 Minimizes all windows on the current workspace. If they are already all 406 Minimizes all windows on the current workspace. If they are already all
diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc
index 6267671..168a56d 100644
--- a/src/WorkspaceCmd.cc
+++ b/src/WorkspaceCmd.cc
@@ -177,8 +177,16 @@ FbTk::Command<void> *parseWindowList(const string &command,
177 else if (command == "prevgroup") { 177 else if (command == "prevgroup") {
178 opts |= FocusableList::LIST_GROUPS; 178 opts |= FocusableList::LIST_GROUPS;
179 return new PrevWindowCmd(opts, pat); 179 return new PrevWindowCmd(opts, pat);
180 } else if (command == "arrangewindows") 180 } else if (command == "arrangewindows") {
181 return new ArrangeWindowsCmd(pat); 181 int method = ArrangeWindowsCmd::UNSPECIFIED;
182 return new ArrangeWindowsCmd(method,pat);
183 } else if (command == "arrangewindowsvertical") {
184 int method = ArrangeWindowsCmd::VERTICAL;
185 return new ArrangeWindowsCmd(method,pat);
186 } else if (command == "arrangewindowshorizontal") {
187 int method = ArrangeWindowsCmd::HORIZONTAL;
188 return new ArrangeWindowsCmd(method,pat);
189 }
182 return 0; 190 return 0;
183} 191}
184 192
@@ -188,6 +196,8 @@ REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void);
188REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void); 196REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void);
189REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void); 197REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void);
190REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void); 198REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void);
199REGISTER_COMMAND_PARSER(arrangewindowsvertical, parseWindowList, void);
200REGISTER_COMMAND_PARSER(arrangewindowshorizontal, parseWindowList, void);
191 201
192} // end anonymous namespace 202} // end anonymous namespace
193 203
@@ -404,7 +414,8 @@ void ArrangeWindowsCmd::execute() {
404 // try to get the same number of rows as columns. 414 // try to get the same number of rows as columns.
405 unsigned int cols = int(sqrt((float)win_count)); // truncate to lower 415 unsigned int cols = int(sqrt((float)win_count)); // truncate to lower
406 unsigned int rows = int(0.99 + float(win_count) / float(cols)); 416 unsigned int rows = int(0.99 + float(win_count) / float(cols));
407 if (max_width<max_height) { // rotate 417 if ( (m_tile_method == VERTICAL) || // rotate if the user has asked for it or automagically
418 ( (m_tile_method == UNSPECIFIED) && (max_width<max_height)) ) {
408 std::swap(cols, rows); 419 std::swap(cols, rows);
409 } 420 }
410 421
diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh
index ad63d04..f4f90a6 100644
--- a/src/WorkspaceCmd.hh
+++ b/src/WorkspaceCmd.hh
@@ -170,9 +170,16 @@ 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 enum {
174 UNSPECIFIED,
175 VERTICAL,
176 HORIZONTAL
177 };
178 explicit ArrangeWindowsCmd(int tile_method, std::string &pat):
179 m_tile_method( tile_method ), m_pat(pat.c_str()) { }
174 void execute(); 180 void execute();
175private: 181private:
182 const int m_tile_method;
176 const ClientPattern m_pat; 183 const ClientPattern m_pat;
177}; 184};
178 185