Skip to content

Commit ca8e9bc

Browse files
authored
add start minimized configuration (#1373)
1 parent 633e7be commit ca8e9bc

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

src/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ enum {
217217
A_DDIMAGE,
218218
A_MINCLOSE,
219219
A_SINGLETRAY,
220+
A_STARTMINIMIZED,
220221
A_CENTERED,
221222
A_SORTD,
222223
A_FOLD,

src/system.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct System {
3232
bool thinselc {true};
3333
bool minclose {false};
3434
bool singletray {false};
35+
bool startminimized {false};
3536
bool centered {true};
3637
bool fswatch {true};
3738
int autohtmlexport {0};
@@ -88,6 +89,7 @@ struct System {
8889
cfg->Read(L"followdarkmode", &followdarkmode, followdarkmode);
8990
cfg->Read(L"minclose", &minclose, minclose);
9091
cfg->Read(L"singletray", &singletray, singletray);
92+
cfg->Read(L"startminimized", &startminimized, startminimized);
9193
cfg->Read(L"centered", &centered, centered);
9294
cfg->Read(L"fswatch", &fswatch, fswatch);
9395
cfg->Read(L"casesensitivesearch", &casesensitivesearch, casesensitivesearch);

src/tsapp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ struct TSApp : wxApp {
4343
bool portable = false;
4444
bool single_instance = true;
4545
bool dump_builtins = false;
46+
bool start_minimized = false;
4647
for (int i = 1; i < argc; i++) {
4748
if (argv[i][0] == '-') {
4849
switch (static_cast<int>(argv[i][1])) {
4950
case 'p': portable = true; break;
5051
case 'i': single_instance = false; break;
52+
case 'm': start_minimized = true; break;
5153
case 'd':
5254
dump_builtins = true;
5355
single_instance = false;
@@ -72,6 +74,7 @@ struct TSApp : wxApp {
7274

7375
wxStandardPaths::Get().SetFileLayout(wxStandardPathsBase::FileLayout_XDG);
7476
sys = new System(portable);
77+
if (start_minimized) sys->startminimized = true;
7578
SetupInternationalization();
7679
frame = new TSFrame(this);
7780

src/tsframe.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,9 @@ struct TSFrame : wxFrame {
609609
A_SINGLETRAY, _(L"Single click maximize from tray"),
610610
_(L"Toggle whether only one click is required to maximize from system tray"));
611611
optmenu->Check(A_SINGLETRAY, sys->singletray);
612+
optmenu->AppendCheckItem(A_STARTMINIMIZED, _(L"Start minimized"),
613+
_(L"Start the application minimized"));
614+
optmenu->Check(A_STARTMINIMIZED, sys->startminimized);
612615
optmenu->AppendSeparator();
613616
optmenu->AppendCheckItem(A_ZOOMSCR, _(L"Swap mousewheel scrolling and zooming"));
614617
optmenu->Check(A_ZOOMSCR, sys->zoomscroll);
@@ -779,6 +782,8 @@ struct TSFrame : wxFrame {
779782
// needs to be after Show() to avoid scrollbars rendered in the wrong place?
780783
if (ismax && !IsIconized()) Maximize(true);
781784

785+
if (sys->startminimized) Iconize(true);
786+
782787
SetFileAssoc(app->exename);
783788

784789
wxSafeYield();
@@ -1158,6 +1163,7 @@ struct TSFrame : wxFrame {
11581163
case A_MAKEBAKS: sys->cfg->Write(L"makebaks", sys->makebaks = ce.IsChecked()); break;
11591164
case A_TOTRAY: sys->cfg->Write(L"totray", sys->totray = ce.IsChecked()); break;
11601165
case A_MINCLOSE: sys->cfg->Write(L"minclose", sys->minclose = ce.IsChecked()); break;
1166+
case A_STARTMINIMIZED: sys->cfg->Write(L"startminimized", sys->startminimized = ce.IsChecked()); break;
11611167
case A_ZOOMSCR: sys->cfg->Write(L"zoomscroll", sys->zoomscroll = ce.IsChecked()); break;
11621168
case A_THINSELC: sys->cfg->Write(L"thinselc", sys->thinselc = ce.IsChecked()); break;
11631169
case A_AUTOSAVE: sys->cfg->Write(L"autosave", sys->autosave = ce.IsChecked()); break;

0 commit comments

Comments
 (0)