Set up speech-dispatcher for the Firefox flatpak

It doesn't work by default in the Firefox flatpak. Set it up so it can for visually impaired users. This will also suppress the error message that often shows up, warning the user that it won't work.
This commit is contained in:
Thomas Duckworth
2025-11-20 18:24:40 +11:00
parent 8299e7c3bf
commit 045947e27d
3 changed files with 20 additions and 6 deletions

View File

@@ -10,7 +10,10 @@ if ! flatpak info org.mozilla.firefox >/dev/null 2>&1; then
fi
# Ensure accent colors are correctly applied to Firefox.
flatpak override --system org.mozilla.firefox --filesystem=xdg-config/gtk-3.0:ro
# Also ensure Firefox has access to the speech-dispatcher socket.
flatpak override --system org.mozilla.firefox \
--filesystem=xdg-config/gtk-3.0:ro \
--filesystem=xdg-run/speech-dispatcher:ro
# Install codecs-extra at runtime - this gets around distribution restrictions on codec licensing.
# This is required for Firefox to decode certain video formats.
@@ -32,10 +35,13 @@ fi
# so this should only be done conditionally.
if nvidia-smi > /dev/null 2>&1; then
mkdir -p "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/"
cp -rf "/usr/share/firefox-config/00-kde-linux-default.js" "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/00-kde-linux-default.js"
cp -rf "/usr/share/firefox-config/01-kde-linux-nvidia-hw-decode.js" "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/01-kde-linux-nvidia-hw-decode.js"
else
rm -rf "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/00-kde-linux-default.js"
rm -rf "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/01-kde-linux-nvidia-hw-decode.js"
fi
# This, currently, gets speech-dispatcher to work in Firefox.
mkdir -p "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/"
cp -rf "/usr/share/firefox-config/00-kde-linux-default.js" "/var/lib/flatpak/extension/org.mozilla.firefox.systemconfig/${RUNTIME_ARCH}/stable/defaults/pref/00-kde-linux-default.js"
# Install the KDE Linux default Firefox policy into the Firefox flatpak system config extension.
# This installs the Plasma Browser Integration extension.

View File

@@ -3,6 +3,6 @@
// See https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
// Ensure GPU hardware acceleration works on all hardware, including NVIDIA.
// See https://wiki.archlinux.org/title/Firefox#Hardware_video_acceleration
pref("media.hardware-video-decoding.force-enabled", true);
// Get speech-dispatcher to work in Firefox.
pref("narrate.enabled", true);
pref("narrate.filter-voices", false);

View File

@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
// SPDX-FileCopyrightText: 2025 Thomas Duckworth <tduck@filotimoproject.org>
// See https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
// Ensure GPU hardware acceleration works on all hardware, including NVIDIA.
// See https://wiki.archlinux.org/title/Firefox#Hardware_video_acceleration
pref("media.hardware-video-decoding.force-enabled", true);