From 9cace1f2cb9a082408e49e668bd02a16a016cd6e Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 11 Jan 2007 19:22:46 +0000 Subject: add feature to minimize windows in current layer --- ChangeLog | 4 ++++ src/FbCommandFactory.cc | 12 +++++++++--- src/WorkspaceCmd.cc | 13 +++++++++++++ src/WorkspaceCmd.hh | 4 ++++ 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c6160e..d1a6732 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ (Format: Year/Month/Day) Changes for 1.0rc3: +*07/01/11: + * Added option to :Minimize key command to lower all windows in the same + layer as the focused window -- syntax is `:Minimize (layer)' (Mark) + FbCommandFactory.cc WorkspaceCmd.cc/hh *07/01/08: * Fix another 64-bit window property (Mark/Simon) FbTk/FbWindow.cc diff --git a/src/FbCommandFactory.cc b/src/FbCommandFactory.cc index 6fe5e11..ece8c9e 100644 --- a/src/FbCommandFactory.cc +++ b/src/FbCommandFactory.cc @@ -233,9 +233,15 @@ FbTk::Command *FbCommandFactory::stringToCommand(const std::string &command, // else if (command == "fullscreen") return new FullscreenCmd(); - else if (command == "minimizewindow" || command == "minimize" || command == "iconify") - return new CurrentWindowCmd(&FluxboxWindow::iconify); - else if (command == "maximizewindow" || command == "maximize") + else if (command == "minimizewindow" || command == "minimize" || command == "iconify") { + string cmd; + if (FbTk::StringUtil::getStringBetween(cmd, arguments.c_str() + + 0, '(', ')', " \t\n", true) + && cmd == "layer") + return new MinimizeLayerCmd(); + else + return new CurrentWindowCmd(&FluxboxWindow::iconify); + } else if (command == "maximizewindow" || command == "maximize") return new CurrentWindowCmd(&FluxboxWindow::maximizeFull); else if (command == "maximizevertical") return new CurrentWindowCmd(&FluxboxWindow::maximizeVertical); diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 204d1b9..6c97808 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -255,6 +255,19 @@ void ShowDesktopCmd::execute() { std::mem_fun(&FluxboxWindow::iconify)); } +void MinimizeLayerCmd::execute() { + FluxboxWindow *win = FocusControl::focusedFbWindow(); + if (!win) + return; + + Workspace::Windows windows(win->screen().currentWorkspace()->windowList()); + Workspace::Windows::iterator it = windows.begin(), it_end = windows.end(); + for (; it != it_end; ++it) { + if (win->layerNum() == (*it)->layerNum()) + (*it)->iconify(); + } +} + void CloseAllWindowsCmd::execute() { BScreen *screen = Fluxbox::instance()->mouseScreen(); if (screen == 0) diff --git a/src/WorkspaceCmd.hh b/src/WorkspaceCmd.hh index 1e5b04d..7d8d9e6 100644 --- a/src/WorkspaceCmd.hh +++ b/src/WorkspaceCmd.hh @@ -104,6 +104,10 @@ public: void execute(); }; +class MinimizeLayerCmd: public FbTk::Command { +public: + void execute(); +}; class CloseAllWindowsCmd: public FbTk::Command { public: -- cgit v0.11.2