int horizontal_msize;
int horizontal_mwin;
int horizontal_stacks;
+ int horizontal_flip;
int vertical_msize;
int vertical_mwin;
int vertical_stacks;
+ int vertical_flip;
} l_state;
};
#define SWM_ARG_ID_MASTERGROW (21)
#define SWM_ARG_ID_MASTERADD (22)
#define SWM_ARG_ID_MASTERDEL (23)
+#define SWM_ARG_ID_FLIPLAYOUT (24)
#define SWM_ARG_ID_STACKRESET (30)
#define SWM_ARG_ID_STACKINIT (31)
#define SWM_ARG_ID_CYCLEWS_UP (40)
{
strlcpy(ws->stacker, "[ ]", sizeof ws->stacker);
if (ws->cur_layout->l_stack == vertical_stack)
- snprintf(ws->stacker, sizeof ws->stacker, "[%d|%d]",
+ snprintf(ws->stacker, sizeof ws->stacker,
+ ws->l_state.vertical_flip ? "[%d>%d]" : "[%d|%d]",
ws->l_state.vertical_mwin, ws->l_state.vertical_stacks);
if (ws->cur_layout->l_stack == horizontal_stack)
- snprintf(ws->stacker, sizeof ws->stacker, "[%d-%d]",
+ snprintf(ws->stacker, sizeof ws->stacker,
+ ws->l_state.horizontal_flip ? "[%dv%d]" : "[%d-%d]",
ws->l_state.horizontal_mwin, ws->l_state.horizontal_stacks);
}
{
strlcpy(ws->stacker, "[ ]", sizeof ws->stacker);
if (ws->cur_layout->l_stack == vertical_stack)
- strlcpy(ws->stacker, "[|]", sizeof ws->stacker);
+ strlcpy(ws->stacker, ws->l_state.vertical_flip ? "[>]" : "[|]",
+ sizeof ws->stacker);
if (ws->cur_layout->l_stack == horizontal_stack)
- strlcpy(ws->stacker, "[-]", sizeof ws->stacker);
+ strlcpy(ws->stacker, ws->l_state.horizontal_flip ? "[v]" : "[-]",
+ sizeof ws->stacker);
}
void
}
void
+bar_check_opts(void)
+{
+ if (title_class_enabled || title_name_enabled || window_name_enabled)
+ bar_update();
+}
+
+void
bar_signal(int sig)
{
bar_alarm = 1;
PropModeReplace, (unsigned char *)&win->id,1);
}
- if (window_name_enabled || title_class_enabled || title_name_enabled)
- bar_update();
+ bar_check_opts();
}
void
winfocus = TAILQ_LAST(wl, ws_win_list);
if (winfocus == NULL || winfocus == win)
winfocus = TAILQ_NEXT(cur_focus, entry);
-done:
- if (winfocus == winlostfocus || winfocus == NULL) {
- /* update the bar so that title/class/name will be cleared. */
- if (window_name_enabled || title_name_enabled ||
- title_class_enabled)
- bar_update();
- return;
- }
+done:
focus_magic(winfocus);
}
default:
return;
}
- if (winfocus == winlostfocus || winfocus == NULL) {
- /* update the bar so that title/class/name will be cleared. */
- if (window_name_enabled || title_name_enabled ||
- title_class_enabled)
- bar_update();
-
- return;
- }
focus_magic(winfocus);
}
if (ws->l_state.vertical_stacks > 1)
ws->l_state.vertical_stacks--;
break;
+ case SWM_ARG_ID_FLIPLAYOUT:
+ ws->l_state.vertical_flip = !ws->l_state.vertical_flip;
+ break;
default:
return;
}
{
DNPRINTF(SWM_D_STACK, "vertical_stack: workspace: %d\n", ws->idx);
- stack_master(ws, g, 0, 0);
+ stack_master(ws, g, 0, ws->l_state.vertical_flip);
}
void
if (ws->l_state.horizontal_stacks > 1)
ws->l_state.horizontal_stacks--;
break;
+ case SWM_ARG_ID_FLIPLAYOUT:
+ ws->l_state.horizontal_flip = !ws->l_state.horizontal_flip;
+ break;
default:
return;
}
{
DNPRINTF(SWM_D_STACK, "horizontal_stack: workspace: %d\n", ws->idx);
- stack_master(ws, g, 1, 0);
+ stack_master(ws, g, 1, ws->l_state.horizontal_flip);
}
/* fullscreen view */
/* user/key callable function IDs */
enum keyfuncid {
kf_cycle_layout,
+ kf_flip_layout,
kf_stack_reset,
kf_master_shrink,
kf_master_grow,
} keyfuncs[kf_invalid + 1] = {
/* name function argument */
{ "cycle_layout", cycle_layout, {0} },
+ { "flip_layout", stack_config, {.id = SWM_ARG_ID_FLIPLAYOUT} },
{ "stack_reset", stack_config, {.id = SWM_ARG_ID_STACKRESET} },
{ "master_shrink", stack_config, {.id = SWM_ARG_ID_MASTERSHRINK} },
{ "master_grow", stack_config, {.id = SWM_ARG_ID_MASTERGROW} },
setup_keys(void)
{
setkeybinding(MODKEY, XK_space, kf_cycle_layout,NULL);
+ setkeybinding(MODKEY|ShiftMask, XK_backslash, kf_flip_layout, NULL);
setkeybinding(MODKEY|ShiftMask, XK_space, kf_stack_reset, NULL);
setkeybinding(MODKEY, XK_h, kf_master_shrink,NULL);
setkeybinding(MODKEY, XK_l, kf_master_grow, NULL);
{
DNPRINTF(SWM_D_FOCUS, "focus_magic: window: 0x%lx\n", WINID(win));
- if (win == NULL)
+ if (win == NULL) {
+ /* if there are no windows clear the status-bar */
+ bar_check_opts();
return;
+ }
if (win->child_trans) {
/* win = parent & has a transient so focus on that */
if (win->child_trans->take_focus)
client_msg(win, takefocus);
} else {
- /* make sure transient hasn't dissapeared */
+ /* make sure transient hasn't disappeared */
if (validate_win(win->child_trans) == 0) {
focus_win(win->child_trans);
if (win->child_trans->take_focus)