From f4193b54085136afb5f0b6ee44aa2847664c1c04 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Tue, 11 May 2021 17:16:43 +0300 Subject: [PATCH] Add "start-hidden" command line option --- gtk-mixer.project | 2 +- src/gtk-mixer.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gtk-mixer.project b/gtk-mixer.project index 15a61c6..7e8b732 100644 --- a/gtk-mixer.project +++ b/gtk-mixer.project @@ -43,7 +43,7 @@ - + diff --git a/src/gtk-mixer.c b/src/gtk-mixer.c index e27d0f9..9efeb3e 100644 --- a/src/gtk-mixer.c +++ b/src/gtk-mixer.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "gtk-mixer.h" @@ -225,11 +226,21 @@ gtk_mixer_status_icon_menu(GtkStatusIcon *status_icon __unused, int main(int argc, char **argv) { int error; + int ch, opt_idx = -1, start_hidden = 0; gm_app_t app; gmp_dev_p dev = NULL; + struct option long_options[] = { + { "start-hidden", no_argument, &start_hidden, 1 }, + { NULL, 0, NULL, 0 } + }; memset(&app, 0x00, sizeof(gm_app_t)); + while ((ch = getopt_long_only(argc, argv, "", long_options, + &opt_idx)) != -1) { + } + + error = gmp_init(&app.plugins, &app.plugins_count); if (0 != error) return (error); @@ -279,7 +290,11 @@ main(int argc, char **argv) { gtk_mixer_soundcard_changed(NULL, &app); /* Display the mixer window. */ - gtk_window_present(GTK_WINDOW(app.window)); + if (start_hidden) { + gtk_widget_hide(app.window); + } else { + gtk_window_present(GTK_WINDOW(app.window)); + } /* For update, if volume changed from other app. */ g_timeout_add(UPDATE_INTERVAL,