static const char *cvstag = "$scrotwm$";
-#define SWM_VERSION "0.9.22"
+#define SWM_VERSION "0.9.24"
#include <stdio.h>
#include <stdlib.h>
#define SWM_MAX_FONT_STEPS (3)
#define WINID(w) (w ? w->id : 0)
+#define SWM_FOCUS_DEFAULT (0)
+#define SWM_FOCUS_SYNERGY (1)
+#define SWM_FOCUS_FOLLOW (2)
+
#ifndef SWM_LIB
#define SWM_LIB "/usr/local/lib/libswmhack.so"
#endif
char *clock_format = NULL;
int title_name_enabled = 0;
int title_class_enabled = 0;
+int focus_mode = SWM_FOCUS_DEFAULT;
pid_t bar_pid;
GC bar_gc;
XGCValues bar_gcv;
TAILQ_ENTRY(swm_region) entry;
struct swm_geometry g;
struct workspace *ws; /* current workspace on this region */
+ struct workspace *ws_prior; /* prior workspace on this region */
struct swm_screen *s; /* screen idx */
Window bar_window;
};
void
switchws(struct swm_region *r, union arg *args)
{
- int wsid = args->id;
+ int wsid = args->id, unmap_old = 0;
struct swm_region *this_r, *other_r;
struct ws_win *win;
struct workspace *new_ws, *old_ws;
if (old_ws->r != NULL)
old_ws->old_r = old_ws->r;
old_ws->r = NULL;
-
- TAILQ_FOREACH(win, &old_ws->winlist, entry)
- unmap_window(win);
+ unmap_old = 1;
} else {
+ other_r->ws_prior = new_ws;
other_r->ws = old_ws;
old_ws->r = other_r;
}
+ this_r->ws_prior = old_ws;
this_r->ws = new_ws;
new_ws->r = this_r;
a.id = SWM_ARG_ID_FOCUSCUR;
focus(new_ws->r, &a);
bar_update();
+
+ /* unmap old windows */
+ if (unmap_old)
+ TAILQ_FOREACH(win, &old_ws->winlist, entry)
+ unmap_window(win);
}
void
}
void
+priorws(struct swm_region *r, union arg *args)
+{
+ union arg a;
+
+ DNPRINTF(SWM_D_WS, "priorws id %d "
+ "in screen[%d]:%dx%d+%d+%d ws %d\n", args->id,
+ r->s->idx, WIDTH(r), HEIGHT(r), X(r), Y(r), r->ws->idx);
+
+ if (r->ws_prior == NULL)
+ return;
+
+ a.id = r->ws_prior->idx;
+ switchws(r, &a);
+}
+
+void
cyclescr(struct swm_region *r, union arg *args)
{
struct swm_region *rr = NULL;
kf_ws_10,
kf_ws_next,
kf_ws_prev,
+ kf_ws_prior,
kf_screen_next,
kf_screen_prev,
kf_mvws_1,
{ "ws_10", switchws, {.id = 9} },
{ "ws_next", cyclews, {.id = SWM_ARG_ID_CYCLEWS_UP} },
{ "ws_prev", cyclews, {.id = SWM_ARG_ID_CYCLEWS_DOWN} },
+ { "ws_prior", priorws, {0} },
{ "screen_next", cyclescr, {.id = SWM_ARG_ID_CYCLESC_UP} },
{ "screen_prev", cyclescr, {.id = SWM_ARG_ID_CYCLESC_DOWN} },
{ "mvws_1", send_to_ws, {.id = 0} },
setkeybinding(MODKEY, XK_0, kf_ws_10, NULL);
setkeybinding(MODKEY, XK_Right, kf_ws_next, NULL);
setkeybinding(MODKEY, XK_Left, kf_ws_prev, NULL);
+ setkeybinding(MODKEY, XK_a, kf_ws_prior, NULL);
setkeybinding(MODKEY|ShiftMask, XK_Right, kf_screen_next, NULL);
setkeybinding(MODKEY|ShiftMask, XK_Left, kf_screen_prev, NULL);
setkeybinding(MODKEY|ShiftMask, XK_1, kf_mvws_1, NULL);
setup_quirks(void)
{
setquirk("MPlayer", "xv", SWM_Q_FLOAT | SWM_Q_FULLSCREEN);
- setquirk("OpenOffice.org 2.4", "VCLSalFrame", SWM_Q_FLOAT);
- setquirk("OpenOffice.org 3.0", "VCLSalFrame", SWM_Q_FLOAT);
+ setquirk("OpenOffice.org 3.2", "VCLSalFrame", SWM_Q_FLOAT);
setquirk("Firefox-bin", "firefox-bin", SWM_Q_TRANSSZ);
setquirk("Firefox", "Dialog", SWM_Q_FLOAT);
setquirk("Gimp", "gimp", SWM_Q_FLOAT | SWM_Q_ANYWHERE);
enum { SWM_S_BAR_DELAY, SWM_S_BAR_ENABLED, SWM_S_STACK_ENABLED,
SWM_S_CLOCK_ENABLED, SWM_S_CLOCK_FORMAT, SWM_S_CYCLE_EMPTY,
SWM_S_CYCLE_VISIBLE, SWM_S_SS_ENABLED, SWM_S_TERM_WIDTH,
- SWM_S_TITLE_CLASS_ENABLED, SWM_S_TITLE_NAME_ENABLED, SWM_S_BAR_FONT,
- SWM_S_BAR_ACTION, SWM_S_SPAWN_TERM, SWM_S_SS_APP, SWM_S_DIALOG_RATIO
+ SWM_S_TITLE_CLASS_ENABLED, SWM_S_TITLE_NAME_ENABLED,
+ SWM_S_FOCUS_MODE, SWM_S_BAR_FONT, SWM_S_BAR_ACTION, SWM_S_SPAWN_TERM,
+ SWM_S_SS_APP, SWM_S_DIALOG_RATIO
};
int
case SWM_S_TITLE_NAME_ENABLED:
title_name_enabled = atoi(value);
break;
+ case SWM_S_FOCUS_MODE:
+ if (!strcmp(value, "default"))
+ focus_mode = SWM_FOCUS_DEFAULT;
+ else if (!strcmp(value, "follow_cursor"))
+ focus_mode = SWM_FOCUS_FOLLOW;
+ else if (!strcmp(value, "synergy"))
+ focus_mode = SWM_FOCUS_SYNERGY;
+ else
+ err(1, "focus_mode");
+ break;
case SWM_S_BAR_FONT:
free(bar_fonts[0]);
if ((bar_fonts[0] = strdup(value)) == NULL)
{ "screenshot_app", setconfvalue, SWM_S_SS_APP },
{ "term_width", setconfvalue, SWM_S_TERM_WIDTH },
{ "title_class_enabled", setconfvalue, SWM_S_TITLE_CLASS_ENABLED },
- { "title_name_enabled", setconfvalue, SWM_S_TITLE_NAME_ENABLED }
+ { "title_name_enabled", setconfvalue, SWM_S_TITLE_NAME_ENABLED },
+ { "focus_mode", setconfvalue, SWM_S_FOCUS_MODE },
};
ev->window, ev->mode, ev->detail, ev->root, ev->subwindow,
ev->same_screen, ev->focus, ev->state);
- goto focusme;
+ switch (focus_mode) {
+ case SWM_FOCUS_DEFAULT:
+ if (QLength(display)) {
+ DNPRINTF(SWM_D_EVENT, "ignore enternotify %d\n",
+ QLength(display));
+ return;
+ }
+ break;
+ case SWM_FOCUS_FOLLOW:
+ break;
+ case SWM_FOCUS_SYNERGY:
#if 0
/*
* all these checks need to be in this order because the
}
}
#endif
-focusme:
- if (QLength(display)) {
- DNPRINTF(SWM_D_EVENT, "ignore enternotify %d\n",
- QLength(display));
- return;
+ break;
}
if ((win = find_window(ev->window)) == NULL) {
HEIGHT(r) = h;
r->s = s;
r->ws = ws;
+ r->ws_prior = NULL;
ws->r = r;
TAILQ_INSERT_TAIL(&s->rl, r, entry);
}
setscreencolor("black", i + 1, SWM_S_COLOR_BAR);
setscreencolor("rgb:a0/a0/a0", i + 1, SWM_S_COLOR_BAR_FONT);
+ /* set default cursor */
+ XDefineCursor(display, screens[i].root,
+ XCreateFontCursor(display, XC_left_ptr));
+
/* init all workspaces */
/* XXX these should be dynamically allocated too */
for (j = 0; j < SWM_WS_MAX; j++) {
}
done:
bar_extra_stop();
-
+ XFreeGC(display, bar_gc);
XCloseDisplay(display);
return (0);