Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Do screenshots and add example script for it.
[spectrwm.git]
/
scrotwm.c
diff --git
a/scrotwm.c
b/scrotwm.c
index
62f4c25
..
bc149b3
100644
(file)
--- a/
scrotwm.c
+++ b/
scrotwm.c
@@
-175,7
+175,7
@@
char *bar_fonts[] = {
/* terminal + args */
char *spawn_term[] = { "xterm", NULL };
/* 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 };
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)
{
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
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) {
*/
if (fork() == 0) {
if (fork() == 0) {
- char *ret;
if (display)
close(ConnectionNumber(display));
setenv("LD_PRELOAD", SWM_LIB, 1);
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);
setenv("_SWM_WS", ret, 1);
- if (asprintf(&ret, "%d", getpid()))
+ free(ret);
+ }
+ if (asprintf(&ret, "%d", getpid())) {
setenv("_SWM_PID", ret, 1);
setenv("_SWM_PID", ret, 1);
+ free(ret);
+ }
setsid();
execvp(args->argv[0], args->argv);
fprintf(stderr, "execvp failed\n");
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 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",
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) {
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;
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 */
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;
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 */
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;
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:
switch (args->id) {
case SWM_ARG_ID_SS_ALL:
- spawn_screenshot[1] = "-m";
+ spawn_screenshot[1] = "full";
break;
case SWM_ARG_ID_SS_WINDOW:
break;
case SWM_ARG_ID_SS_WINDOW:
- spawn_screenshot[1] = "-s"; /* XXX doesn't work with scrot */
+ spawn_screenshot[1] = "window";
break;
default:
return;
break;
default:
return;