Add autostart argument

This commit is contained in:
Craig Everett 2025-08-14 11:11:00 +09:00
parent ff538018c5
commit 9b88ac7a90
7 changed files with 20 additions and 8 deletions

View File

@ -3,6 +3,6 @@
{registered,[]}, {registered,[]},
{included_applications,[]}, {included_applications,[]},
{applications,[stdlib,kernel]}, {applications,[stdlib,kernel]},
{vsn,"0.2.11"}, {vsn,"0.3.0"},
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]}, {modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
{mod,{gajumine,[]}}]}. {mod,{gajumine,[]}}]}.

View File

@ -3,7 +3,7 @@
%%% @end %%% @end
-module(gajumine). -module(gajumine).
-vsn("0.2.11"). -vsn("0.3.0").
-behavior(application). -behavior(application).
-author("Craig Everett <craigeverett@qpq.swiss>"). -author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>"). -copyright("QPQ AG <craigeverett@qpq.swiss>").

View File

@ -3,7 +3,7 @@
%%% @end %%% @end
-module(gmc_con). -module(gmc_con).
-vsn("0.2.11"). -vsn("0.3.0").
-author("Craig Everett <craigeverett@qpq.swiss>"). -author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>"). -copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later"). -license("GPL-3.0-or-later").
@ -136,6 +136,11 @@ start_gui(State = #s{acc = none}) ->
start_gui(State = #s{acc = AccID}) -> start_gui(State = #s{acc = AccID}) ->
Window = gmc_gui:start_link(#{}), Window = gmc_gui:start_link(#{}),
ok = gmc_gui:set_account(AccID), ok = gmc_gui:set_account(AccID),
ok =
case lists:member("autostart", zx_daemon:argv()) of
false -> ok;
true -> gmc_gui:start_stop()
end,
State#s{window = Window}. State#s{window = Window}.

View File

@ -3,7 +3,7 @@
%%% @end %%% @end
-module(gmc_conf). -module(gmc_conf).
-vsn("0.2.11"). -vsn("0.3.0").
-author("Craig Everett <craigeverett@qpq.swiss>"). -author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>"). -copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later"). -license("GPL-3.0-or-later").

View File

@ -3,14 +3,14 @@
%%% @end %%% @end
-module(gmc_gui). -module(gmc_gui).
-vsn("0.2.11"). -vsn("0.3.0").
-author("Craig Everett <craigeverett@qpq.swiss>"). -author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>"). -copyright("QPQ AG <craigeverett@qpq.swiss>").
-license("GPL-3.0-or-later"). -license("GPL-3.0-or-later").
-behavior(wx_object). -behavior(wx_object).
-include_lib("wx/include/wx.hrl"). -include_lib("wx/include/wx.hrl").
-export([ask_conf/0, set_account/1, difficulty/1, speed/1, candidate/1, message/1]). -export([ask_conf/0, set_account/1, difficulty/1, speed/1, candidate/1, message/1, start_stop/0]).
-export([start_link/1]). -export([start_link/1]).
-export([init/1, terminate/2, code_change/3, -export([init/1, terminate/2, code_change/3,
handle_call/3, handle_cast/2, handle_info/2, handle_event/2]). handle_call/3, handle_cast/2, handle_info/2, handle_event/2]).
@ -79,6 +79,10 @@ message(Terms) ->
wx_object:cast(?MODULE, {message, Terms}). wx_object:cast(?MODULE, {message, Terms}).
start_stop() ->
wx_object:cast(?MODULE, start_stop).
%%% Startup Functions %%% Startup Functions
@ -187,6 +191,9 @@ handle_cast({candidate, Block}, State) ->
handle_cast({message, Terms}, State) -> handle_cast({message, Terms}, State) ->
NewState = do_message(Terms, State), NewState = do_message(Terms, State),
{noreply, NewState}; {noreply, NewState};
handle_cast(start_stop, State) ->
NewState = start_stop(State),
{noreply, NewState};
handle_cast(Unexpected, State) -> handle_cast(Unexpected, State) ->
ok = log(warning, "Unexpected cast: ~tp~n", [Unexpected]), ok = log(warning, "Unexpected cast: ~tp~n", [Unexpected]),
{noreply, State}. {noreply, State}.

View File

@ -12,7 +12,7 @@
%%% @end %%% @end
-module(gmc_sup). -module(gmc_sup).
-vsn("0.2.11"). -vsn("0.3.0").
-behaviour(supervisor). -behaviour(supervisor).
-author("Craig Everett <craigeverett@qpq.swiss>"). -author("Craig Everett <craigeverett@qpq.swiss>").
-copyright("QPQ AG <craigeverett@qpq.swiss>"). -copyright("QPQ AG <craigeverett@qpq.swiss>").

View File

@ -4,7 +4,7 @@
{prefix,"gmc"}. {prefix,"gmc"}.
{author,"Craig Everett"}. {author,"Craig Everett"}.
{desc,"Mining client for the Gajumaru Root"}. {desc,"Mining client for the Gajumaru Root"}.
{package_id,{"qpq","gajumine",{0,2,11}}}. {package_id,{"qpq","gajumine",{0,3,0}}}.
{deps,[{"qpq","cuckoo_cpu",{0,3,2}}, {deps,[{"qpq","cuckoo_cpu",{0,3,2}},
{"uwiger","gmhive_worker",{0,4,0}}, {"uwiger","gmhive_worker",{0,4,0}},
{"uwiger","gmhive_client",{0,4,4}}, {"uwiger","gmhive_client",{0,4,4}},