summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h6
-rw-r--r--mcwm.c24
-rw-r--r--mcwm.man39
3 files changed, 61 insertions, 8 deletions
diff --git a/config.h b/config.h
index 0291b11..e843b91 100644
--- a/config.h
+++ b/config.h
@@ -33,6 +33,12 @@
#define TERMINAL "urxvt"
/*
+ * Do we allow windows to be iconified? Set to true if you want this
+ * behaviour to be default. Can also be set by calling mcwm with -i.
+ */
+#define ALLOWICONS false
+
+/*
* Start these programs when pressing MODKEY and mouse buttons on root window.
*/
#define MOUSE1 ""
diff --git a/mcwm.c b/mcwm.c
index 45acd23..dc084b0 100644
--- a/mcwm.c
+++ b/mcwm.c
@@ -276,6 +276,7 @@ struct conf
uint32_t focuscol; /* Focused border colour. */
uint32_t unfocuscol; /* Unfocused border colour. */
uint32_t fixedcol; /* Fixed windows border colour. */
+ bool allowicons; /* Allow windows to be unmapped. */
} conf;
xcb_atom_t atom_desktop; /*
@@ -3904,21 +3905,27 @@ void events(void)
break;
case XCB_CLIENT_MESSAGE:
+ {
+ xcb_client_message_event_t *e
+ = (xcb_client_message_event_t *)ev;
+
+ if (conf.allowicons)
{
- xcb_client_message_event_t *e
- = (xcb_client_message_event_t *)ev;
if (e->type == wm_change_state
&& e->format == 32
&& e->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC)
{
- /* Unmap window and declare iconic. */
- xcb_unmap_window(conn, e->window);
long data[] = { XCB_ICCCM_WM_STATE_ICONIC, XCB_NONE };
+
+ /* Unmap window and declare iconic. */
+
+ xcb_unmap_window(conn, e->window);
xcb_change_property(conn, XCB_PROP_MODE_REPLACE, e->window,
wm_state, wm_state, 32, 2, data);
xcb_flush(conn);
}
- }
+ } /* if */
+ }
break;
case XCB_CIRCULATE_REQUEST:
@@ -4071,13 +4078,14 @@ int main(int argc, char **argv)
conf.borderwidth = BORDERWIDTH;
conf.terminal = TERMINAL;
+ conf.allowicons = ALLOWICONS;
focuscol = FOCUSCOL;
unfocuscol = UNFOCUSCOL;
fixedcol = FIXEDCOL;
while (1)
{
- ch = getopt(argc, argv, "b:t:f:u:x:");
+ ch = getopt(argc, argv, "b:it:f:u:x:");
if (-1 == ch)
{
@@ -4092,6 +4100,10 @@ int main(int argc, char **argv)
conf.borderwidth = atoi(optarg);
break;
+ case 'i':
+ conf.allowicons = true;
+ break;
+
case 't':
conf.terminal = optarg;
break;
diff --git a/mcwm.man b/mcwm.man
index 1f4ebf7..e90febe 100644
--- a/mcwm.man
+++ b/mcwm.man
@@ -7,6 +7,9 @@ mcwm \- MC's Window Manager for X11.
.B \-b
] width
[
+.B \-i
+]
+[
.B \-t
.I terminal-program
] [
@@ -27,6 +30,12 @@ mcwm \- MC's Window Manager for X11.
.PP
\-b width sets border width to this many pixels.
.PP
+\-i turns on icons/hidden windows.
+.B Please note
+that there is no way from mcwm to get a hidden window back! You have
+to use an external program such as a dock or the 9icon script (see
+below) to get the window mapped again.
+.PP
\-t urxvt will start urxvt when MODKEY + Return is pressed. Change to
your prefered terminal program or something else entirely.
.PP
@@ -150,7 +159,7 @@ If you don't like the default key bindings, border width, et cetera,
look in the config.h file, change and recompile. In the config.h file
you can also define mouse button actions on the root window. By
default button 3 starts the command mcmenu. You can write your own
-mcmenu by using, for instance, 9menu or ratmenu.
+mcmenu by using, for instance, 9menu, dmenu or ratmenu.
.PP
.SH STARTING
Typically the window manager is started from a script, either run by
@@ -189,7 +198,7 @@ Here's a complete example using the 9menu program:
.in +4
.nf
\&#! /bin/sh
-9menu -bg black -fg white \\
+exec 9menu -bg black -fg white \\
-popup \\
'cpu:urxvt -e ssh cpu.example.org' \\
':' \\
@@ -204,5 +213,31 @@ Here's a complete example using the 9menu program:
.fi
.in -4
.sp
+.PP
+Christian Neukirchen wrote a little script you can use to get
+iconified windows mapped again. It relies on xwininfo and xdotool and
+GNU xargs.
+.sp
+.in +4
+.nf
+\&#! /bin/sh
+# 9icon - show 9menu of iconified windows for unmapping
+
+IFS="
+"
+
+for win in $(xwininfo -root -children | awk '$1~/0x/ && $2~/"/ {print $1}'); do
+ xprop -id $win WM_NAME WM_STATE |
+ awk -F'"' -v win=$win '
+ /^WM_NAME/ { name=$2 }
+ /window state: Iconic/ {
+ print name ":xdotool windowmap " win " windowraise " win
+ }
+ '
+done | xargs -r -d'\\n' \\
+ 9menu -popup -label 9icon -bg grey20 -fg grey80 -font fixed
+.fi
+.in -4
+.sp
.SH AUTHOR
Michael Cardell Widerkrantz <mc@hack.org>.