diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | ChangeLog | 46 | ||||
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | README.md | 15 | ||||
| -rw-r--r-- | config.h | 121 | ||||
| -rw-r--r-- | config.h.def | 3 | ||||
| -rw-r--r-- | dminiwm.c | 27 |
7 files changed, 152 insertions, 63 deletions
@@ -1,5 +1,4 @@ dminiwm -config.h *.o *.swp *~ diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index c960952..0000000 --- a/ChangeLog +++ /dev/null @@ -1,46 +0,0 @@ -21/11/11 - Fix for transient windows not being managed - -15/11/11 - Fix for when trying to swap master with only one window - -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 - -13/10/11 - Added ability to use grow_window/shrink_window in grid mode with 3 or 4 windows - -13/10/11 - Popup windows now aren't managed/added to the stack - -10/10/11 - Reapplied setting master_size relevant to default mode - -8/10/11 - For only one window or fullscreen mode there is no border - -8/10/11 - Fixed fullscreen mplayer - -8/10/11 - Removed useless gaps when in grid mode - -16/9/11 - Added back the option to have the panel at the top - Fine tuned the grid tiling mode - -13/9/11 - Added back horizontal tiling, follow mouse and follow window - -12/9/11 - Returned to catwm tiling methods - with the ability to resize the window at the top of the stack - -9/9/11 - Fine tuned the next/prev desktop and the destroy notify functions - - 8/9/11 - Have a proper destroy notify function now that removes destroyed windows from - the window manager stack for the desktop they were on.
\ No newline at end of file @@ -11,7 +11,7 @@ CC=gcc all: $(EXEC) dminiwm: dminiwm.o - $(CC) $(LDFLAGS) -Os -o $@ $+ $(LDADD) + $(CC) $(LDFLAGS) -s -Os -o $@ $+ $(LDADD) install: all install -Dm 755 dminiwm $(DESTDIR)$(BINDIR)/dminiwm @@ -21,8 +21,8 @@ Currently under 900 lines with the config file included. Modes ----- -It allows the "normal" method of tiling window managers(with the new window as the master) - and with the new window opened at the bottom of the stack(like dwm's attach_aside) +It allows the "normal" method of tiling window managers (with the new window as the master) +and with the new window opened at the bottom of the stack (like dwm's attach_aside) --- @@ -77,12 +77,6 @@ All accessible with keyboard shortcuts defined in the config.h file. * Changing a tiling mode or window size on one desktop doesn't affect the other desktops. -Recent Changes --------------- - -15/10/11 - Added having applications open on specified desktop - Status ------ @@ -122,8 +116,3 @@ or [fill an issue][bug] on [GitHub][ghp] [bug]: https://github.com/moetunes/dminimalwm/issues [ghp]: https://github.com/moetunes/dminimalwm -Todo ----- - - * when swithching desktops stop the mouse being in an unfocused window changing focus. - diff --git a/config.h b/config.h new file mode 100644 index 0000000..28aace6 --- /dev/null +++ b/config.h @@ -0,0 +1,121 @@ + /* config.h for dminiwm.c [ 0.1.7 ] + * + * Started from catwm 31/12/10 + * Bad window error checking and numlock checking used from + * 2wm at http://hg.suckless.org/2wm/ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef CONFIG_H +#define CONFIG_H + +#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) + +/** generic settings **/ +#define MOD1 Mod1Mask /* ALT key */ +#define MOD4 Mod4Mask /* Super/Windows key */ +#define MASTER_SIZE 0.52 +#define TOP_PANEL 0 /* Place panel at the 1=bottom or 0=top */ +#define PANEL_HEIGHT 18 /* 0 for no space for a panel */ +#define BORDER_WIDTH 2 +#define ATTACH_ASIDE 0 /* 0=TRUE, 1=New window is master */ +#define DEFAULT_MODE 0 /* 0=Vertical, 1=Fullscreen 2=Horizontal 3=grid */ +#define FOLLOW_MOUSE 1 /* 1=Don't 0=Focus the window the mouse just entered */ +#define FOLLOW_WINDOW 1 /* 1=Don't 0=Follow the window when moved to a different desktop */ +#define DESKTOPS 4 /* Must edit DESKTOPCHANGE keys to suit */ + +/** Colors **/ +#define FOCUS "#ff950e" +#define UNFOCUS "#444444" + +/** Applications to a specific desktop **/ +static const Convenience convenience[] = { \ + /* class desktop follow */ + { "MPlayer", 3, 1 }, +}; + +/** commands **/ +const char *termcmd[] = { "urxvt", NULL }; +const char *dmenucmd[] = { "dmn", NULL }; +const char *urxvtcmd[] = { "urxvtdc", NULL }; +const char *chromiumcmd[] = { "chromium", NULL }; +/* audio volume */ +static const char *volupcmd[] = { "volctrl", "+2", NULL }; +static const char *voldowncmd[] = { "volctrl", "-2", NULL }; +static const char *voltogglecmd[] = { "volctrl", "toggle", NULL }; +/* audio playback [mpd/mpc] */ +const char *mplaycmd[] = { "mpc", "play", NULL }; +const char *mstopcmd[] = { "mpc", "stop", NULL }; +const char *mnextcmd[] = { "mpc", "next", NULL }; +const char *mprevcmd[] = { "mpc", "prev", NULL }; +const char *mtogglecmd[] = { "mpc", "toggle", NULL }; +/* operation */ +/* + * const char* rebootcmd[] = { "sudo", "reboot", NULL}; + * const char* shutdowncmd[] = { "sudo", "shutdown", "-h", "now", NULL}; + */ + +/* Avoid multiple paste */ +#define DESKTOPCHANGE(K,N) \ + { MOD1, K, change_desktop, {.i = N}}, \ + { MOD1|ShiftMask, K, client_to_desktop, {.i = N}}, + +/** Shortcuts **/ +static key keys[] = { +/* modifier key function argument */ + { MOD1, XK_h, resize_master, {.i = -10}}, /* decrease */ + { MOD1, XK_l, resize_master, {.i = +10}}, /* increase */ + { MOD1|ShiftMask, XK_c, kill_client, {NULL} }, + { MOD1, XK_j, next_win, {NULL} }, + { MOD1, XK_k, prev_win, {NULL} }, + { MOD1, XK_o, resize_stack, {.i = -10}}, /* shrink */ + { MOD1, XK_p, resize_stack, {.i = +10}}, /* grow */ + { MOD1, XK_Return, swap_master, {NULL} }, + { MOD1|ShiftMask, XK_j, move_down, {NULL} }, + { MOD1|ShiftMask, XK_k, move_up, {NULL} }, + { MOD1|ShiftMask, XK_v, switch_vertical, {NULL} }, + { MOD1|ShiftMask, XK_h, switch_horizontal, {NULL} }, + { MOD1|ShiftMask, XK_g, switch_grid, {NULL} }, + { MOD1|ShiftMask, XK_m, switch_fullscreen, {NULL} }, + { MOD1|ShiftMask, XK_Right, next_desktop, {NULL} }, + { MOD1|ShiftMask, XK_Left, prev_desktop, {NULL} }, + /* + * { MOD1|ControlMask, XK_r, spawn, {.com = rebootcmd} }, + * { MOD1|ControlMask, XK_s, spawn, {.com = shutdowncmd} }, + */ + { MOD1|ShiftMask, XK_q, quit, {NULL} }, + { MOD1|ShiftMask, XK_Return, spawn, {.com = termcmd} }, + { MOD4, XK_v, spawn, {.com = dmenucmd} }, + { MOD4, XK_grave, spawn, {.com = urxvtcmd} }, + { MOD4, XK_equal, spawn, {.com = volupcmd} }, + { MOD4, XK_KP_Add, spawn, {.com = volupcmd} }, + { MOD4, XK_minus, spawn, {.com = voldowncmd} }, + { MOD4, XK_KP_Subtract,spawn, {.com = voldowncmd} }, + { MOD4, XK_m, spawn, {.com = voltogglecmd} }, + { MOD4, XK_w, spawn, {.com = chromiumcmd} }, + { MOD4, XK_c, spawn, {.com = mplaycmd} }, + { MOD4, XK_s, spawn, {.com = mstopcmd} }, + { MOD4, XK_j, spawn, {.com = mnextcmd} }, + { MOD4, XK_k, spawn, {.com = mprevcmd} }, + { MOD4, XK_p, spawn, {.com = mtogglecmd} }, + DESKTOPCHANGE( XK_F1, 0) + DESKTOPCHANGE( XK_F2, 1) + DESKTOPCHANGE( XK_F3, 2) + DESKTOPCHANGE( XK_F4, 3) +}; + +#endif + diff --git a/config.h.def b/config.h.def index fed94d4..e50253e 100644 --- a/config.h.def +++ b/config.h.def @@ -1,4 +1,4 @@ - /* config.h for dminiwm.c [ 0.1.7 ] + /* config.h for dminiwm.c [ 0.1.8 ] * * Started from catwm 31/12/10 * Bad window error checking and numlock checking used from @@ -35,6 +35,7 @@ #define DEFAULT_MODE 0 /* 0=Vertical, 1=Fullscreen 2=Horizontal 3=grid*/ #define FOLLOW_MOUSE 0 /* 1=Don't 0=Focus the window the mouse just entered */ #define FOLLOW_WINDOW 0 /* 1=Don't 0=Follow the window when moved to a different desktop */ +#define CLICK_TO_FOCUS 0 /* 1=Don't 0=Focus an unfocused window when clicked */ #define DESKTOPS 6 /* Must edit DESKTOPCHANGE keys to suit */ // Colors @@ -1,4 +1,8 @@ +<<<<<<< HEAD /* dminiwm.c [ 0.1.7 ] +======= +/* dminiwm.c [ 0.1.8 ] +>>>>>>> mirror * * I started this from catwm 31/12/10 * Bad window error checking and numlock checking used from @@ -97,6 +101,7 @@ static const AtomNode atomList[] = { // Functions static void add_window(Window w); +static void buttonpressed(XEvent *e); static void change_desktop(const Arg arg); static void client_to_desktop(const Arg arg); static void configurenotify(XEvent *e); @@ -161,6 +166,7 @@ static void (*events[LASTEvent])(XEvent *e) = { [KeyPress] = keypress, [MapRequest] = maprequest, [EnterNotify] = enternotify, + [ButtonPress] = buttonpressed, [DestroyNotify] = destroynotify, [ConfigureNotify] = configurenotify, [ConfigureRequest] = configurerequest @@ -571,9 +577,14 @@ void update_current() { XSetWindowBorder(dis,c->win,win_focus); XSetInputFocus(dis,c->win,RevertToParent,CurrentTime); XRaiseWindow(dis,c->win); + if(CLICK_TO_FOCUS == 0) + XUngrabButton(dis, AnyButton, AnyModifier, c->win); } - else + else { XSetWindowBorder(dis,c->win,win_unfocus); + if(CLICK_TO_FOCUS == 0) + XGrabButton(dis, AnyButton, AnyModifier, c->win, True, ButtonPressMask|ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); + } } XSync(dis, False); } @@ -805,6 +816,20 @@ void enternotify(XEvent *e) { } } +void buttonpressed(XEvent *e) { + client *c; + XButtonPressedEvent *ev = &e->xbutton; + + // change focus with LMB + if(CLICK_TO_FOCUS == 0 && ev->window != current->win && ev->button == Button1) + for(c=head;c;c=c->next) + if(ev->window == c->win) { + current = c; + update_current(); + return; + } +} + void send_kill_signal(Window w) { XEvent ke; ke.type = ClientMessage; |
