From 5402fa0f521b06bc5806bb9ac81d1bf22993a3fc Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sun, 28 May 2023 20:25:35 +0200 Subject: [PATCH 01/14] README: log file: add tail -F to example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 954cb0f..a8eac08 100644 --- a/README.md +++ b/README.md @@ -98,10 +98,10 @@ changes are applied. The `src/mobile-config-autoconfig.js` script generates `userChrome.css` and `userContent.css` while Firefox starts. It logs to your Firefox profile -directory, find the log file with: +directory, follow the log file with: ``` -$ find ~/.mozilla -name mobile-config-firefox.log +$ tail -F $(find ~/.mozilla -name mobile-config-firefox.log) ``` ## Coding guidelines From 3dcfd01d09a7311f8b0d74b78e158d1ae1ee4a43 Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Wed, 17 May 2023 17:31:43 -0400 Subject: [PATCH 02/14] userChrome/browser: Fix bottom navigation bar in FF 113 (MR 31) Firefox 113 changes from 'display: -moz-box' to 'display: flex', so we need to use the order property instead of -moz-box-ordinal-group. --- src/userChrome/browser.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/userChrome/browser.css b/src/userChrome/browser.css index feafa8f..f4c628a 100644 --- a/src/userChrome/browser.css +++ b/src/userChrome/browser.css @@ -4,7 +4,8 @@ /* Move navigation bar to bottom */ @media (max-width: 700px) { #browser { - -moz-box-ordinal-group: 0 !important; + -moz-box-ordinal-group: 0 !important; /* before FF 113 */ + order: -1 !important; /* since FF 113 */ } /* Hide navigation bar in kiosk mode (to prevent bug #29). We can assume FF From 8cbf7c9e309583e7d8e96748d7747c2d53572562 Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Wed, 17 May 2023 18:20:36 -0400 Subject: [PATCH 03/14] userChrome/tabmenu: Fix height of tab menu in FF 113 (MR 31) Without this fix, the tab menu is only tall enough for 2 or 3 entries. This is an update of the rule directly above it, changing the ID and changing from a calculated height to a fixed height matching its child #allTabsMenu-allTabsView. With the calculated height, the menu entries were offset above the top of the menu. The previous rule no longer seems to be necessary, at least in Firefox 102 and newer, since #allTabsMenu-multiView does not exist. --- src/userChrome/tabmenu.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/userChrome/tabmenu.css b/src/userChrome/tabmenu.css index ec6d0ed..f78405e 100644 --- a/src/userChrome/tabmenu.css +++ b/src/userChrome/tabmenu.css @@ -67,11 +67,16 @@ overflow-y: hidden !important; } - #allTabsMenu-multiView box.panel-viewstack { + #allTabsMenu-multiView box.panel-viewstack { /* before FF 102 or earlier */ /* Use the whole height */ height: calc(100vh - 100px) !important; max-height: calc(100vh - 100px) !important; } + #customizationui-widget-multiview box.panel-viewstack { /* since FF 113 */ + /* Use the whole height */ + height: 300px !important; + max-height: 300px !important; + } #allTabsMenu-allTabsViewTabs { /* Make sure tabs with long titles don't exceed the all tabs menu */ From 4a53e32a5cfd23a5cfe4c1e18a558b1d6ef61d57 Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Wed, 17 May 2023 18:39:23 -0400 Subject: [PATCH 04/14] userChrome/tabmenu: Fix max width of tab menu in FF >= 106 (MR 31) --- src/userChrome/tabmenu.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/userChrome/tabmenu.css b/src/userChrome/tabmenu.css index f78405e..903d985 100644 --- a/src/userChrome/tabmenu.css +++ b/src/userChrome/tabmenu.css @@ -78,7 +78,8 @@ max-height: 300px !important; } - #allTabsMenu-allTabsViewTabs { + #allTabsMenu-allTabsViewTabs, /* before FF 106 */ + #allTabsMenu-allTabsView-tabs { /* since FF 106 */ /* Make sure tabs with long titles don't exceed the all tabs menu */ max-width: calc(100vw - 20px); } From 3959e7c4760728aa318028863b82d4d035e9006d Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Wed, 17 May 2023 18:42:31 -0400 Subject: [PATCH 05/14] userChrome/tabmenu: Add note to a declaration obsoleted in FF 113 (MR 31) Firefox 113 changes from 'display: -moz-box' to 'display: flex', so the -moz-box-flex property should be changed to flex-grow. However, that breaks the tab menu, and it doesn't seem to be necessary anyway. --- src/userChrome/tabmenu.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/userChrome/tabmenu.css b/src/userChrome/tabmenu.css index 903d985..7927539 100644 --- a/src/userChrome/tabmenu.css +++ b/src/userChrome/tabmenu.css @@ -56,7 +56,8 @@ max-height: 300px !important; /* When messing around with tabs, it gets into a state where it does * not use the whole height anymore, it becomes a tiny window. Removing - * this attribute fixes it. */ + * this attribute fixes it. Since FF 113, this no longer has any + * effect, but it doesn't seem to be necessary either. */ -moz-box-flex: initial !important; } From cc4a4a791bb2969bcb301b190078d4c95d4e9a00 Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Mon, 3 Jul 2023 15:49:49 +0200 Subject: [PATCH 06/14] autoconfig: Fix version detection on first start (MR 32) Previously the Firefox version would be detected as 0 on the first start, causing popups.before-ff-108.css to be included even on newer versions, which breaks touch input. --- src/mobile-config-autoconfig.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index 5d9691d..3b0fce9 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -71,12 +71,7 @@ function log_obj(obj) { } function get_firefox_version() { - try { - return Services.appinfo.lastAppVersion.split(".")[0]; - } catch(e) { - log("Couldn't get Firefox version (expected on first start): " + e); - return 0; - } + return Services.appinfo.version.split(".")[0]; } function get_firefox_version_previous() { @@ -250,10 +245,7 @@ function css_files_update() { var file = css_file_get(name); if (file.exists()) { - /* During the very first start, ff_previous is first "unknown", - * then the files get installed and Firefox gets restarted. - * Then ff_previous is 0. Don't restart it again. */ - if (ff_previous != 0 && g_ff_version != ff_previous) { + if (g_ff_version != ff_previous) { log("Removing outdated file: " + file.path + " (Firefox" + " version changed)"); file.remove(false); From e1c533d84e124126782e7554a71691f604c22be7 Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Sun, 23 Jul 2023 21:52:36 +0100 Subject: [PATCH 07/14] fix: don't override user-agent (MR 34) --- README.md | 1 - src/mobile-config-autoconfig.js | 3 --- 2 files changed, 4 deletions(-) diff --git a/README.md b/README.md index a8eac08..b314381 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ This does not replace a proper implementation in * Adapt UI elements and "about:" pages to small screen sizes (when opened on small screen) * Enable mobile gestures -* User agent set to same as Tor Browser for Android * Privacy tweaks: * Disable search suggestions * Disable Firefox studies diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index 3b0fce9..f7f4dd7 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -265,9 +265,6 @@ function css_files_update() { function set_default_prefs() { log("Setting default preferences"); - // Select a mobile user agent for firefox (same as tor browser on android) - defaultPref('general.useragent.override', 'Mozilla/5.0 (Android 10; Mobile; rv:110.0) Gecko/110.0 Firefox/110.0'); - // Do not suggest facebook, ebay, reddit etc. in the urlbar. Same as // Settings -> Privacy & Security -> Address Bar -> Shortcuts. As // side-effect, the urlbar results are not immediatelly opened once From 9c780dabb83b8857cb3700bd7fdd729400ee88e6 Mon Sep 17 00:00:00 2001 From: Seth Falco Date: Fri, 1 Sep 2023 15:58:24 +0200 Subject: [PATCH 08/14] fix: add mobile to user-agent (MR 35) --- src/mobile-config-autoconfig.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index f7f4dd7..9abca3d 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -263,8 +263,31 @@ function css_files_update() { set_firefox_version_previous(g_ff_version); } +/** + * Builds a user-agent as similar to the default as possible, but with "Mobile" + * inserted into the platforms section. + * + * @returns {string} + */ +function build_user_agent() { + var appinfo = Services.appinfo; + var vendor = appinfo.vendor || "Mozilla"; + var os = appinfo.OS || "Linux"; + var version = get_firefox_version() + ".0"; + var name = appinfo.name || "Firefox"; + var arch = (appinfo.XPCOMABI && appinfo.XPCOMABI.includes("-")) + ? appinfo.XPCOMABI.split("-")[0] + : "aarch64"; + + return `${vendor}/5.0 (X11; ${os} ${arch}; Mobile; rv:${version}) Gecko/20100101 ${name}/${version}`; +} + function set_default_prefs() { log("Setting default preferences"); + + var user_agent = build_user_agent(); + defaultPref('general.useragent.override', user_agent); + // Do not suggest facebook, ebay, reddit etc. in the urlbar. Same as // Settings -> Privacy & Security -> Address Bar -> Shortcuts. As // side-effect, the urlbar results are not immediatelly opened once From 21163be169793fca4fbbaffe1ba595303a722aba Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Mon, 4 Sep 2023 23:29:18 -0400 Subject: [PATCH 09/14] autoconfig: Fix error due to Services import in FF 117 (MR 36) Since Firefox 104 the Services global is available automatically and no longer needs to be imported, and since Firefox 117 importing it is an error. --- src/mobile-config-autoconfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index 9abca3d..97adaab 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -18,7 +18,7 @@ // https://web.archive.org/web/20201018211550/https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Code_snippets/File_I_O const {classes: Cc, interfaces: Ci, utils: Cu} = Components; -Cu.import("resource://gre/modules/Services.jsm"); +const Services = globalThis.Services || Cu.import("resource://gre/modules/Services.jsm").Services; // for compatibility with FF < 104 Cu.import("resource://gre/modules/FileUtils.jsm"); var g_ff_version; From 9a34fe3e954486da10608486ace28d69a726d54a Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Mon, 4 Sep 2023 23:33:53 -0400 Subject: [PATCH 10/14] userChrome/urlbar: Prevent urlbar from going past window bottom in FF 117 (MR 36) --- src/userChrome/urlbar.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/userChrome/urlbar.css b/src/userChrome/urlbar.css index d71fd30..4ad5cf7 100644 --- a/src/userChrome/urlbar.css +++ b/src/userChrome/urlbar.css @@ -82,6 +82,14 @@ #PersonalToolbar { display: none; } + + /* If the bookmarks toolbar is configured to only show on the new tab page, + * Firefox makes the toolbar overlap the browser. When it's then hidden by + * the rule above, the urlbar is pushed off the bottom of the window. To + * prevent this, set the height of the overlapped toolbar to 0. */ + :root { + --bookmarks-toolbar-overlapping-browser-height: 0 !important; + } } /* Even though amazon is removed as search engine in policies.json, it gets From 94cbe0452dc520ec8e8f8f62f4af40d3f24a53cf Mon Sep 17 00:00:00 2001 From: Ulrik de Muelenaere Date: Mon, 4 Sep 2023 23:57:41 -0400 Subject: [PATCH 11/14] userChrome/urlbar: Allow urlbar to shrink down to its min width (MR 37) This fixes one of the issues from #52, but I have not been able to reproduce the others on Phosh. --- src/userChrome/urlbar.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/userChrome/urlbar.css b/src/userChrome/urlbar.css index 4ad5cf7..2f94380 100644 --- a/src/userChrome/urlbar.css +++ b/src/userChrome/urlbar.css @@ -4,6 +4,7 @@ /* Reduce minimum window width */ #urlbar-container { min-width: 150px !important; + flex-shrink: 1 !important; } @media (max-width: 700px) { From 0187c6c605e08af76b7dbf10c58c833e8f168afc Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 12 Sep 2023 09:43:14 +0200 Subject: [PATCH 12/14] README: update supported versions Thanks to plata-gl for pointing this out. Fix #61. --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b314381..372e29e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # mobile-config-firefox -Mobile and privacy friendly configuration for Firefox >= 91. +Mobile and privacy friendly configuration for current standard and extended +support releases of Firefox. This does not replace a proper implementation in [Firefox upstream](https://bugzilla.mozilla.org/show_bug.cgi?id=1579348) From 4116b6663b32f67846a6ec3c37cfcfda896b889c Mon Sep 17 00:00:00 2001 From: plata Date: Mon, 11 Sep 2023 09:42:40 +0000 Subject: [PATCH 13/14] Hide minimize/maximize/close buttons (MR 39) --- src/userChrome/browser.css | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/userChrome/browser.css b/src/userChrome/browser.css index f4c628a..2110179 100644 --- a/src/userChrome/browser.css +++ b/src/userChrome/browser.css @@ -1,8 +1,8 @@ /* Copyright 2022 plata * SPDX-License-Identifier: MPL-2.0 */ -/* Move navigation bar to bottom */ @media (max-width: 700px) { + /* Move navigation bar to bottom */ #browser { -moz-box-ordinal-group: 0 !important; /* before FF 113 */ order: -1 !important; /* since FF 113 */ @@ -16,4 +16,9 @@ #TabsToolbar[inFullscreen] { display: none; } + + /* Hide minimize/maximize/close buttons */ + .titlebar-buttonbox-container { + display: none; + } } From a205c5fa6407ea53313e728f19e413a77ab39d51 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Fri, 8 Sep 2023 09:51:45 +0200 Subject: [PATCH 14/14] autoconfig: set media.webrtc.camera.allow-pipewire (MR 38) As suggested by Robert Mader in issue 57, thanks. --- src/mobile-config-autoconfig.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index 97adaab..5693847 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -309,6 +309,12 @@ function set_default_prefs() { // shows recently closed tabs. The always pinned tab takes up screen estate // and it's slightly annoying if you do not want to register an account. defaultPref('browser.tabs.firefox-view', false); + + // FF >= 116 allows to use cameras via Pipewire. While it will likely still + // take a while until this is made the default, on most mobile devices it + // makes a lot of sense to enable it unconditionally, as cameras usually + // only work with libcamera, not via plain v4l2. + defaultPref('media.webrtc.camera.allow-pipewire', true); } function main() {