1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2025-07-31 21:59:25 -04:00

[Rofi] Move the commandline no argument msg to a popup.

This commit is contained in:
Dave Davenport 2022-05-06 15:25:32 +02:00
parent ff21d7a32d
commit 6f971e1110

View file

@ -414,19 +414,17 @@ static void help_print_mode_not_found(const char *mode) {
rofi_add_error_message(str); rofi_add_error_message(str);
} }
static void help_print_no_arguments(void) { static void help_print_no_arguments(void) {
int is_term = isatty(fileno(stdout));
// Daemon mode GString *emesg = g_string_new("<span size=\"x-large\">Rofi is unsure what to show.</span>\n\n");
fprintf(stderr, "Rofi is unsure what to show.\n"); g_string_append(emesg, "Please specify the mode you want to show.\n\n");
fprintf(stderr, "Please specify the mode you want to show.\n\n"); g_string_append(
fprintf(stderr, " %srofi%s -show %s{mode}%s\n\n", emesg, " <b>rofi</b> -show <span color=\"green\">{mode}</span>\n\n");
is_term ? color_bold : "", is_term ? color_reset : "", g_string_append(emesg, "The following modes are enabled:\n");
is_term ? color_green : "", is_term ? color_reset : "");
fprintf(stderr, "The following modes are enabled:\n");
for (unsigned int j = 0; j < num_modes; j++) { for (unsigned int j = 0; j < num_modes; j++) {
fprintf(stderr, " * %s%s%s\n", is_term ? color_green : "", modes[j]->name, g_string_append_printf(emesg, " • <span color=\"green\">%s</span>\n",
is_term ? color_reset : ""); modes[j]->name);
} }
fprintf(stderr, "\nThe following can be enabled:\n"); g_string_append(emesg, "\nThe following modes can be enabled:\n");
for (unsigned int i = 0; i < num_available_modes; i++) { for (unsigned int i = 0; i < num_available_modes; i++) {
gboolean active = FALSE; gboolean active = FALSE;
for (unsigned int j = 0; j < num_modes; j++) { for (unsigned int j = 0; j < num_modes; j++) {
@ -436,14 +434,15 @@ static void help_print_no_arguments(void) {
} }
} }
if (!active) { if (!active) {
fprintf(stderr, " * %s%s%s\n", is_term ? color_red : "", g_string_append_printf(emesg, " • <span color=\"red\">%s</span>\n",
available_modes[i]->name, is_term ? color_reset : ""); available_modes[i]->name);
} }
} }
fprintf(stderr, g_string_append(emesg, "\nTo activate a mode, add it to the list in "
"\nTo activate a mode, add it to the list of modes in the %smodes%s " "the <span color=\"green\">modes</span> "
"setting.\n", "setting.\n");
is_term ? color_green : "", is_term ? color_reset : ""); rofi_view_error_dialog(emesg->str, ERROR_MSG_MARKUP);
rofi_set_return_code(EXIT_SUCCESS);
} }
/** /**
@ -755,7 +754,7 @@ static gboolean startup(G_GNUC_UNUSED gpointer data) {
} else { } else {
help_print_no_arguments(); help_print_no_arguments();
g_main_loop_quit(main_loop); // g_main_loop_quit(main_loop);
} }
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;