Force Gnome Theme per Application - Tomi Mavrin

Force Gnome Theme per Application

Sometimes when using custom themes in Gnome, the theme doesn’t look nice so you might want to use the default per application so you can actually see something.

In this example I will be updating DBeaver .desktop file.

Create a custom .desktop file

You need to copy the original file and move it into your .local folder to persist changes because the .desktop file in /usr/share/application will be overwritten and returned to default with each update.

  1. Navigate to /usr/share/applications/
  2. Copy the .desktop file you want (in my case io.dbeaver.DBeaver.desktop)
  3. Paste the file at ~/.local/share/applications/

Example:

cp /usr/share/applications/io.dbeaver.DBeaver.desktop ~/.local/share/applications/
  1. Open the .desktop file and edit the line starting with Exec= to include Exec=env GTK_THEME=elementary and then the previous existing contents of the line.

Before:

Exec=dbeaver

After:

Exec=env GTK_THEME=Adwaita dbeaver

Example of final file:

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Name=DBeaver Community
GenericName=UniversaL Database Manager
GenericName[fr]=Gestionnaire de bases de données universel
Comment=Universal Database Manager and SQL Client.
Comment[fr]=Gestionnaire de bases de données universel et Client SQL.
Exec=env GTK_THEME=Adwaita dbeaver // <-- edit this line
Icon=dbeaver
Categories=IDE;Development
StartupWMClass=DBeaver
StartupNotify=true
Keywords=Database;SQL;IDE;JDBC;ODBC;MySQL;PostgreSQL
MimeType=application/sql

Create an alias to run with command

alias dbeaver="GTK_THEME=Adwaita dbeaver"

That's it.