From b74db4ae1dba861e1af69a920a85fd425c8fdc52 Mon Sep 17 00:00:00 2001 From: maxprograms Date: Wed, 18 Feb 2026 21:26:00 -0500 Subject: [PATCH 1/2] Added default value for the new setting in the defaultOptions object, registered the new setting in the options object, added a checkbox in the Advanced Options section for the new setting, and modified initializeOnDomReady to check the setting and show the hints when it's enabled. --- content_scripts/vimium_frontend.js | 29 +++++++++++++++++++++++++++-- lib/settings.js | 1 + pages/options.html | 9 +++++++++ pages/options.js | 1 + 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/content_scripts/vimium_frontend.js b/content_scripts/vimium_frontend.js index c4d5331ec..9cb1ca147 100644 --- a/content_scripts/vimium_frontend.js +++ b/content_scripts/vimium_frontend.js @@ -250,7 +250,7 @@ const onFocus = forTrusted(function (event) { globalThis.addEventListener("focus", onFocus, true); globalThis.addEventListener("hashchange", checkEnabledAfterURLChange, true); -async function initializeOnDomReady() { +/*async function initializeOnDomReady() { // Tell the background page we're in the domReady state. await chrome.runtime.sendMessage({ handler: "domReady" }); @@ -264,8 +264,33 @@ async function initializeOnDomReady() { DomUtils.injectUserCss(); Vomnibar.activate(0, {}); } -} +}*/ + +async function initializeOnDomReady(){ + // Tell the background page we're in the domReady state. + await chrome.runtime.sendMessage({handler: "domReady"}); + + const isVimiumNewTabPage = document.location.href == Settings.vimiumNewTabPageUrl; + + //Ensure Settings are loaded before accessing them. + await Settings.onLoaded(); + //On Vimium's new-tab page, optionally show the Vomnibar. + if(isVimiumNewTabPage) { + if (Settings.get("openVomnibarOnNewTabPage")){ + await Utils.populateBrowserInfo(); + DomUtils.injectUserCss(); + Vomnibar.activate(0, {}); + } + } + + // Automatically enter link-hints mode on page load if enabled in settings. + // Just mirrors what happens when user presses "f" on page load. + if (isEnabledForUrl && Settings.get("autoActivateLinkHints") && globalThis.LinkHints){ + // Pass an empty options obbject so activateMode's destructing succeeds. + globalThis.LinkHints.activateMode(1, {}); + } +} const onUnload = Utils.makeIdempotent(() => { HintCoordinator.exit({ isSuccess: false }); handlerStack.reset(); diff --git a/lib/settings.js b/lib/settings.js index 569ba4f5d..91e96277f 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -80,6 +80,7 @@ w: https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedi waitForEnterForFilteredHints: true, helpDialog_showAdvancedCommands: false, ignoreKeyboardLayout: false, + autoActivateLinkHints: false, }; /* diff --git a/pages/options.html b/pages/options.html index 1cc84fa90..8f285257b 100644 --- a/pages/options.html +++ b/pages/options.html @@ -173,6 +173,15 @@

When enabled, the HUD will not be displayed in insert mode.
+ +

+ +
+ When enabled, Vimium will behave as if you pressed f after each page loads. +