Skip to content

Commit

Permalink
Add "start-hidden" command line option
Browse files Browse the repository at this point in the history
  • Loading branch information
rozhuk-im committed May 11, 2021
1 parent 82ac282 commit f4193b5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gtk-mixer.project
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<Compiler Options="-g;-O0;-Wall" C_Options="-Weverything;-ftrapv;-g -DDEBUG;-O0;-fwrapv;-fstack-protector-all;-Wall;-g3 -ggdb;-Wno-reserved-id-macro;-Wno-gnu-zero-variadic-macro-arguments;-Wno-variadic-macros;-Wno-documentation;-Wno-documentation-unknown-command;-Wno-padded;-Wno-cast-qual" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"/>
<Linker Options="" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="$(ProjectPath)/build/src/" Command="$(OutputFile)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="$(ProjectPath)/build/src/" Command="$(OutputFile)" CommandArguments="--start-hidden" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<BuildSystem Name="Default"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
Expand Down
17 changes: 16 additions & 1 deletion src/gtk-mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <err.h>
#include <errno.h>
#include <inttypes.h>
#include <getopt.h>

#include "gtk-mixer.h"

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f4193b5

Please sign in to comment.