X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=bc149b348b720829f5df7e6b62696f2711e88742;hb=32b3198dcd34fce94e14fc8c5ac01f20ce309fa6;hp=62f4c2530970e4c99824967228cb08488ea0ffef;hpb=fa06bf8d4b416a521c3bbb87ad4f6efd47dd0eae;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 62f4c25..bc149b3 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -175,7 +175,7 @@ char *bar_fonts[] = { /* terminal + args */ char *spawn_term[] = { "xterm", NULL }; -char *spawn_screenshot[] = { "scrot", NULL, NULL }; /* XXX get from conf */ +char *spawn_screenshot[] = { "screenshot.sh", NULL, NULL }; /* XXX get from conf */ char *spawn_menu[] = { "dmenu_run", "-fn", NULL, "-nb", NULL, "-nf", NULL, "-sb", NULL, "-sf", NULL, NULL }; @@ -785,6 +785,8 @@ find_window(Window id) void spawn(struct swm_region *r, union arg *args) { + char *ret; + DNPRINTF(SWM_D_MISC, "spawn: %s\n", args->argv[0]); /* * The double-fork construct avoids zombie processes and keeps the code @@ -792,14 +794,17 @@ spawn(struct swm_region *r, union arg *args) */ if (fork() == 0) { if (fork() == 0) { - char *ret; if (display) close(ConnectionNumber(display)); setenv("LD_PRELOAD", SWM_LIB, 1); - if (asprintf(&ret, "%d", r->ws->idx)) + if (asprintf(&ret, "%d", r->ws->idx)) { setenv("_SWM_WS", ret, 1); - if (asprintf(&ret, "%d", getpid())) + free(ret); + } + if (asprintf(&ret, "%d", getpid())) { setenv("_SWM_PID", ret, 1); + free(ret); + } setsid(); execvp(args->argv[0], args->argv); fprintf(stderr, "execvp failed\n"); @@ -1145,6 +1150,7 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) int i, j, w_inc, h_inc, w_base, h_base; int hrh, extra, h_slice, last_h = 0; int split, colno, winno, mwin, msize, mscale; + int remain, missing, v_slice;; unsigned int mask; DNPRINTF(SWM_D_STACK, "stack_master: workspace: %d\n rot=%s flip=%s", @@ -1174,7 +1180,7 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) h_slice = r_g.h / SWM_H_SLICE; if (mwin && winno > mwin) { - int v_slice = r_g.w / SWM_V_SLICE; + v_slice = r_g.w / SWM_V_SLICE; split = mwin; colno = split; @@ -1182,8 +1188,8 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) if (w_inc > 1 && w_inc < v_slice) { /* adjust for window's requested size increment */ - int remain = (win_g.w - w_base) % w_inc; - int missing = w_inc - remain; + remain = (win_g.w - w_base) % w_inc; + missing = w_inc - remain; if (missing <= extra || j == 0) { extra -= missing; @@ -1230,8 +1236,8 @@ stack_master(struct workspace *ws, struct swm_geometry *g, int rot, int flip) win_g.h = hrh + extra; } else if (h_inc > 1 && h_inc < h_slice) { /* adjust for window's requested size increment */ - int remain = (win_g.h - h_base) % h_inc; - int missing = h_inc - remain; + remain = (win_g.h - h_base) % h_inc; + missing = h_inc - remain; if (missing <= extra || j == 0) { extra -= missing; @@ -1470,10 +1476,10 @@ screenshot(struct swm_region *r, union arg *args) switch (args->id) { case SWM_ARG_ID_SS_ALL: - spawn_screenshot[1] = "-m"; + spawn_screenshot[1] = "full"; break; case SWM_ARG_ID_SS_WINDOW: - spawn_screenshot[1] = "-s"; /* XXX doesn't work with scrot */ + spawn_screenshot[1] = "window"; break; default: return;