From 9d71ad9c1477875001ecd19eb4cbbe1c4ba4eb40 Mon Sep 17 00:00:00 2001 From: Mark Tiefenbruck Date: Mon, 4 Aug 2008 22:51:08 -0700 Subject: make ShowDesktop command toggle between showing desktop and windows --- ChangeLog | 2 ++ doc/asciidoc/fluxbox-keys.txt | 3 ++- doc/fluxbox-keys.5 | 2 +- src/WorkspaceCmd.cc | 17 ++++++++++++++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index dceceee..6a76aea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ (Format: Year/Month/Day) Changes for 1.1 *08/08/05: + * Make ShowDesktop command toggle between showing windows and desktop (Mark) + WorkspaceCmd.cc * Created new `fluxbox-keys' man page (thanks Jim Ramsay) doc/asciidoc/fluxbox-keys.txt * Make resize cursors consistent (thanks Dmitry E. Oboukhov) diff --git a/doc/asciidoc/fluxbox-keys.txt b/doc/asciidoc/fluxbox-keys.txt index d9228f7..197e175 100644 --- a/doc/asciidoc/fluxbox-keys.txt +++ b/doc/asciidoc/fluxbox-keys.txt @@ -349,7 +349,8 @@ doing so. the 'pattern' arguments. *ShowDesktop*:: - Iconifies all windows. + Minimizes all windows on the current workspace. If they are already all + minimized, then it restores them. *Deiconify* 'mode' 'destination':: Deiconifies windows (or, restores from a minimized state). diff --git a/doc/fluxbox-keys.5 b/doc/fluxbox-keys.5 index 2f8c7a1..01bbd05 100644 --- a/doc/fluxbox-keys.5 +++ b/doc/fluxbox-keys.5 @@ -460,7 +460,7 @@ arguments\. .PP \fBShowDesktop\fR .RS 4 -Iconifies all windows\. +Minimizes all windows on the current workspace\. If they are already all minimized, then it restores them\. .RE .PP \fBDeiconify\fR \fImode\fR \fIdestination\fR diff --git a/src/WorkspaceCmd.cc b/src/WorkspaceCmd.cc index 4bd9c7e..ef7d992 100644 --- a/src/WorkspaceCmd.cc +++ b/src/WorkspaceCmd.cc @@ -484,12 +484,27 @@ void ShowDesktopCmd::execute() { if (screen == 0) return; + unsigned int count = 0; Workspace::Windows windows(screen->currentWorkspace()->windowList()); Workspace::Windows::iterator it = windows.begin(), it_end = windows.end(); for (; it != it_end; ++it) { - if ((*it)->getWindowType() != Focusable::TYPE_DESKTOP) + if ((*it)->getWindowType() != Focusable::TYPE_DESKTOP) { (*it)->iconify(); + count++; + } + } + + if (count == 0) { + BScreen::Icons icon_list = screen->iconList(); + BScreen::Icons::iterator icon_it = icon_list.begin(); + BScreen::Icons::iterator itend = icon_list.end(); + unsigned int space = screen->currentWorkspaceID(); + + for (; icon_it != itend; ++icon_it) { + if ((*icon_it)->isStuck() || (*icon_it)->workspaceNumber() == space) + (*icon_it)->deiconify(); + } } } -- cgit v0.11.2