From aee213e96d2c477a1839ccb0ea532fff5ce60167 Mon Sep 17 00:00:00 2001 From: gmalvone Date: Thu, 29 Jan 2026 16:34:39 +0000 Subject: [PATCH] Feat: Add configurable font setting and fix Windows font fallback Added extension options page and configurable font settings. Fixed font fallback issue on Windows. --- manifest.json | 23 +++++++++++++++-------- options.html | 40 ++++++++++++++++++++++++++++++++++++++++ options.js | 27 +++++++++++++++++++++++++++ pages/css/common.css | 2 +- pages/search/search.js | 9 +++++++++ 5 files changed, 92 insertions(+), 9 deletions(-) create mode 100644 options.html create mode 100644 options.js diff --git a/manifest.json b/manifest.json index 0d68f53..8603bf6 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,16 @@ { + "manifest_version": 3, + "name": "Tabswitcher", + "version": "1.1.2", + "description": "The musthave extension for a mouse-free Firefox experience", + "homepage_url": "https://github.com/He4eT/tabswitcher", "action": { "default_title": "Tabswitcher" }, "background": { - "scripts": ["background.js"] + "scripts": [ + "background.js" + ] }, "browser_specific_settings": { "gecko": { @@ -18,13 +25,13 @@ } } }, - "description": "The musthave extension for a mouse-free Firefox experience", - "homepage_url": "https://github.com/He4eT/tabswitcher", - "manifest_version": 3, - "name": "Tabswitcher", "permissions": [ "tabs", - "sessions" + "sessions", + "storage" ], - "version": "1.1.1" -} + "options_ui": { + "page": "options.html", + "open_in_tab": false + } +} \ No newline at end of file diff --git a/options.html b/options.html new file mode 100644 index 0000000..1922988 --- /dev/null +++ b/options.html @@ -0,0 +1,40 @@ + + + + + + +

Tabswitcher Settings

+
+ + +
+ + Saved! + + + \ No newline at end of file diff --git a/options.js b/options.js new file mode 100644 index 0000000..2124835 --- /dev/null +++ b/options.js @@ -0,0 +1,27 @@ +// options.js + +// Save options to browser.storage +const saveOptions = () => { + const font = document.getElementById('font-family').value; + + browser.storage.sync.set( + { userFont: font } + ).then(() => { + // Visual feedback + const status = document.getElementById('status'); + status.style.opacity = '1'; + setTimeout(() => { + status.style.opacity = '0'; + }, 1500); + }); +}; + +// Restore options from browser.storage +const restoreOptions = () => { + browser.storage.sync.get('userFont').then((result) => { + document.getElementById('font-family').value = result.userFont || ''; + }); +}; + +document.addEventListener('DOMContentLoaded', restoreOptions); +document.getElementById('save').addEventListener('click', saveOptions); \ No newline at end of file diff --git a/pages/css/common.css b/pages/css/common.css index f579b05..21d20ea 100644 --- a/pages/css/common.css +++ b/pages/css/common.css @@ -1,5 +1,5 @@ html, body { - font-family: sans; + font-family: var(--user-font, system-ui, -apple-system, "Segoe UI", sans-serif); margin: 0; padding: 0; diff --git a/pages/search/search.js b/pages/search/search.js index 8c999d9..1905d90 100644 --- a/pages/search/search.js +++ b/pages/search/search.js @@ -1,3 +1,12 @@ +// Load User Font Preference immediately +browser.storage.sync.get("userFont").then((result) => { + const fontStack = result.userFont + ? `${result.userFont}, system-ui, sans-serif` // User choice + fallback + : `system-ui, -apple-system, "Segoe UI", sans-serif`; // Default fallback + + document.documentElement.style.setProperty('--user-font', fontStack); +}); + import * as Store from './modules/store.js' import * as bridge from './modules/bridge.js' import * as dom from './modules/dom.js'