aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoetunes <moetunes111@gmail.com>2011-10-23 12:24:40 +1000
committermoetunes <moetunes111@gmail.com>2011-10-23 12:24:40 +1000
commit2aa7e4d8a07d18b0ad3f22d3adc9bfba0a79a4d3 (patch)
treeac36b951ee2e16ac568e9038938195dfa3892dc2
parent7ca237aaf8e4890d4058c3f1e2a148f12b3d20c7 (diff)
Fine tuned how popup windows aren't managed to include notification windows
-rw-r--r--src/ChangeLog3
-rw-r--r--src/README2
-rwxr-xr-xsrc/config.h7
-rw-r--r--src/dminiwm.c67
4 files changed, 65 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4794cb4..fde816c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,6 @@
+23/10/11
+ Fine tuned the popup window management so notification windows aren't managed either
+
15/10/11
Added having applications start on specified desktop
diff --git a/src/README b/src/README
index 22e9234..b86a106 100644
--- a/src/README
+++ b/src/README
@@ -54,7 +54,7 @@ It allows the "normal" method of tiling window managers(with the new window as t
All accessible with keyboard shortcuts defined in the config.h file.
* The window W at the top of the stack can be resized on a per desktop basis.
- * Changing a tiling mode on one workspace doesn't affect the other workspaces.
+ * Changing a tiling mode or window size on one desktop doesn't affect the other desktops.
###Recent Changes
diff --git a/src/config.h b/src/config.h
index 12d3340..677631e 100755
--- a/src/config.h
+++ b/src/config.h
@@ -45,8 +45,9 @@
static const Convenience convenience[] = { \
/* class desktop follow */
{ "Thunar", 2, 1 },
- { "Leafpad", 2, 1 },
+ //{ "Leafpad", 2, 1 },
{ "Firefox", 3, 0 },
+ { "Links", 3, 1 },
{ "MPlayer", 4, 1 },
{ "Thunderbird", 5, 0 },
{ "Pysol", 6, 0 },
@@ -57,7 +58,7 @@ const char* urxvtcmd[] = {"urxvtc",NULL};
const char* terminalcmd[] = {"Terminal",NULL};
const char* thunarcmd[] = {"thunar",NULL};
const char* firefoxcmd[] = {"firefox",NULL};
-const char* conkerorcmd[] = {"conkeror",NULL};
+const char* webcmd[] = {"links","-g",NULL};
const char* mailcmd[] = {"thunderbird",NULL };
const char* voldowncmd[] = {"/home/pnewm/.bin/voldown",NULL};
const char* volupcmd[] = {"/home/pnewm/.bin/volup",NULL};
@@ -102,7 +103,7 @@ static key keys[] = {
{ MOD4, XK_Left, prev_desktop, {NULL}},
{ MOD4, XK_e, spawn, {.com = mailcmd}},
{ MOD4, XK_f, spawn, {.com = firefoxcmd}},
- { MOD4, XK_w, spawn, {.com = conkerorcmd}},
+ { MOD4, XK_w, spawn, {.com = webcmd}},
{ MOD4, XK_h, spawn, {.com = thunarcmd}},
{ MOD4, XK_t, spawn, {.com = terminalcmd}},
{ MOD4, XK_v, spawn, {.com = vols_what}},
diff --git a/src/dminiwm.c b/src/dminiwm.c
index f9e1fa8..0c6dd24 100644
--- a/src/dminiwm.c
+++ b/src/dminiwm.c
@@ -21,6 +21,7 @@
//#include <X11/XF86keysym.h>
#include <X11/Xproto.h>
#include <X11/Xutil.h>
+#include <X11/Xatom.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -68,6 +69,32 @@ typedef struct {
int followwin;
} Convenience;
+typedef enum {
+ ATOM_NET_WM_WINDOW_TYPE,
+ ATOM_NET_WM_WINDOW_TYPE_UTILITY,
+ ATOM_NET_WM_WINDOW_TYPE_DOCK,
+ ATOM_NET_WM_WINDOW_TYPE_SPLASH,
+ ATOM_NET_WM_WINDOW_TYPE_DIALOG,
+ ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION,
+ ATOM_COUNT
+} AtomType;
+
+typedef struct {
+ Atom *atom;
+ const char *name;
+} AtomNode;
+
+Atom atoms[ATOM_COUNT];
+
+static const AtomNode atomList[] = {
+ { &atoms[ATOM_NET_WM_WINDOW_TYPE], "_NET_WM_WINDOW_TYPE" },
+ { &atoms[ATOM_NET_WM_WINDOW_TYPE_UTILITY], "_NET_WM_WINDOW_TYPE_UTILITY" },
+ { &atoms[ATOM_NET_WM_WINDOW_TYPE_DOCK], "_NET_WM_WINDOW_TYPE_DOCK" },
+ { &atoms[ATOM_NET_WM_WINDOW_TYPE_SPLASH], "_NET_WM_WINDOW_TYPE_SPLASH" },
+ { &atoms[ATOM_NET_WM_WINDOW_TYPE_DIALOG], "_NET_WM_WINDOW_TYPE_DIALOG" },
+ { &atoms[ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION], "_NET_WM_WINDOW_TYPE_NOTIFICATION"},
+};
+
// Functions
static void add_window(Window w);
static void change_desktop(const Arg arg);
@@ -668,17 +695,33 @@ void configurerequest(XEvent *e) {
void maprequest(XEvent *e) {
XMapRequestEvent *ev = &e->xmaprequest;
- Window dialog_window;
-
- // For dialog windows
- XGetTransientForHint(dis, ev->window, &dialog_window);
- if(dialog_window != 0) {
- add_window(ev->window);
- XMapWindow(dis, ev->window);
- XSetInputFocus(dis,ev->window,RevertToParent,CurrentTime);
- XRaiseWindow(dis,ev->window);
- return;
+
+ unsigned long count, j, extra;
+ Atom realType;
+ int realFormat;
+ unsigned char *temp;
+ Atom *type;
+
+ if(XGetWindowProperty(dis, ev->window, atoms[ATOM_NET_WM_WINDOW_TYPE], 0, 32, False, XA_ATOM, &realType, &realFormat, &count, &extra, &temp) == Success) {
+ if(count > 0) {
+ type = (unsigned long*)temp;
+ for(j=0; j<count; j++) {
+ if((type[j] == atoms[ATOM_NET_WM_WINDOW_TYPE_UTILITY]) ||
+ (type[j] == atoms[ATOM_NET_WM_WINDOW_TYPE_DOCK]) ||
+ (type[j] == atoms[ATOM_NET_WM_WINDOW_TYPE_SPLASH]) ||
+ (type[j] == atoms[ATOM_NET_WM_WINDOW_TYPE_DIALOG]) ||
+ (type[j] == atoms[ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION])) {
+ add_window(ev->window);
+ XMapWindow(dis, ev->window);
+ XSetInputFocus(dis,ev->window,RevertToParent,CurrentTime);
+ XRaiseWindow(dis,ev->window);
+ return;
+ }
+ }
}
+ if(temp)
+ XFree(temp);
+ }
// For fullscreen mplayer (and maybe some other program)
client *c;
@@ -893,6 +936,10 @@ void setup() {
const Arg arg = {.i = 0};
current_desktop = arg.i;
change_desktop(arg);
+ // Set up atoms for dialog/notification windows
+ int x;
+ for(x = 0; x < ATOM_COUNT; x++)
+ *atomList[x].atom = XInternAtom(dis, atomList[x].name, False);
// To catch maprequest and destroynotify (if other wm running)
XSelectInput(dis,root,SubstructureNotifyMask|SubstructureRedirectMask);
XSetErrorHandler(xerror);