Fonts: Difference between revisions

import from old wiki
Fix solutions for tufo fonts problem in flatpak applications
Line 119: Line 119:
=== Flatpak applications can't find system fonts ===
=== Flatpak applications can't find system fonts ===


Enable <code>fontDir</code> in your NixOS configuration:
First, enable <code>fontDir</code> in your NixOS configuration:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
fonts.fontDir.enable = true;
fonts.fontDir.enable = true;
</syntaxhighlight>
</syntaxhighlight>
Then, create a symlink in <code>XDG_DATA_HOME/fonts</code> pointing to <code>/run/current-system/sw/share/X11/fonts</code>, e. g.  
 
<syntaxhighlight lang="console">
==== Best Solution: Copy all your fonts to $HOME and allow flatpak applications to access ====
$ ln -s /run/current-system/sw/share/X11/fonts ~/.local/share/fonts
Create fonts directory <code>$HOME/.local/share/fonts</code> and copy system fonts with option <code>-L, --dereference</code>  .<syntaxhighlight lang="bash">
mkdir $HOME/.local/share/fonts && cp -L /run/current-system/sw/share/X11/fonts/* $HOME/.local/share/fonts/
</syntaxhighlight>Grant flatpak applications access to your fonts directory.<syntaxhighlight lang="bash">
flatpak --user override --filesystem=$HOME/.local/share/fonts:ro
</syntaxhighlight>
 
==== Possible Method: Create 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)!
 
Error: <syntaxhighlight lang="console">
$ flatpak run  com.valvesoftware.Steam
bwrap: Can't make symlink at /home/username/.local/share/fonts: File exists
</syntaxhighlight></blockquote>Create a symlink in <code>XDG_DATA_HOME/fonts</code> pointing to <code>/run/current-system/sw/share/X11/fonts</code>, e. g.  
<syntaxhighlight lang="bash">
ln -s /run/current-system/sw/share/X11/fonts ~/.local/share/fonts
</syntaxhighlight>
</syntaxhighlight>
Now you have two options.
Now you have two options.


==== Option 1: allow the Flatpaks to access the font folder and <code>/nix/store</code> ====
===== Option 1: allow the Flatpaks to access the font 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 145: Line 159:
</syntaxhighlight>
</syntaxhighlight>


==== Option 2: allow the Flatpaks to access the WHOLE filesystem ====
===== Option 2: allow the Flatpaks to access 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: