AllMinimizeKey - minimize all windows on current workspace.
Original-patch-by: Pavel S. Khmelinsky <[email protected]>
Signed-off-by: Alexey I. Froloff <[email protected]>
---
src/actions.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
src/actions.h | 1 +
src/defaults.c | 2 ++
src/event.c | 4 ++++
src/keybind.h | 1 +
5 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index 282bfc1..f8339b1 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1216,6 +1216,54 @@ static void hideWindow(WIcon *icon, int icon_x, int
icon_y, WWindow *wwin, int a
WMPostNotificationName(WMNChangedState, wwin, "hide");
}
+void wHideAll(WScreen *scr)
+{
+ WWindow *wwin;
+ WWindow **windows;
+ Window FocusedWin;
+ WMenu *menu;
+ unsigned int wcount = 0;
+ int FocusState;
+ int i;
+
+ if (!scr)
+ return;
+
+ menu = scr->switch_menu;
+
+ windows = malloc(sizeof(WWindow *));
+
+ if (menu != NULL) {
+ for (i=0; i<menu->entry_no; i++) {
+ windows[wcount] = (WWindow *)
menu->entries[i]->clientdata;
+ wcount++;
+ windows = realloc(windows, sizeof(WWindow *) *
(wcount+1));
+ }
+ } else {
+ wwin = scr->focused_window;
+
+ while (wwin) {
+ windows[wcount] = wwin;
+ wcount++;
+ windows = realloc(windows, sizeof(WWindow *) *
(wcount+1));
+ wwin = wwin->prev;
+
+ }
+ }
+
+ for (i=0; i < wcount; i++) {
+ wwin = windows[i];
+ if (wwin->frame->workspace == scr->current_workspace
+ && !(wwin->flags.miniaturized||wwin->flags.hidden)
+ && !wwin->flags.internal_window
+ && !WFLAGP(wwin, no_miniaturizable)
+ ) {
+ wwin->flags.skip_next_animation = 1;
+ wIconifyWindow(wwin);
+ }
+ }
+}
+
void wHideOtherApplications(WWindow *awin)
{
WWindow *wwin;
diff --git a/src/actions.h b/src/actions.h
index 382cb21..2dc1459 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -53,6 +53,7 @@ void wUnselectWindows(WScreen *scr);
void wMaximizeWindow(WWindow *wwin, int directions);
void wUnmaximizeWindow(WWindow *wwin);
+void wHideAll(WScreen *src);
void wHideOtherApplications(WWindow *wwin);
void wShowAllWindows(WScreen *scr);
diff --git a/src/defaults.c b/src/defaults.c
index 88a38bc..2735ef1 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -529,6 +529,8 @@ WDefaultEntry optionList[] = {
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE,
NULL, getKeybind, setKeyGrab, NULL, NULL},
+ {"AllMinimizeKey", "None", (void*)WKBD_ALLMINIMIZE,
+ NULL, getKeybind, setKeyGrab, NULL, NULL },
{"HideKey", "None", (void *)WKBD_HIDE,
NULL, getKeybind, setKeyGrab, NULL, NULL},
{"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS,
diff --git a/src/event.c b/src/event.c
index 4bc5d4f..180e229 100644
--- a/src/event.c
+++ b/src/event.c
@@ -1402,6 +1402,10 @@ static void handleKeyPress(XEvent * event)
if (ISMAPPED(wwin) && ISFOCUSED(wwin))
OpenWindowMenu(wwin, wwin->frame_x, wwin->frame_y +
wwin->frame->top_width, True);
break;
+ case WKBD_ALLMINIMIZE:
+ CloseWindowMenu(scr);
+ wHideAll(scr);
+ break;
case WKBD_MINIATURIZE:
if (ISMAPPED(wwin) && ISFOCUSED(wwin)
&& !WFLAGP(wwin, no_miniaturizable)) {
diff --git a/src/keybind.h b/src/keybind.h
index 6c7cc15..18cb962 100644
--- a/src/keybind.h
+++ b/src/keybind.h
@@ -30,6 +30,7 @@ enum {
/* window */
WKBD_MINIATURIZE,
+ WKBD_ALLMINIMIZE,
WKBD_HIDE,
WKBD_HIDE_OTHERS,
WKBD_MAXIMIZE,
--
1.7.2.3
--
To unsubscribe, send mail to [email protected].