aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xdeadzone.163
-rw-r--r--xdeadzone.c29
-rw-r--r--xdeadzone.rst62
3 files changed, 80 insertions, 74 deletions
diff --git a/xdeadzone.1 b/xdeadzone.1
index 3981861..abb9051 100644
--- a/xdeadzone.1
+++ b/xdeadzone.1
@@ -64,29 +64,11 @@ it anyway.
environments, and works properly with at least: KDE (Plasma 5), XFCE
4, Fmwv2, WindowMaker, BlackBox, and FluxBox.
.SH OPTIONS
-.SS Optional arguments
-.INDENT 0.0
-.TP
-.B \-\-help
-Print built\-in help message and exit.
-.TP
-.B \-\-version
-Print the application name and version number, and exit.
-.UNINDENT
-.INDENT 0.0
-.TP
-.B \fB\-i\fP
-Make window invisible. This is the default.
-.TP
-.B \fB\-b\fP
-Make window visible, display as a black rectangle.
-.TP
-.B \fB\-w\fP
-Make window visible, display as a white rectangle.
-.UNINDENT
+.sp
+Options can appear in any order on the command line.
.SS Modes
.sp
-One mode argument is required.
+One (and only one) mode option is required.
.INDENT 0.0
.TP
.B \fB\-nw\fP
@@ -116,6 +98,35 @@ treated as offsets from the right/bottom of the display.
.sp
Examples: \fB200x100\fP, \fB64x64\-0\-0\fP, \fB50x60+100+100\fP\&.
.UNINDENT
+.SS Appearance options
+.sp
+These are optional, and control how \fBxdeadzone\fP\(aqs window will
+look and behave.
+.INDENT 0.0
+.TP
+.B \fB\-i\fP
+Make window invisible. This is the default.
+.TP
+.B \fB\-b\fP
+Make window visible, display as a black rectangle.
+.TP
+.B \fB\-w\fP
+Make window visible, display as a white rectangle.
+.TP
+.B \fB\-n\fP
+Create window as a normal window, with titlebar and without
+appearing on all desktops. Implies \fB\-w\fP, but can be followed
+by \fB\-b\fP for a black rectangle.
+.UNINDENT
+.SS Informational options
+.INDENT 0.0
+.TP
+.B \-\-help
+Print built\-in help, then exit.
+.TP
+.B \-\-version
+Print the application name and version number, then exit.
+.UNINDENT
.SH ENVIRONMENT
.INDENT 0.0
.TP
@@ -170,16 +181,6 @@ xdeadzone \-ne 640x1024 &
.sp
If the dead zone were on the left of the top monitor, you\(aqd use \fB\-nw\fP instead
of \fB\-ne\fP\&.
-.SH BUGS
-.sp
-There isn\(aqt much error\-checking for the numeric arguments. Anything
-non\-numeric will be read as zero. If you include a decimal point,
-that should be an error, but instead it\(aqs silently ignored (the value
-is truncated).
-.sp
-Maybe it should background (daemonize) itself. However, it works
-fine with & to background it, and this is pretty common practice for
-starting X software from ~/.xinitrc.
.SH COPYRIGHT
.sp
WTFPL. Do WTF you want to with this.
diff --git a/xdeadzone.c b/xdeadzone.c
index b05a2ac..e3446f9 100644
--- a/xdeadzone.c
+++ b/xdeadzone.c
@@ -47,7 +47,7 @@ void usage(const int ret) {
banner();
printf(
"Usage:\n %s "
- "<[-b | -w | -i]> [-nw | -ne | -sw | -se | -abs] <geometry>\n\n"
+ "<-b | -w | -i> <-n> [-nw | -ne | -sw | -se | -abs] [geometry]\n\n"
" <geometry> is WxH for all modes but -abs, or\n WxH[+-]xpos[+-]ypos for -abs\n",
exe_name);
exit(ret);
@@ -75,7 +75,7 @@ int main(int argc, char **argv) {
XWindowAttributes attr;
XSetWindowAttributes setattr;
- int x = -1, y = -1, gflags = -1, visible = 0, black = 0, mode = M_UNSET;
+ int x = -1, y = -1, gflags = -1, visible = 0, black = 0, mode = M_UNSET, normal_window = 0;
unsigned int width, height;
set_exe_name(argv[0]);
@@ -97,6 +97,9 @@ int main(int argc, char **argv) {
black = 0;
} else if(streq(a, "-i")) {
visible = 0;
+ } else if(streq(a, "-n")) {
+ visible = 1;
+ normal_window = 1;
} else if(streq(a, "-abs")) {
check_mode(mode);
mode = M_ABS;
@@ -173,7 +176,7 @@ int main(int argc, char **argv) {
In actual use, the window won't be visible, it'll be in the dead zone,
right?
*/
- setattr.override_redirect = True;
+ setattr.override_redirect = normal_window ? False : True;
if(visible) {
setattr.background_pixel = black ?
BlackPixel(d, DefaultScreen(d)) :
@@ -201,15 +204,17 @@ int main(int argc, char **argv) {
care of that with override_redirect, above.
ref: http://standards.freedesktop.org/wm-spec/wm-spec-latest.html
*/
- dock_atom = XInternAtom(d, "_NET_WM_WINDOW_TYPE_DOCK", False);
- XChangeProperty(d,
- w,
- XInternAtom(d, "_NET_WM_WINDOW_TYPE", False),
- XA_ATOM,
- 32,
- PropModeReplace,
- (unsigned char *) &dock_atom,
- 1);
+ if(!normal_window) {
+ dock_atom = XInternAtom(d, "_NET_WM_WINDOW_TYPE_DOCK", False);
+ XChangeProperty(d,
+ w,
+ XInternAtom(d, "_NET_WM_WINDOW_TYPE", False),
+ XA_ATOM,
+ 32,
+ PropModeReplace,
+ (unsigned char *) &dock_atom,
+ 1);
+ }
XMapWindow(d, w);
diff --git a/xdeadzone.rst b/xdeadzone.rst
index 5b39f46..909da79 100644
--- a/xdeadzone.rst
+++ b/xdeadzone.rst
@@ -53,29 +53,12 @@ environments, and works properly with at least: KDE (Plasma 5), XFCE
OPTIONS
=======
-Optional arguments
-------------------
-
---help
- Print built-in help message and exit.
-
---version
- Print the application name and version number, and exit.
-
-**-i**
- Make window invisible. This is the default.
-
-**-b**
- Make window visible, display as a black rectangle.
-
-**-w**
- Make window visible, display as a white rectangle.
-
+Options can appear in any order on the command line.
Modes
-----
-One mode argument is required.
+One (and only one) mode option is required.
**-nw**
Place window at northwest (top left) corner of display.
@@ -104,6 +87,35 @@ Required argument
Examples: **200x100**, **64x64-0-0**, **50x60+100+100**.
+Appearance options
+------------------
+
+These are optional, and control how **xdeadzone**'s window will
+look and behave.
+
+**-i**
+ Make window invisible. This is the default.
+
+**-b**
+ Make window visible, display as a black rectangle.
+
+**-w**
+ Make window visible, display as a white rectangle.
+
+**-n**
+ Create window as a normal window, with titlebar and without
+ appearing on all desktops. Implies **-w**, but can be followed
+ by **-b** for a black rectangle.
+
+Informational options
+---------------------
+
+--help
+ Print built-in help, then exit.
+
+--version
+ Print the application name and version number, then exit.
+
ENVIRONMENT
===========
@@ -146,18 +158,6 @@ losing the mouse there::
If the dead zone were on the left of the top monitor, you'd use **-nw** instead
of **-ne**.
-BUGS
-====
-
-There isn't much error-checking for the numeric arguments. Anything
-non-numeric will be read as zero. If you include a decimal point,
-that should be an error, but instead it's silently ignored (the value
-is truncated).
-
-Maybe it should background (daemonize) itself. However, it works
-fine with & to background it, and this is pretty common practice for
-starting X software from ~/.xinitrc.
-
COPYRIGHT
=========