summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-03-31 13:59:46 +0200
committerDave Davenport <qball@gmpclient.org>2017-03-31 13:59:46 +0200
commit18618ddbd1a03e673656471219962fce5fe9bd24 (patch)
treef30eeb617e4ffeff92489e2618f45d0cfc9e738c
parent9ae1344d565e670626ccb6fe27bf731ba47fdbe0 (diff)
When modi is not enabled, only print warning when started from console
-rw-r--r--source/rofi.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source/rofi.c b/source/rofi.c
index e7583b33..b165a41a 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -339,6 +339,18 @@ static void help ( G_GNUC_UNUSED int argc, char **argv )
}
}
+static void help_print_disabled_mode ( const char *mode )
+{
+ int is_term = isatty ( fileno ( stdout ) );
+ // Only output to terminal
+ if ( is_term ) {
+ fprintf ( stderr, "Mode %s%s%s is not enabled. I have enabled it for now.\n",
+ color_red, mode, color_reset);
+ fprintf ( stderr, "Please consider adding %s%s%s to the %smodi%s option.\n",
+ color_red, mode, color_reset,
+ color_green, color_reset);
+ }
+}
static void help_print_no_arguments ( void )
{
int is_term = isatty ( fileno ( stdout ) );
@@ -371,7 +383,8 @@ static void help_print_no_arguments ( void )
is_term ? color_reset : "" );
}
}
- fprintf ( stderr, "\nTo activate a mode, add it to the list of modi in the 'modi' setting." );
+ fprintf ( stderr, "\nTo activate a mode, add it to the list of modi in the %smodi%s setting.",
+ is_term?color_green:"",is_term?color_reset:"" );
}
/**
@@ -823,9 +836,7 @@ static gboolean startup ( G_GNUC_UNUSED gpointer data )
index = add_mode ( sname );
// Complain
if ( index >= 0 ) {
- fprintf ( stdout, "Mode %s not enabled. Please add it to the list of enabled modi: %s\n",
- sname, config.modi );
- fprintf ( stdout, "Adding mode: %s\n", sname );
+ help_print_disabled_mode ( sname );
}
// Run it anyway if found.
}