Reload on SIGHUP
ratiueratuie rstiure tiurest aruite rautie rautier tiue rtaruit ratiuera This patch makes surf reload its pages when it receives a SIGHUP signal. This makes it easier for shell scripts to trigger surf to reload. I'm aware of using xdotool to trigger ctrl+r keypresses for reloading but I wasn't able to get that to work in a general way. [1] I'm sending this here in case surf maintainers and users would like to include this in core - if not I will submit it to the wiki. Regards, Charles [1] http://surf.suckless.org/files/autorefresh Signed-off-by: Christoph Lohmann <20h@r-36.net>
This commit is contained in:
parent
4c41d363b7
commit
c64c368d86
14
surf.c
14
surf.c
|
@ -145,6 +145,7 @@ static void usage(void);
|
||||||
static void die(const char *errstr, ...);
|
static void die(const char *errstr, ...);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
static void sigchld(int unused);
|
static void sigchld(int unused);
|
||||||
|
static void sighup(int unused);
|
||||||
static char *buildfile(const char *path);
|
static char *buildfile(const char *path);
|
||||||
static char *buildpath(const char *path);
|
static char *buildpath(const char *path);
|
||||||
static const char *getuserhomedir(const char *user);
|
static const char *getuserhomedir(const char *user);
|
||||||
|
@ -266,6 +267,9 @@ setup(void)
|
||||||
|
|
||||||
/* clean up any zombies immediately */
|
/* clean up any zombies immediately */
|
||||||
sigchld(0);
|
sigchld(0);
|
||||||
|
if (signal(SIGHUP, sighup) == SIG_ERR)
|
||||||
|
die("Can't install SIGHUP handler");
|
||||||
|
|
||||||
gtk_init(NULL, NULL);
|
gtk_init(NULL, NULL);
|
||||||
|
|
||||||
gdpy = gdk_display_get_default();
|
gdpy = gdk_display_get_default();
|
||||||
|
@ -331,6 +335,16 @@ sigchld(int unused)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sighup(int unused)
|
||||||
|
{
|
||||||
|
Arg a = { .b = 0 };
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for (c = clients; c; c = c->next)
|
||||||
|
reload(c, &a);
|
||||||
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
buildfile(const char *path)
|
buildfile(const char *path)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue