aboutsummaryrefslogtreecommitdiff
path: root/modules/firefox.home
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-08-21 21:32:25 +0530
committerAkshay Nair <phenax5@gmail.com>2024-08-21 21:32:25 +0530
commit397f3cdf4862c2912212a00cd799a920b654aa8a (patch)
tree1608ff3dc7c97d06d01b6ab1a80fa082cf2669ea /modules/firefox.home
parent1491b71d692a19d11fa2f6bbe25b021303a93bea (diff)
downloadnixos-config-397f3cdf4862c2912212a00cd799a920b654aa8a.tar.gz
nixos-config-397f3cdf4862c2912212a00cd799a920b654aa8a.zip
Move firefox config to autoconfig.js file
Diffstat (limited to 'modules/firefox.home')
-rw-r--r--modules/firefox.home/autoconfig.js10
-rw-r--r--modules/firefox.home/chrome/customNewTab.uc.js38
-rw-r--r--modules/firefox.home/chrome/globalKeybindings.uc.js1
-rw-r--r--modules/firefox.home/chrome/setupNewTab.uc.js20
-rw-r--r--modules/firefox.home/default.nix8
5 files changed, 47 insertions, 30 deletions
diff --git a/modules/firefox.home/autoconfig.js b/modules/firefox.home/autoconfig.js
index cc74675..a5744d2 100644
--- a/modules/firefox.home/autoconfig.js
+++ b/modules/firefox.home/autoconfig.js
@@ -2,9 +2,10 @@
pref('general.config.sandbox_enabled', false);
pref('general.config.obscure_value', 0);
+pref('svg.context-properties.content.enabled', true);
lockPref('xpinstall.signatures.required', false);
lockPref('extensions.install_origins.enabled', false);
-lockPref("extensions.experiments.enabled", true);
+lockPref('extensions.experiments.enabled', true);
// Setup user chrome support
try {
@@ -22,3 +23,10 @@ try {
ChromeUtils.import('chrome://userchromejs/content/userChrome.jsm');
} catch (ex) { };
+// Prefs
+pref('devtools.theme', 'dark');
+pref('devtools.toolbox.alwaysOnTop', true);
+pref('devtools.toolbox.host', 'window');
+pref('privacy.donottrackheader.enabled', true);
+pref('identity.fxaccounts.toolbar.enabled', false);
+
diff --git a/modules/firefox.home/chrome/customNewTab.uc.js b/modules/firefox.home/chrome/customNewTab.uc.js
new file mode 100644
index 0000000..3a3a47e
--- /dev/null
+++ b/modules/firefox.home/chrome/customNewTab.uc.js
@@ -0,0 +1,38 @@
+// ==UserScript==
+// @name Custom New Tab
+// @version 1.0
+// @description Load a custom link or local file, instead of the default new tab page
+// @startup UC.customNewTab.updateNewTabURL()
+// @shutdown UC.customNewTab.destroy();
+// ==/UserScript==
+
+(() => {
+ // Managed in about:config
+ const NEWTAB_URL_PREF = 'browser.newtab.url'
+
+ if (!AboutNewTab) {
+ globalThis.AboutNewTab = ChromeUtils.import('resource:///modules/AboutNewTab.jsm').AboutNewTab;
+ }
+
+ const module = {
+ updateNewTabURL: () => {
+ const newTabUrl = xPref.get(NEWTAB_URL_PREF) || 'about:blank';
+ if (AboutNewTab.newTabURL === newTabUrl) return;
+
+ AboutNewTab.newTabURL = newTabUrl;
+ console.log('Updated new tab url to', newTabUrl);
+ },
+
+ init() {
+ module.updateNewTabURL();
+ Services.obs.addObserver(module.updateNewTabURL, 'newtab-url-changed');
+ },
+ destroy() {
+ Services.obs.removeObserver(module.updateNewTabURL, 'newtab-url-changed');
+ },
+ };
+
+ module.init();
+
+ UC.customNewTab = module;
+})();
diff --git a/modules/firefox.home/chrome/globalKeybindings.uc.js b/modules/firefox.home/chrome/globalKeybindings.uc.js
index 7341fc0..51326fd 100644
--- a/modules/firefox.home/chrome/globalKeybindings.uc.js
+++ b/modules/firefox.home/chrome/globalKeybindings.uc.js
@@ -6,7 +6,6 @@
// @shutdown UC.globalKeybindings.destroy();
// ==/UserScript==
-
(() => {
// Configure global keybindings
const KEYBINDINGS = () => ({
diff --git a/modules/firefox.home/chrome/setupNewTab.uc.js b/modules/firefox.home/chrome/setupNewTab.uc.js
deleted file mode 100644
index 1eb971c..0000000
--- a/modules/firefox.home/chrome/setupNewTab.uc.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// ==UserScript==
-// @name Custom New Tab
-// @version 1.0
-// @description Load a custom link or local file, instead of the default new tab page (about:newtab).
-// ==/UserScript==
-
-// For Firefox 72 onward, see the autoconfig alternative to this:
-// https://support.mozilla.org/questions/1251199#answer-1199709
-
-globalThis.newtabLinkStarted = true;
-
-if (!AboutNewTab) {
- globalThis.AboutNewTab = ChromeUtils.import('resource:///modules/AboutNewTab.jsm').AboutNewTab;
-}
-
-const newTabUrl = xPref.get('browser.newtab.url') || 'about:blank';
-
-AboutNewTab.newTabURL = newTabUrl;
-
-console.log('Updated new tab url to', newTabUrl);
diff --git a/modules/firefox.home/default.nix b/modules/firefox.home/default.nix
index 0004d33..c51ccef 100644
--- a/modules/firefox.home/default.nix
+++ b/modules/firefox.home/default.nix
@@ -32,13 +32,9 @@ let
"browser.theme.toolbar-theme" = 0;
"browser.aboutConfig.showWarning" = false;
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
- # "devtools.theme" = "dark";
"ui.systemUsesDarkTheme" = 2;
- # "devtools.toolbox.alwaysOnTop" = true;
- # "devtools.toolbox.host" = "window";
"layers.acceleration.force-enabled" = true;
"gfx.webrender.all" = true;
- # "svg.context-properties.content.enabled" = true;
"widget.gtk.rounded-bottom-corners.enabled" = true;
"browser.urlbar.suggest.calculator" = true;
"browser.urlbar.unitConversion.enabled" = true;
@@ -46,7 +42,6 @@ let
"extensions.pocket.enabled" = false;
"extensions.pocket.showHome" = false;
"browser.urlbar.suggest.pocket" = false;
- # "privacy.donottrackheader.enabled" = true;
"privacy.globalprivacycontrol.enabled" = true;
"browser.search.suggest.enabled" = false;
"browser.urlbar.suggest.searches" = false;
@@ -57,7 +52,6 @@ let
"layout.css.has-selector.enabled" = true;
"browser.toolbars.bookmarks.visibility" = "never";
- # "identity.fxaccounts.toolbar.enabled" = false;
"browser.tabs.insertAfterCurrent" = true;
"browser.urlbar.shortcuts.bookmarks" = false;
"browser.urlbar.suggest.bookmark" = false;
@@ -68,8 +62,6 @@ let
"browser.download.useDownloadDir" = false;
# HAcky stuff
- # "general.config.sandbox_enabled" = false;
- # "general.config.obscure_value" = false;
"xpinstall.signatures.required" = false;
"extensions.install_origins.enabled" = false;
};