I am using Ubuntu GNOME 17.04. I want to change the font of the GNOME top bar from the default font by Adapta to Fira Sans. I already have all the fonts, I just want to change the font of the top bar so it doesn't look out of place compared to everything else.
4 Answers
You may create a custom css override in your home directory and load it from there (otherwise if you make any change in the theme's style sheet, any update of the theme will most probably overwrite it).
First you should know where the Adapta theme is located. If you have installed it from a .deb
package or a PPA it should be located at /usr/share/themes/Adapta
and there should be a gnome-shell.css
file in /usr/share/themes/Adapta/gnome-shell/
.
Now follow the steps below.
Create a directory, say
MyTheme
either in~/.themes
or in~/.local/share/themes
. (You may create~/.themes
or~/.local/share/themes
if they don't exist.)Create another directory inside
MyTheme
calledgnome-shell
.Create an empty document in this
gnome-shell
directory and name itgnome-shell.css
.Open this
gnome-shell.css
in a text editor and add the following lines@import url("/usr/share/themes/Adapta/gnome-shell/gnome-shell.css"); stage { font-family: FONT_NAME, Sans-Serif; font-size: 14pt; }
Change FONT_NAME
to a font of your choice (also you may change the font size) and save the file.
Open GNOME Tweak Tools and activate the User themes extension. (If the extension is not installed, you may install it from here.)
Go to Appearance section of Tweak Tools and click on the drop-down box next to "Shell theme". MyTheme should appear in the drop-down list. Select it.
Restart GNOME shell by typing alt+f2 then R+enter (works in an Xorg session, in Wayland logout and login again).
-
-
This method also doesn't work for themes that use
gresource
files (i.e., Yaru), so you should mention that it won't work in those cases.– MelabOct 17, 2020 at 2:18 -
@Melab You can easily deal with them either by directly importing the resource from a
.gresource
file into your custom.css
file or by manually extracting the required resources from the.gresource
file. Feel free to post a new answer addressing these.– pomskyOct 17, 2020 at 3:41 -
-
I have. Nothing turned up that explicitly mentioned how to import a
.gresource
file in a custom user theme CSS file.– MelabOct 21, 2020 at 22:34
I have found the answer to my question! The most effective way to change the font of the top bar is to change the font families in the gnome-shell.css
file.
To do this, first use
sudo -H nautilus
to open a root version of Nautilus.
You will then want to navigate to /usr/share/themes/"THEME_NAME"/gnome-shell/gnome-shell.css/
.
Open the file and where it says something like
stage { font-size: 10pt; font-family: Roboto, Cantarell, Sans-Serif; font-weight: 400; color: #263238; }
change the first font to the name of your font. The result should be something like
stage { font-size: 10pt; font-family: Fira Sans, Cantarell, Sans-Serif; font-weight: 400; color: #263238; }
if you changed the font to Fira Sans.
Restart the shell using Alt+F2 and then type r
.
Doing this makes the themes you want have the fonts you want instead of changing to Adwaita.
Note: Updates to GTK Themes can mess up this configuration, so pomsky's answer has been marked as the best.
-
3I made the change to my answer to work with the Adapta theme. By the way you should never start a graphical application like Nautilus or gedit with normal sudo. As an alternative you may use
nano
to edit text in the command line or runsudo -H gedit
,sudo -H nautilus
etc.– pomskyOct 12, 2017 at 19:07
In Ubuntu 19.10 the gnome-shell.css
location is:
/usr/share/gnome-shell/theme/Yaru/gnome-shell.css
Edit gnome-shell.css
as administrator. Then search for
stage {
font-family:
Just add your desired font-family name. For example:
stage {
font-family: Fira Sans, Cantarell, Sans-Serif;
font-size: 10pt;
color: #3D3D3D; }
Done. Save it and log-out and log-in again.
-
No need to logout & login again. Just Alt+F2, type
r
then enter. This will reload gnome-shell.– IkbelAug 31, 2020 at 9:54
Answering my own question here, changing gnome-shell.css files is no longer needed thanks to the changes provided by GNOME 3.36. Changing the interface font normally now changes the font globally. (everything including the GNOME menu, status bar, etc.)