Firefox: Difference between revisions
imported>Artturin m Add to the configuration category |
imported>Fadenb →Wayland: Document what is needed to make Firefox screen sharing work with Wayland |
||
| Line 35: | Line 35: | ||
===Wayland=== | ===Wayland=== | ||
Users running a Wayland compositor (such as [[Sway]]) may want to use a Wayland-compatible build of Firefox. This can be achieved by replacing the <code>firefox</code> package with <code>firefox-wayland</code> instead. | Users running a Wayland compositor (such as [[Sway]]) may want to use a Wayland-compatible build of Firefox. This can be achieved by replacing the <code>firefox</code> package with <code>firefox-wayland</code> instead. | ||
====Screen Sharing==== | |||
When using Firefox with Wayland, screen sharing options are limited and require additional configuration. As of 2020-12-15, it is only possible to share a whole screen (rather than choosing which window to share). | |||
* Use <code>firefox-wayland</code>, e.g.:<syntaxhighlight lang="nix"> | |||
# NixOS system wide firefox install | |||
environment.systemPackages = with pkgs; [ firefox-wayland ] | |||
# Home Manager when not using any additional firefox options | |||
home.packages = with pkgs; [ firefox-wayland ] | |||
# Home Manager programs.firefox style | |||
programs.firefox = { | |||
enable = true; | |||
package = pkgs.wrapFirefox pkgs.firefox-unwrapped { | |||
forceWayland = true; | |||
extraPolicies = { | |||
ExtensionSettings = {}; | |||
}; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
* Enable [https://pipewire.org/ PipeWire]:<syntaxhighlight lang="nix"> | |||
services.pipewire.enable = true; | |||
</syntaxhighlight> | |||
* Enable [https://github.com/flatpak/xdg-desktop-portal/blob/master/README.md xdg desktop integration]:<syntaxhighlight lang="nix"> | |||
xdg = { | |||
portal = { | |||
enable = true; | |||
extraPortals = with pkgs; [ | |||
xdg-desktop-portal-wlr | |||
xdg-desktop-portal-gtk | |||
]; | |||
gtkUsePortal = true; | |||
}; | |||
}; | |||
</syntaxhighlight> | |||
* Set environment variables to hint Firefox to use Wayland features. E.g.:<syntaxhighlight lang="nix"> | |||
# Classical NixOS setup | |||
environment.sessionVariables = { | |||
MOZ_ENABLE_WAYLAND = "1"; | |||
XDG_CURRENT_DESKTOP = "sway"; # TODO: Do we need this in non-sway setups? | |||
XDG_SESSION_TYPE = "wayland"; | |||
}; | |||
# Home Manager setup | |||
home.sessionVariables = { | |||
MOZ_ENABLE_WAYLAND = 1; | |||
XDG_CURRENT_DESKTOP = "sway"; # TODO: Do we need this in non-sway setups? | |||
XDG_SESSION_TYPE = "wayland"; | |||
}; | |||
</syntaxhighlight> | |||
* Ensure that the environment variables are correctly set for the user systemd units. E.g.:<syntaxhighlight lang="shell"> | |||
# Sway users might achieve this by adding the following to their Sway config file | |||
# This ensures all user units started after the command (not those already running) set the variables | |||
exec systemctl --user import-environment | |||
</syntaxhighlight> | |||
* Apply the patch from pull-request {{pull|106815}} to fix a screen sharing related regression{{Note|Remove this once the PR has been merged/backported to stable.}} | |||
===Firefox ESR=== | ===Firefox ESR=== | ||