X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=spectrwm.c;h=0569f9c1147de111141363d3a83f7ce1c09d70c7;hb=ba542eb4936d1d51ce09efae93649f49f413540a;hp=2ecc60f77162f6fd97c608cac2a15fe4992bff2b;hpb=09526664b2bce144ef3cade500a70786a5aeaeff;p=spectrwm.git diff --git a/spectrwm.c b/spectrwm.c index 2ecc60f..0569f9c 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -1369,6 +1369,26 @@ bar_title_name(char *s, size_t sz, struct swm_region *r) } void +bar_class_title_name(char *s, size_t sz, struct swm_region *r) +{ + if (r == NULL || r->ws == NULL || r->ws->focus == NULL) + return; + + bar_class_name(s, sz, r); + strlcat(s, ":", sz); + bar_title_name(s, sz, r); +} + +void +bar_window_float(char *s, size_t sz, struct swm_region *r) +{ + if (r == NULL || r ->ws == NULL || r->ws->focus == NULL) + return; + if (r->ws->focus->floating) + strlcat(s, "(f)", sz); +} + +void bar_window_name(char *s, size_t sz, struct swm_region *r) { unsigned char *title; @@ -1378,10 +1398,7 @@ bar_window_name(char *s, size_t sz, struct swm_region *r) if ((title = get_win_name(r->ws->focus->id)) == NULL) return; - if (r->ws->focus->floating) - strlcat(s, "(f) ", sz); strlcat(s, (char *)title, sz); - XFree(title); } @@ -1465,17 +1482,20 @@ bar_fmt(const char *fmtexp, char *fmtnew, struct swm_region *r, size_t sz) strlcat(fmtnew, " ", sz); } - if (title_name_enabled) { - /* add a colon if showing the class and something is focused */ - if (title_class_enabled && r != NULL && r->ws != NULL && - r->ws->focus != NULL) - strlcat(fmtnew, ":", sz); - strlcat(fmtnew, "+T ", sz); + /* checks needed by the colon and floating strlcat(3) calls below */ + if (r != NULL && r->ws != NULL && r->ws->focus != NULL) { + if (title_name_enabled) { + if (title_class_enabled) + strlcat(fmtnew, ":", sz); + strlcat(fmtnew, "+T ", sz); + } + if (window_name_enabled) { + if (r->ws->focus->floating) + strlcat(fmtnew, "+F ", sz); + strlcat(fmtnew, "+64W ", sz); + } } - if (window_name_enabled) - strlcat(fmtnew, "+64W ", sz); - /* finally add the action script output and the version */ strlcat(fmtnew, " +A +V", sz); } @@ -1524,12 +1544,18 @@ bar_replace_seq(char *fmt, char *fmtrep, struct swm_region *r, size_t *offrep, case 'D': bar_workspace_name(tmp, sizeof tmp, r); break; + case 'F': + bar_window_float(tmp, sizeof tmp, r); + break; case 'I': snprintf(tmp, sizeof tmp, "%d", r->ws->idx + 1); break; case 'N': snprintf(tmp, sizeof tmp, "%d", r->s->idx + 1); break; + case 'P': + bar_class_title_name(tmp, sizeof tmp, r); + break; case 'S': snprintf(tmp, sizeof tmp, "%s", r->ws->stacker); break; @@ -4368,7 +4394,6 @@ enum keyfuncid { kf_swap_next, kf_swap_prev, kf_spawn_term, - kf_spawn_menu, kf_quit, kf_restart, kf_focus_main, @@ -4426,12 +4451,8 @@ enum keyfuncid { kf_bar_toggle, kf_wind_kill, kf_wind_del, - kf_screenshot_all, - kf_screenshot_wind, kf_float_toggle, kf_version, - kf_spawn_lock, - kf_spawn_initscr, kf_spawn_custom, kf_iconify, kf_uniconify, @@ -4458,11 +4479,6 @@ dummykeyfunc(struct swm_region *r, union arg *args) { }; -void -legacyfunc(struct swm_region *r, union arg *args) -{ -}; - struct keyfunc { char name[SWM_FUNCNAME_LEN]; void (*func)(struct swm_region *r, union arg *); @@ -4484,7 +4500,6 @@ struct keyfunc { { "swap_next", swapwin, {.id = SWM_ARG_ID_SWAPNEXT} }, { "swap_prev", swapwin, {.id = SWM_ARG_ID_SWAPPREV} }, { "spawn_term", spawnterm, {.argv = spawn_term} }, - { "spawn_menu", legacyfunc, {0} }, { "quit", quit, {0} }, { "restart", restart, {0} }, { "focus_main", focus, {.id = SWM_ARG_ID_FOCUSMAIN} }, @@ -4542,12 +4557,8 @@ struct keyfunc { { "bar_toggle", bar_toggle, {0} }, { "wind_kill", wkill, {.id = SWM_ARG_ID_KILLWINDOW} }, { "wind_del", wkill, {.id = SWM_ARG_ID_DELETEWINDOW} }, - { "screenshot_all", legacyfunc, {0} }, - { "screenshot_wind", legacyfunc, {0} }, { "float_toggle", floating_toggle,{0} }, { "version", version, {0} }, - { "spawn_lock", legacyfunc, {0} }, - { "spawn_initscr", legacyfunc, {0} }, { "spawn_custom", dummykeyfunc, {0} }, { "iconify", iconify, {0} }, { "uniconify", uniconify, {0} }, @@ -5745,7 +5756,7 @@ setautorun(char *selector, char *value, int flags) int setlayout(char *selector, char *value, int flags) { - int ws_id, i, x, mg, ma, si, raise; + int ws_id, i, x, mg, ma, si, raise, f = 0; int st = SWM_V_STACK; char s[1024]; struct workspace *ws; @@ -5765,9 +5776,15 @@ setlayout(char *selector, char *value, int flags) if (!strcasecmp(s, "vertical")) st = SWM_V_STACK; - else if (!strcasecmp(s, "horizontal")) + else if (!strcasecmp(s, "vertical_flip")) { + st = SWM_V_STACK; + f = 1; + } else if (!strcasecmp(s, "horizontal")) + st = SWM_H_STACK; + else if (!strcasecmp(s, "horizontal_flip")) { st = SWM_H_STACK; - else if (!strcasecmp(s, "fullscreen")) + f = 1; + } else if (!strcasecmp(s, "fullscreen")) st = SWM_MAX_STACK; else errx(1, "invalid layout entry, should be 'ws[]:" @@ -5803,6 +5820,12 @@ setlayout(char *selector, char *value, int flags) SWM_ARG_ID_STACKDEC); stack(); } + /* Apply flip */ + if (f) { + ws[ws_id].cur_layout->l_config(&ws[ws_id], + SWM_ARG_ID_FLIPLAYOUT); + stack(); + } } return (0);