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.
- Navigate to
/usr/share/applications/ - Copy the
.desktopfile you want (in my caseio.dbeaver.DBeaver.desktop) - Paste the file at
~/.local/share/applications/
Example:
cp /usr/share/applications/io.dbeaver.DBeaver.desktop ~/.local/share/applications/
- Open the
.desktopfile and edit the line starting withExec=to includeExec=env GTK_THEME=elementaryand 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.