mirror of
https://github.com/vale981/spectrwm
synced 2025-03-05 09:51:38 -05:00
open /dev/null on stdin during spawn. pointed out by mcbride and it fixes
mplayer when launched from firefox and when firefox was launched from dmenu Also move focus to the bottom of manage_window.
This commit is contained in:
parent
197abc3a5b
commit
a912ad3965
1 changed files with 13 additions and 5 deletions
18
scrotwm.c
18
scrotwm.c
|
@ -176,8 +176,8 @@ char *bar_fonts[] = {
|
|||
/* terminal + args */
|
||||
char *spawn_term[] = { "xterm", NULL };
|
||||
char *spawn_screenshot[] = { "screenshot.sh", NULL, NULL };
|
||||
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 };
|
||||
|
||||
#define SWM_MENU_FN (2)
|
||||
#define SWM_MENU_NB (4)
|
||||
|
@ -804,6 +804,7 @@ void
|
|||
spawn(struct swm_region *r, union arg *args)
|
||||
{
|
||||
char *ret;
|
||||
int si;
|
||||
|
||||
DNPRINTF(SWM_D_MISC, "spawn: %s\n", args->argv[0]);
|
||||
/*
|
||||
|
@ -824,6 +825,12 @@ spawn(struct swm_region *r, union arg *args)
|
|||
free(ret);
|
||||
}
|
||||
setsid();
|
||||
/* kill stdin, mplayer, ssh-add etc. need that */
|
||||
si = open("/dev/null", O_RDONLY, 0);
|
||||
if (si == -1)
|
||||
err(1, "open /dev/null");
|
||||
if (dup2(si, 0) == -1)
|
||||
err(1, "dup2 /dev/null");
|
||||
execvp(args->argv[0], args->argv);
|
||||
fprintf(stderr, "execvp failed\n");
|
||||
perror(" failed");
|
||||
|
@ -1789,9 +1796,6 @@ manage_window(Window id)
|
|||
win->s = r->s; /* this never changes */
|
||||
TAILQ_INSERT_TAIL(&ws->winlist, win, entry);
|
||||
|
||||
/* make new win focused */
|
||||
focus_win(win);
|
||||
|
||||
XGetTransientForHint(display, win->id, &trans);
|
||||
if (trans) {
|
||||
win->transient = trans;
|
||||
|
@ -1836,6 +1840,10 @@ manage_window(Window id)
|
|||
|
||||
set_win_state(win, NormalState);
|
||||
|
||||
/* make new win focused */
|
||||
focus_win(win);
|
||||
|
||||
|
||||
return (win);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue