summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h1
-rw-r--r--mcwm.c28
-rw-r--r--mcwm.man73
3 files changed, 68 insertions, 34 deletions
diff --git a/config.h b/config.h
index e843b91..bb1678f 100644
--- a/config.h
+++ b/config.h
@@ -91,3 +91,4 @@
#define USERKEY_DELETE XK_End
#define USERKEY_PREVSCREEN XK_comma
#define USERKEY_NEXTSCREEN XK_period
+#define USERKEY_ICONIFY XK_I
diff --git a/mcwm.c b/mcwm.c
index dcf6612..b95240e 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -127,6 +127,7 @@ typedef enum {
KEY_END,
KEY_PREVSCR,
KEY_NEXTSCR,
+ KEY_ICONIFY,
KEY_MAX
} key_enum_t;
@@ -254,7 +255,8 @@ struct keys
{ USERKEY_BOTRIGHT, 0 },
{ USERKEY_DELETE, 0 },
{ USERKEY_PREVSCREEN, 0 },
- { USERKEY_NEXTSCREEN, 0 },
+ { USERKEY_NEXTSCREEN, 0 },
+ { USERKEY_ICONIFY, 0 },
};
/* All keycodes generating our MODKEY mask. */
@@ -346,6 +348,7 @@ static void setborders(struct client *client, int width);
static void unmax(struct client *client);
static void maximize(struct client *client);
static void maxvert(struct client *client);
+static void hide(struct client *client);
static bool getpointer(xcb_drawable_t win, int16_t *x, int16_t *y);
static bool getgeom(xcb_drawable_t win, int16_t *x, int16_t *y, uint16_t *width,
uint16_t *height);
@@ -2624,6 +2627,22 @@ void maxvert(struct client *client)
client->vertmaxed = true;
}
+void hide(struct client *client)
+{
+ long data[] = { XCB_ICCCM_WM_STATE_ICONIC, XCB_NONE };
+
+ /*
+ * Unmap window and declare iconic.
+ *
+ * Unmapping will generate an even UnmapNotify event so we can
+ * forget about the window later.
+ */
+ xcb_unmap_window(conn, client->id);
+ xcb_change_property(conn, XCB_PROP_MODE_REPLACE, client->id,
+ wm_state, wm_state, 32, 2, data);
+ xcb_flush(conn);
+}
+
bool getpointer(xcb_drawable_t win, int16_t *x, int16_t *y)
{
xcb_query_pointer_reply_t *pointer;
@@ -3112,6 +3131,13 @@ void handle_keypress(xcb_key_press_event_t *ev)
nextscreen();
break;
+ case KEY_ICONIFY:
+ if (conf.allowicons)
+ {
+ hide(focuswin);
+ }
+ break;
+
default:
/* Ignore other keys. */
break;
diff --git a/mcwm.man b/mcwm.man
index 1ef4864..c2b5eaa 100644
--- a/mcwm.man
+++ b/mcwm.man
@@ -74,44 +74,57 @@ Note that the mouse cursor needs to be inside the window you want to
move, raise/lower or resize even if it currently has the focus. This
is a feature, not a bug.
.PP
-Mod4 + key:
+Mod4 + key on focused window:
.RS
.IP \(bu 2
.B r
-raise or lower (toggles)
+raise or lower (toggles).
.IP \(bu 2
.B x
-maximize (toggles)
+maximize (toggles).
.IP \(bu 2
.B m
-maximize vertically (toggles)
+maximize vertically (toggles).
+.IP \(bu 2
+.B H
+resize left.
+.IP \(bu 2
+.B J
+resize down.
+.IP \(bu 2
+.B K
+resize up.
+.IP \(bu 2
+.B L
+resize right.
.IP \(bu 2
.B h
-move left
+move left.
.IP \(bu 2
.B j
-move down
+move down.
.IP \(bu 2
.B k
-move up
+move up.
.IP \(bu 2
.B l
-move right
+move right.
.IP \(bu 2
-.B H
-resize left
+.B y
+move to upper left corner of physical screen.
.IP \(bu 2
-.B J
-resize down
+.B u
+move to upper right corner of physical screen.
.IP \(bu 2
-.B K
-resize up
+.B b
+move to lower left corner of physical screen.
.IP \(bu 2
-.B L
-resize right
+.B n
+move to lower right corner of physical screen.
.IP \(bu 2
.B Return
-start terminal
+start terminal or whatever program you have configured with -t or in
+the config.h.
.IP \(bu 2
.B Tab
go to next window in the current workspace window ring. If you release
@@ -120,28 +133,22 @@ window. A new press of MODKEY + Tab will bring you back to the window
where you last had focus.
.IP \(bu 2
.B f
-fix window so it is visible on all workspaces. Toggles. Press again to
-unfix window. Also used to move windows between workspaces: First fix
-the window, change to the workspace you want, then unfix the window on
-the new workspace.
-.IP \(bu 2
-.B y
-move to upper left corner of physical screen.
-.IP \(bu 2
-.B u
-move to upper right corner of physical screen..
+fix window so it is visible on all workspaces (toggles). Press again
+to unfix window. Also used to move windows between workspaces: First
+fix the window, change to the workspace you want, then unfix the
+window on the new workspace.
.IP \(bu 2
-.B b
-move to lower left corner of physical screen..
-.IP \(bu 2
-.B n
-move to lower right corner of physical screen..
+.B i
+iconify (or hide) window from the display. Only usable when mcwm has
+been started with -i. Currently there is no way to get a hidden window
+back. You have to use an external program such as a panel or the 9icon
+script in the mcwm distribution.
.IP \(bu 2
.B 0\-9
go to workspace n, 0-9.
.IP \(bu 2
.B End
-close focused window.
+close window.
.IP \(bu 2
.B ,
move window to previous physical screen.