From 5cea640a34ec64df5cc5a41eb8dca9d11e67b002 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Wed, 29 Jul 2015 17:55:26 +0200 Subject: [PATCH] Obey quiet a bit better, update manpage with signals --- doc/rofi-manpage.markdown | 15 +++++++++++++++ doc/rofi.1 | 18 ++++++++++++++++++ source/rofi.c | 39 +++++++++++++++++++++++++-------------- 3 files changed, 58 insertions(+), 14 deletions(-) diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index b12198fe..eba9bdff 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -595,6 +595,21 @@ This way it can be used as a drop-in replacement for dmenu. just copy or symlink ln -s /usr/bin/dmenu /usr/bin/rofi +## SIGNALS + +`HUP` + +If in daemon mode, reload the configuration from Xresources. (commandline arguments still -override +Xresources). This will also reload configured key-bindings. + +`INT` + +If in daemon mode, quits **rofi**. + +`USR1` + +If in daemon mode, dumps the current configuration to stdout. Similar to `-xresources-dump` + ## THEMING With **rofi** 0.15.4 we have a new way of specifying colors, the old settings still apply (for now). diff --git a/doc/rofi.1 b/doc/rofi.1 index bf2b3ae1..658aaa2c 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -1071,6 +1071,24 @@ ln \-s /usr/bin/dmenu /usr/bin/rofi . .IP "" 0 . +.SH "SIGNALS" +\fBHUP\fR +. +.P +If in daemon mode, reload the configuration from Xresources\. (commandline arguments still \-override Xresources)\. This will also reload configured key\-bindings\. +. +.P +\fBINT\fR +. +.P +If in daemon mode, quits \fBrofi\fR\. +. +.P +\fBUSR1\fR +. +.P +If in daemon mode, dumps the current configuration to stdout\. Similar to \fB\-xresources\-dump\fR +. .SH "THEMING" With \fBrofi\fR 0\.15\.4 we have a new way of specifying colors, the old settings still apply (for now)\. To enable the new setup, set \fBrofi\.color\-enabled\fR to true\. The new setup allows you to specify colors per state, similar to \fBi3\fR Currently 3 states exists: . diff --git a/source/rofi.c b/source/rofi.c index b0a33da6..fad16a83 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1827,6 +1827,21 @@ static int grab_global_keybindings () } return key_bound; } +static void print_global_keybindings () +{ + fprintf ( stdout, "Rofi is launched in daemon mode.\n" ); + fprintf ( stdout, "listening to the following keys:\n" ); + for ( unsigned int i = 0; i < num_switchers; i++ ) { + if ( switchers[i]->keystr != NULL ) { + fprintf ( stdout, "\t* "color_bold "%s"color_reset " on %s\n", + switchers[i]->name, switchers[i]->keystr ); + } + else { + fprintf ( stdout, "\t* "color_bold "%s"color_reset " on \n", + switchers[i]->name ); + } + } +} static void reload_configuration () { @@ -2026,18 +2041,7 @@ int main ( int argc, char *argv[] ) return EXIT_FAILURE; } if ( !quiet ) { - fprintf ( stdout, "Rofi is launched in daemon mode.\n" ); - fprintf ( stdout, "listening to the following keys:\n" ); - for ( unsigned int i = 0; i < num_switchers; i++ ) { - if ( switchers[i]->keystr != NULL ) { - fprintf ( stdout, "\t* "color_bold "%s"color_reset " on %s\n", - switchers[i]->name, switchers[i]->keystr ); - } - else { - fprintf ( stdout, "\t* "color_bold "%s"color_reset " on \n", - switchers[i]->name ); - } - } + print_global_keybindings (); } @@ -2090,13 +2094,18 @@ int main ( int argc, char *argv[] ) read ( pfds[0], &c, 1 ); // Reload configuration. if ( c == 'c' ) { - fprintf ( stdout, "Reload configuration\n" ); + if ( !quiet ) { + fprintf ( stdout, "Reload configuration\n" ); + } // Release the keybindings. release_global_keybindings (); // Reload config reload_configuration (); // Grab the possibly new keybindings. grab_global_keybindings (); + if ( !quiet ) { + print_global_keybindings (); + } XFlush ( display ); } // Got message to quit. @@ -2119,7 +2128,9 @@ int main ( int argc, char *argv[] ) // Close pipe close ( pfds[0] ); close ( pfds[1] ); - fprintf ( stdout, "Quit from daemon mode.\n" ); + if(!quiet) { + fprintf ( stdout, "Quit from daemon mode.\n" ); + } } return EXIT_SUCCESS;