Fonts: Difference between revisions
Clarify that bindfs solution can also fix issues with missing icons/cursor themes. Simplify code example. |
Rename sections of "Flatpak applications can't find system fonts" because they were confusing and difficult to follow |
||
| Line 169: | Line 169: | ||
</syntaxhighlight>You will then need to link/copy this folder to one of the Flatpak-supported locations - see below. | </syntaxhighlight>You will then need to link/copy this folder to one of the Flatpak-supported locations - see below. | ||
==== | ==== Solution 1: Copy fonts to <code>$HOME/.local/share/fonts</code> ==== | ||
Create fonts directory <code>$HOME/.local/share/fonts</code> and copy system fonts with option <code>-L, --dereference</code> | Create fonts directory <code>$HOME/.local/share/fonts</code> and copy system fonts with option <code>-L, --dereference</code>. You will need to repeat this step whenever the fonts change.<syntaxhighlight lang="bash"> | ||
mkdir $HOME/.local/share/fonts && cp -L /run/current-system/sw/share/X11/fonts/* $HOME/.local/share/fonts/ | mkdir $HOME/.local/share/fonts && cp -L /run/current-system/sw/share/X11/fonts/* $HOME/.local/share/fonts/ | ||
</syntaxhighlight>Note: There is | </syntaxhighlight>Note: There is no need to grant flatpak applications access to <code>$HOME/.local/share/fonts</code>. | ||
Instead, if you do that, some applications (for example, steam) won't work.<blockquote>Internals: How it works? | Instead, if you do that, some applications (for example, steam) won't work.<blockquote>Internals: How it works? | ||
| Line 189: | Line 189: | ||
</syntaxhighlight>Then flatpak application can read fonts from that to display contents correctly.</blockquote> | </syntaxhighlight>Then flatpak application can read fonts from that to display contents correctly.</blockquote> | ||
==== | ==== Solution 2: Symlink to system fonts at <code>$HOME/.local/share/fonts</code> ==== | ||
<blockquote>'''Note:''' this method doesn't work for some flatpak applications (for example, steam)! | <blockquote>'''Note:''' this method doesn't work for some flatpak applications (for example, steam)! | ||
| Line 201: | Line 201: | ||
Now you have two options. | Now you have two options. | ||
===== Option 1: | ===== Option 1: Allow access to the fonts folder and <code>/nix/store</code> ===== | ||
By using the Flatpak CLI or the Flatseal Flatpak make the following directory available to all Flatpaks <code>$HOME/.local/share/fonts</code> and <code>$HOME/.icons</code> the appropriate commands for this are: | By using the Flatpak CLI or the Flatseal Flatpak make the following directory available to all Flatpaks <code>$HOME/.local/share/fonts</code> and <code>$HOME/.icons</code> the appropriate commands for this are: | ||
| Line 216: | Line 216: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===== Option 2: | ===== Option 2: Allow access to the WHOLE filesystem ===== | ||
Allow them access the WHOLE filesystem of yours: <code>All system files</code> in Flatseal or equivalently <code>filesystem=host</code> available to your application, the command for this is: | Allow them access the WHOLE filesystem of yours: <code>All system files</code> in Flatseal or equivalently <code>filesystem=host</code> available to your application, the command for this is: | ||
| Line 225: | Line 225: | ||
It is important to keep in mind that some flatpak apps may refuse to launch if given certain permissions, such as the Steam flatpak. | It is important to keep in mind that some flatpak apps may refuse to launch if given certain permissions, such as the Steam flatpak. | ||
==== | ==== Solution 3: Configure bindfs for fonts/cursors/icons support ==== | ||
Alternatively, you can expose relevant packages directly under <code>/usr/share/...</code> paths. This will also enable Flatpak to use a custom cursor theme if you have one.<syntaxhighlight lang="nix"> | Alternatively, you can expose relevant packages directly under <code>/usr/share/...</code> paths. This will also enable Flatpak to use a custom cursor theme if you have one. This solution doesn't require <code>fonts.fontDir.enable</code> to be enabled.<syntaxhighlight lang="nix"> | ||
system.fsPackages = [ pkgs.bindfs ]; | system.fsPackages = [ pkgs.bindfs ]; | ||
| Line 256: | Line 256: | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Noto Color Emoji doesn't render on Firefox === | === Noto Color Emoji doesn't render on Firefox === | ||