How to use the default Yaru Gnome-Shell theme on Ubuntu 21.04 in a Gnome session?
Disclaimer: if any mistakes in below procedure, will lock down to login-loops in gdm3 login screen. In such case you need to choose Ubuntu or Ubuntu Xorg sessions and edit the changes.
create three local directories with below command
sudo mkdir -p /usr/local/share/xsessions /usr/local/share/wayland-sessions /usr/local/share/gnome-shell/modes
copy the GNOME and GNOME on Xorg desktop files to above first two directories.
sudo cp /usr/share/xsessions/gnome-xorg.desktop /usr/local/share/xsessions/
sudo cp /usr/share/wayland-sessions/gnome.desktop /usr/local/share/wayland-sessions/
Open the above files, I am showing the example for one file below
sudo nano /usr/local/share/xsessions/gnome-xorg.desktop
need to edit the Exec= line from below content
[Desktop Entry]
Name=GNOME on Xorg
Comment=This session logs you into GNOME
Exec=/usr/bin/gnome-session --session=gnome
TryExec=/usr/bin/gnome-session
Type=Application
DesktopNames=GNOME
X-GDM-SessionRegisters=true
X-Ubuntu-Gettext-Domain=gnome-session-3.0
Exec= line should be edited as below.
Exec=env GNOME_SHELL_SESSION_MODE=myyaru /usr/bin/gnome-session --session=gnome
copy the ubuntu.json
file from /usr/share/gnome-shell/modes/
to /usr/local/share/gnome-shell/modes/
directory and rename to myyaru.json
with below command
sudo cp /usr/share/gnome-shell/modes/ubuntu.json /usr/local/share/gnome-shell/modes/myyaru.json
Edit the above file to have the below content.
sudo nano /usr/local/share/gnome-shell/modes/myyaru.json
Content:
{
"parentMode": "user",
"stylesheetName": "Yaru/gnome-shell.css",
"themeResourceName": "/theme/Yaru/gnome-shell-theme.gresource"
}
All set, now we need to create a symbolic link to /usr/share/gnome-shell/theme
in /usr/local/share/gnome-shell
directory.
sudo ln -s /usr/share/gnome-shell/theme /usr/local/share/gnome-shell/theme
A re-login should take the effect, if not, reboot.
This way you dont need to worry about the yaru theme package updates. because you are having the symbolic link in local directory.
Exec= line can be changed in gnome.desktop in /usr/local/share/wayland-sessions
too.
Now the "Default" theme becomes Yaru.
Note:
The tweaking is not limited like paths, file names, configs etc.
The above procedure suites your requirement.