I've been trying for a while to set the GTK theme of the Mendeley desktop UI, without success. The reason I want to do this is because I am using a dark theme, and that Mendeley is unreadable (dark font on dark bg) with this theme. The two relevant sources of information I'm using are here and here.
They both basically say that calling an executable like so
$ GTK_THEME=MyFancyTheme my_stubborn_app
should override the default GTK theme for the current user, and that permanent theme changes can be integrated in the .../share/my_stubborn_app.desktop
by altering the EXEC
line:
Exec=env GTK_THEME=MyFancyTheme /path/to/my_stubborn_app %u
None of these methods works in my case.
The special things about Mendeley desktop UI on Ubuntu (Trusty Tahr 14.04, Mendeley UI v1.14 in my case) are:
- It comes as a standalone package with its own
bin
andshare
andlib
folders and it uses Qt. - The actual binary is in
lib/mendeleydesktop/libexec/mendeleydesktop.x86_64
(for Ubuntu 64 bits) but cannot be called directly because it requires environment variables defined by the python scriptbin/mendeleydesktop
. - The
mendeleydesktop.desktop
file (which allows having an icon in the Unity launcher) is overwritten bybin/install-mendeley-link-handler.sh
each timebin/mendeleydesktop
is called. - This
mendeleydesktop.desktop
file is created/overwritten in$HOME/.local/share/applications
.
What I did so far was to edit bin/install-mendeley-link-handler.sh
so that the .desktop
file overwritten at each call would include the modified Exec=env GTK_THEME...
line. That doesn't seem to work. Can anyone help?
Best Answer
I finally managed to get it done, although it feels a bit clunky. In the following:
$MENDELEY_FOLDER
is the Mendeley folder,$CURRENT_GTK_THEME
is the name of the GTK theme you are currently using$MENDELEY_GTK_THEME
is the name of the theme you'd like to use with MendeleyNOTE: To get the name of the theme that you are currently using, type
gsettings get org.gnome.desktop.interface gtk-theme
in a terminal. A good theme to be using with Mendeley isAmbiance
.Create a new themes directory
We will essentially trick Mendeley into thinking that the root GTK themes folder is somewhere else.
Modify the script
install-mendeley-link-handler.sh
It should be located in
$MENDELEY_FOLDER/bin/install-mendeley-link-handler.sh
. You need to edit the lines that overwrite the filemendeleydesktop.desktop
, in my case:Notice the change in the
Exec=...
line.Create a new mendeley executable
Wherever you keep your local binaries (eg
$HOME/local/bin
), create a new filemendeley
with the following:Then make it executable by running
chmod +x mendeley
, and run it in order to update themendeleydesktop.desktop
file.If you installed Mendeley system-wide
The last step is only slightly different, in that the system-wide script (most likely located in
/opt/mendeleydesktop
) actually creates a link to themendeleydesktop
executable in$HOME/.local/share
, and that is what the previous script needs to call instead.Applying those changes to the Unity icon
The file to edit should be
/usr/share/applications/mendeleydesktop.desktop
. In this file, you should modify theExec
line as previously, by prefixing the call with the definition ofGTK_DATA_PREFIX
. This should do the trick :)