Skip to content

Starting uchmviewer minimised #55

@u-235

Description

@u-235

Discussed in #53

Originally posted by perdrix52 July 5, 2025
Because QtWebEngine is so large and takes while to load, I am trying to start uchmviewer minimised as my application starts in the hope that when the user presses Command + ? that it will open instantly.

The initial invocation is uchmviewer -token com.github.deepskystacker -background

When the user actually invokes the help: uchmviewer -token com.github.deepskystacker path/DeepSkyStacker Help.chm

is that how I should be doing it?

Full code :

void DeepSkyStacker::help(bool startInBackground)
{
	ZFUNCTRACE_RUNTIME();
	QString appPath{ QCoreApplication::applicationDirPath() };
#if defined(Q_OS_WIN) || defined(Q_OS_LINUX)
	QString helpFile{ appPath + "/Help/" + tr("DeepSkyStacker Help.chm","IDS_HELPFILE") };
#elif defined(Q_OS_MACOS)
	QString helpFile{ appPath + "/../Resources/" + tr("DeepSkyStacker Help.chm","IDS_HELPFILE") };
#endif

#if defined(Q_OS_LINUX)
	// On Linux, we use the kchmviewer application to display the help file
	QString program{ "kchmviewer" };
#elif defined(Q_OS_MACOS)
	// On macOS, we use the uchmviewer application to display the help file
	// which we've bundled with the application
	QString program{ appPath + "/uchmviewer" };
#endif

#if defined(Q_OS_WIN)
	::HtmlHelp(::GetDesktopWindow(), helpFile.toStdWString().c_str(), HH_DISPLAY_TOPIC, 0);
#elif defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
	//
	// On Linux and macOS, we use a QProcess to start the help viewer
	//	
	if (!helpProcess)
	{
		helpProcess = new QProcess(this);
		connect(helpProcess, &QProcess::finished, helpProcess, &QProcess::deleteLater);
	}
	QStringList arguments{ "-token", "com.github.deepskystacker" };
#if defined(Q_OS_MACOS)
	if (startInBackground)
	{
		arguments << "-background";
	}
	else
	{
		arguments << helpFile;	
	}
#else
	arguments << helpFile;
#endif

	helpProcess->startDetached(program, arguments);
#endif
}

Thanks
David


When I tested that the initial invocation of uchmviewer was NOT minimised - it opened in front of my application.
If I then minimised it, and then invoked the help for real, it stayed minimised and I needed to restore it to see the help.

That doesn't seem right...

If relevant this is macOS


I changed the code to specify the name of the help file (.chm) on the initial invocation, and that now starts and minimises (but does show initially is there any way to prevent that)?

However when I then invoke it again without the -background option specifying the same .chm file it doesn't restore the minimised application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions