Skip to content

Open URLs in Private Mode / Incognito#9694

Open
varjolintu wants to merge 1 commit intokeepassxreboot:developfrom
varjolintu:feature/open_url_in_private_mode
Open

Open URLs in Private Mode / Incognito#9694
varjolintu wants to merge 1 commit intokeepassxreboot:developfrom
varjolintu:feature/open_url_in_private_mode

Conversation

@varjolintu
Copy link
Copy Markdown
Member

Adds a new menu item and keyboard shortcut for opening a URL using Private Mode / Incognito with the operating system default browser.

  • Linux/Unix retrieves the application from xdg-settings
  • macOS is using direct NSWorkspace::URLForApplicationToOpenURL() call
  • Windows retrieves the path from registry entries associated with the URL scheme

With Firefox based browsers Firefox itself and Librewolf are detected automatically to use -private-window command line parameter. Chromium-based browsers will use -incognito

Fixes #9468.

Testing strategy

Manually.

Type of change

  • ✅ New feature (change that adds functionality)

@varjolintu varjolintu added this to the v2.8.0 milestone Aug 5, 2023
Comment thread src/gui/PrivateBrowser.cpp Outdated
.arg(url.scheme());
QSettings defaultBrowserRegistry(registryPath, QSettings::NativeFormat);
auto defaultBrowser = defaultBrowserRegistry.value("ProgId").toString();
if (defaultBrowser.isEmpty()) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible for UserChoice not to exist, then you must find the progid the classic way.

}

// Get the executable path from program ID
registryPath = QString("HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\%1\\shell\\open\\command").arg(defaultBrowser);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HKEY_CLASSES_ROOT

return (settings.value("Flags").toInt() & 1u) != 0;
}

QString WinUtils::getDefaultApplicationForUrl(const QUrl& url)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for this incorrect registry handling, just call AssocQueryStringW(ASSOCF_NOTRUNCATE | ASSOCF_INIT_IGNOREUNKNOWN, ASSOCSTR_EXECUTABLE, L"http", 0, ...)

@droidmonkey droidmonkey modified the milestones: v2.8.0, v2.7.10 Aug 19, 2024
@phoerious phoerious added pr: new feature Pull request adds a new feature and removed new feature labels Nov 22, 2024
@droidmonkey droidmonkey modified the milestones: v2.7.10, v2.8.0 Feb 1, 2025
@varjolintu varjolintu force-pushed the feature/open_url_in_private_mode branch from c68bcbd to 920092f Compare May 4, 2026 14:15
@varjolintu varjolintu force-pushed the feature/open_url_in_private_mode branch from 920092f to e3ce99e Compare May 4, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: new feature Pull request adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to open URL in Incognito / Private Mode

4 participants