summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2020-01-13 20:19:25 +0100
committerDave Davenport <qball@gmpclient.org>2020-01-13 20:19:25 +0100
commit209ed795effb6756e2f963796af249176245b524 (patch)
treef16b5d3010702b49475a859acbb964795637bcee
parent8a522cd64deb6d0e4a86f5f37907a717c9c9ccd0 (diff)
Send signal when already running..dontquit
-rw-r--r--source/helper.c6
-rw-r--r--source/rofi.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/source/helper.c b/source/helper.c
index 02bddc29..3ce32ebb 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -508,6 +508,12 @@ int create_pid_file ( const char *pidfile )
if ( retv != 0 ) {
g_warning ( "Failed to set lock on pidfile: Rofi already running?" );
g_warning ( "Got error: %d %s", retv, g_strerror ( errno ) );
+ char buffer[32];
+ if (read ( fd, buffer, 32) > 0 ){
+ printf("%s\r\n", buffer);
+ pid_t pid = strtol ( buffer, NULL, 10);
+ kill (pid, SIGUSR1);
+ }
remove_pid_file ( fd );
return -1;
}
diff --git a/source/rofi.c b/source/rofi.c
index b71710bc..1a651761 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -637,8 +637,11 @@ static gboolean setup_modi ( void )
**/
void rofi_quit_main_loop ( void )
{
- rofi_view_hide();
- //g_main_loop_quit ( main_loop );
+ if ( find_arg ( "-daemon") ) {
+ rofi_view_hide();
+ } else {
+ g_main_loop_quit ( main_loop );
+ }
}
static gboolean main_loop_signal_handler_int ( G_GNUC_UNUSED gpointer data )