From f1f7bebf3722a24f0386424cb773e647bc6f5826 Mon Sep 17 00:00:00 2001 From: John K Pate Date: Mon, 13 Sep 2010 22:58:59 +0100 Subject: added 'ArrangeWindowsVertical' to actions --- doc/asciidoc/fluxbox-keys.txt | 10 ++++++---- src/WorkspaceCmd.cc | 17 ++++++++++++++--- src/WorkspaceCmd.hh | 9 ++++++++- 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. *FocusLeft* / *FocusRight* / *FocusUp* / *FocusDown*:: Focus to the next window which is located in the direction specified. -*ArrangeWindows* 'pattern':: - Tries to arrange all windows on the current workspace so that they - overlap the least amount possible. See *CLIENT PATTERNS* for more about - the 'pattern' arguments. +*ArrangeWindows* 'pattern' / *ArrangeWindowsVertical* 'pattern' / *ArrangeWindowsHorizontal* 'pattern':: + Tries to arrange all windows on the current workspace so that they overlap the + least amount possible. *ArrangeWindowsVertical* prefers vertical splits + (windows side by side), whereas *ArrangeWindowsHorizontal* prefers horizontal + splits (windows on top of eachother). See *CLIENT PATTERNS* for more about the + 'pattern' arguments. *ShowDesktop*:: 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 *parseWindowList(const string &command, else if (command == "prevgroup") { opts |= FocusableList::LIST_GROUPS; return new PrevWindowCmd(opts, pat); - } else if (command == "arrangewindows") - return new ArrangeWindowsCmd(pat); + } else if (command == "arrangewindows") { + int method = ArrangeWindowsCmd::UNSPECIFIED; + return new ArrangeWindowsCmd(method,pat); + } else if (command == "arrangewindowsvertical") { + int method = ArrangeWindowsCmd::VERTICAL; + return new ArrangeWindowsCmd(method,pat); + } else if (command == "arrangewindowshorizontal") { + int method = ArrangeWindowsCmd::HORIZONTAL; + return new ArrangeWindowsCmd(method,pat); + } return 0; } @@ -188,6 +196,8 @@ REGISTER_COMMAND_PARSER(nextgroup, parseWindowList, void); REGISTER_COMMAND_PARSER(prevwindow, parseWindowList, void); REGISTER_COMMAND_PARSER(prevgroup, parseWindowList, void); REGISTER_COMMAND_PARSER(arrangewindows, parseWindowList, void); +REGISTER_COMMAND_PARSER(arrangewindowsvertical, parseWindowList, void); +REGISTER_COMMAND_PARSER(arrangewindowshorizontal, parseWindowList, void); } // end anonymous namespace @@ -404,7 +414,8 @@ void ArrangeWindowsCmd::execute() { // try to get the same number of rows as columns. unsigned int cols = int(sqrt((float)win_count)); // truncate to lower unsigned int rows = int(0.99 + float(win_count) / float(cols)); - if (max_width { public: - ArrangeWindowsCmd(std::string &pat): m_pat(pat.c_str()) { } + enum { + UNSPECIFIED, + VERTICAL, + HORIZONTAL + }; + explicit ArrangeWindowsCmd(int tile_method, std::string &pat): + m_tile_method( tile_method ), m_pat(pat.c_str()) { } void execute(); private: + const int m_tile_method; const ClientPattern m_pat; }; -- cgit v0.11.2