diff options
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/README | 7 | ||||
| -rwxr-xr-x | src/config.h | 12 | ||||
| -rw-r--r-- | src/dminiwm.c | 39 |
4 files changed, 56 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c9c0fbd..4794cb4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +15/10/11 + Added having applications start on specified desktop + 13/10/11 Added ability to use grow_window/shrink_window in grid mode with 3 or 4 windows @@ -59,8 +59,8 @@ It allows the "normal" method of tiling window managers(with the new window as t ###Recent Changes -------------- -13/9/11 - Added the ability to resize the window on the top of the stack +15/10/11 + Added having applications open on specified desktop ###Status @@ -74,6 +74,7 @@ There are more options in the config file than the original catwm. * Added an option to focus the window the mouse just moved to. * Fixed a window being destroyed on another desktop creating ghost windows. * Added ability to resize the window on the top of the stack + * Added having applications open on specified desktop ###Installation @@ -95,5 +96,5 @@ Need Xlib, then: ###Todo ---- - * Have option for apps to start on set desktops + * I'll think of something diff --git a/src/config.h b/src/config.h index c3ab1b0..d0c58f1 100755 --- a/src/config.h +++ b/src/config.h @@ -1,4 +1,4 @@ - /* config.h for dminiwm.c [ 0.1.2 ] + /* config.h for dminiwm.c [ 0.1.3 ] * * Started from catwm 31/12/10 * Bad window error checking and numlock checking used from @@ -40,6 +40,16 @@ #define FOCUS "#664422" // dkorange #define UNFOCUS "#004050" // blueish +// Applications to a set desktop +static const Convenience convenience[] = { \ + /* class desktop follow */ + { "Thunar", 2, 1 }, + { "Leafpad", 2, 1 }, + { "Firefox", 3, 0 }, + { "Thunderbird", 5, 0 }, + { "Pysol", 6, 0 }, +}; + const char* dmenucmd[] = {"dmenu_run","-i","-nb","#666622","-nf","white",NULL}; const char* urxvtcmd[] = {"urxvtc",NULL}; const char* terminalcmd[] = {"Terminal",NULL}; diff --git a/src/dminiwm.c b/src/dminiwm.c index 321b3c7..4029cf1 100644 --- a/src/dminiwm.c +++ b/src/dminiwm.c @@ -1,4 +1,4 @@ -/* dminiwm.c [ 0.1.2 ] +/* dminiwm.c [ 0.1.3 ] * * I started this from catwm 31/12/10 * Bad window error checking and numlock checking used from @@ -20,11 +20,13 @@ #include <X11/keysym.h> //#include <X11/XF86keysym.h> #include <X11/Xproto.h> +#include <X11/Xutil.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> #include <sys/wait.h> +#include <string.h> #define TABLENGTH(X) (sizeof(X)/sizeof(*X)) @@ -60,6 +62,12 @@ struct desktop{ client *current; }; +typedef struct { + const char *class; + int preferredd; + int followwin; +} Convenience; + // Functions static void add_window(Window w); static void change_desktop(const Arg arg); @@ -682,6 +690,35 @@ void maprequest(XEvent *e) { return; } + XClassHint ch = {0}; + static unsigned int len = sizeof convenience / sizeof convenience[0]; + int i = 0; + int tmp = current_desktop; + if(XGetClassHint(dis, ev->window, &ch)) + for(i=0;i<len;i++) + if(strcmp(ch.res_class, convenience[i].class) == 0) { + fprintf(stdout, "%s will be moved....\n", ch.res_class); + save_desktop(tmp); + select_desktop(convenience[i].preferredd-1); + add_window(ev->window); + if(tmp == convenience[i].preferredd-1) { + XMapWindow(dis, ev->window); + tile(); + update_current(); + } else { + select_desktop(tmp); + } + if(convenience[i].followwin != 0) { + Arg a = {.i = convenience[i].preferredd-1}; + change_desktop(a); + } + if(ch.res_class) + XFree(ch.res_class); + if(ch.res_name) + XFree(ch.res_name); + return; + } + add_window(ev->window); XMapWindow(dis,ev->window); tile(); |
