19

A few months ago, meld started behaving oddly. Common lines are almost unreadable, and shown as dark grey text on a black background.

meld fails

Oddly enough, running it as root is fine (with kdesudo meld), although the theme is less pretty.

root meld works

How can I specify the text's colour options for meld?

I'm using:

  • Arch Linux
  • KDE 4.14.3 (also seen in 4.14.2)
  • meld 3.12.2 (also seen in 3.12.1)
  • gtk3 3.14.6 (also seen in 3.14.5)

Troubleshooting

KDE system settings

meld uses GTK3, so I fiddled with System Settings > Common Appearance and Behaviour > Application Appearance > GTK > Select a GTK3 Theme. This change was reflected in meld, but none of the three options I selected changed the text. (The available options were Default, Emacs, and oxygen-gtk; the latter is used in the screenshot above.)

Manually modifying config files

I looked in ~ for files with gtk in their name.

~/.gtkrc-2.0
~/.gtkrc-2.0-kde4
~/.config/gtk-2.0
~/.config/gtk-3.0
~/.kde4/share/config/gtkrc
~/.kde4/share/config/gtkrc-2.0

Interestingly, there is nothing with gtk in its name in /root. Hence, I tried deleting some of the ~ files, to see if I could get the same effect for my user. I presume all the gtkrc-2.0 files are irrelevant to meld.

Firstly, I deleted ~/.config/gtk-3.0, but this had no effect, and was recreated when I opened meld.

The only other option appeared to be ~/.kde4/share/config/gtkrc, so deleted this and started meld, which was unaffected. However, the file was not recreated, and it contains some possibly pertinent lines (e.g. text[ACTIVE] = { 1.000, 1.000, 1.000 }). I'm unsure if the (missing) file was loaded at all. I tried kbuildsycoca4 ; kquitapp plasma-desktop ; sleep 2 ; kstart plasma-desktop, but this had no effect. Do I need to manually reload the gtkrc? And why is this file not being affected/rewritten by the system settings?

(Also, FWIW, I removed ~/.gtkrc-2.0-kde4, which was actually a symlink to ~/.gtkrc-2.0, and I also removed the target itself, but that didn't help. Again, I didn't reload gtk (I'm not sure if this is necessary, or possible), and the files weren't re-created when I tried running meld again.)

Possibly pertinent environment variables

$ export | grep -i gtk
declare -x GTK2_RC_FILES="/etc/gtk-2.0/gtkrc:/home/sparhawk/.gtkrc-2.0:/home/sparhawk/.kde4/share/config/gtkrc-2.0"
declare -x GTK_IM_MODULE="xim"
declare -x GTK_MODULES="canberra-gtk-module"
declare -x GTK_RC_FILES="/etc/gtk/gtkrc:/home/sparhawk/.gtkrc:/home/sparhawk/.kde4/share/config/gtkrc"

(Disclosure: I've previously asked this question on the KDE forums, but didn't come to a solution.)

4
  • @tombart answer is the most updated, should be the accepted one
    – Francesco
    Commented Sep 7, 2017 at 11:39
  • @Francesco No, the question regards a regression introduced three years ago. Tombart's answer describes a similar, but separate issue. Have a thorough read through the question and answers for more details.
    – Sparhawk
    Commented Sep 7, 2017 at 21:38
  • alright it was useful to me by the way :)
    – Francesco
    Commented Sep 7, 2017 at 21:54
  • No worries. That partially why I'm not voting to close this (as per this meta).
    – Sparhawk
    Commented Sep 7, 2017 at 22:06

5 Answers 5

21

At least from Meld 3.16.4 support different color schemes.

See Meld > Preferences:

meld prefernces

(possibly this change was introduced in earlier versions)

Note:
It is also possible to force a specific theme for Meld by CLI: GTK_THEME=Adwaita:dark meld

1
  • where is "Preferences" is located, idont had that menu elements ? i've got meld 3.20.2 whereis meld >>> meld: /usr/bin/meld /usr/share/meld /usr/share/man/man1/meld.1.gz Commented Dec 22, 2021 at 19:39
5

only leting a update...

The 3.18 version will not show preferences to change your theme.

but by dconf-editor, you can access the meld configuration and set style-chema to 'meld-dark' ... and be happy!

almost like that: https://linux.m2osw.com/no-meld-preferences-menu

enter image description here

4
  • dodn't worked for me i've got meld 3.20.2 Commented Dec 22, 2021 at 20:07
  • Works with Meld 3.20.2; @tiago - can you please tell us what dark theme you're using for your GTK? Calling "GTK_THEME=Adwaita:dark meld" from bash shows the blue and green washed out.. Commented May 19, 2022 at 13:05
  • In the meantime, I could manually edit the colors in /usr/share/meld/styles/meld-dark.xml Commented May 19, 2022 at 14:29
  • Final form: github.com/mihaigalos/config/blob/… Commented May 19, 2022 at 15:12
4

If I do locate -b meld | grep home, I get three directories you haven't mentioned;

~/.gconf/apps/meld
~/.gconf/apps/gnome-settings/meld
~/.local/share/meld

The one in ~/.local/share just seems to be a history of local comparisons, but the other two directories have xml files in them. I would try removing those.

If that doesn't work, you can see exactly which files meld reads with something like:

strace -e trace=file meld |& grep home

Looking at the output will should hopefully yield something else to investigate.

Failing that I would try creating another user account, logging in and running meld (but nothing else) there. If it displays ok, you could view the dot files/environment variables there and compare them to your own account. Note that you should log in via X and not just use su or sudo so that your desktop environment gets the chance to create the default dot files - this will likely be why it looks plain when running as root.

If none of that works, you could always give up and use Diffuse instead. I haven't tested it properly yet myself, but it does some things that meld can't (no directory comparisons though, so not quite a replacement). :)

Update

To try to track down the offending file(s) you can compare the dot files in the new account with the old. Unfortunately it could be almost any of the dot files in the new account, which is why it is important not to run any other applications (especially a web browser) as this will create/change more. To compare files you could try running something like this in the new account:

find . -type f -exec cmp {} /home/your_account/{} \;

For the ones that are different, you could investigate further with, er, Meld. If this doesn't yield anything then there is probably a file that you want to remove which would be hard to find. You could try going back to strace and comparing the outputs from the two accounts.

4
  • +1 for the detailed strategy. I haven't got it to work yet, but here are the results so far. Deleting the two directories suggested then restarting meld did not work. strace revealed the following candidates: ~/.config/gtk-3.0/settings.ini, ~/.config/oxygen-gtk, ~/.kde4/share/config/kdeglobals, /home/lee/.kde4/share/config/oxygenrc. The first was already attempted, but deleting the rest in turn didn't work. I'll try creating a new account next.
    – Sparhawk
    Commented Dec 31, 2014 at 2:55
  • I created a new account, and yes, the text looks fine there. As per the question, I looked at environment variables (with export | grep -i gtk), but the only difference was the presence of the following in the original, non-working account: declare -x GTK_IM_MODULE="xim". I'm not really sure what files to search for. I searched for files with gtk or meld in their names, but only found the ones above, which I had already tested.
    – Sparhawk
    Commented Dec 31, 2014 at 4:21
  • @Sparhawk, updated. I doubt it will make any difference, but there is no harm in doing an unset GTK_IM_MODULE from the command line and then running meld from the same shell.
    – Graeme
    Commented Dec 31, 2014 at 10:00
  • I've updated my answer.
    – Sparhawk
    Commented Dec 31, 2014 at 12:22
4

It looks like it was a regression introduced in Meld 3.12.1. I downloaded previous versions from the meld website.

Meld 3.12.0 works fine. 3.12.0

Meld 3.12.1 does not. enter image description here

I contacted the devs and they told me that it was indeed a regression introduced in the gtk+ 3 port. They suggested trying the just-released 3.12.3, which now works. (However, it still doesn't fully explain why meld in a new account would work.)

6
  • Is Meld 3.12.1 still the same after 3.12.0 has been run?
    – Graeme
    Commented Dec 31, 2014 at 9:47
  • @Graeme Yes, it is. Probably not important, but I ran them directly from the uncompressed files.
    – Sparhawk
    Commented Dec 31, 2014 at 9:47
  • Is there different Gnome dependencies between the two versions? Which distro are you using and how are you installing?
    – Graeme
    Commented Dec 31, 2014 at 10:05
  • @Graeme I'm using Arch, installing from the official repos. All dependencies of the two versions are identical.
    – Sparhawk
    Commented Dec 31, 2014 at 10:46
  • 1
    @Graeme I've updated the answer.
    – Sparhawk
    Commented Dec 31, 2014 at 12:14
2

overwrite the meld.css with the one there and you will be able to use Meld with the dark theme https://wiki.gnome.org/Apps/Meld/DarkThemes

2
  • I didn't want to use a dark theme. This question wasn't about changing the theme overall, it was just about a specific element, i.e. the common lines. As per the accepted answer, it was a regression that has since been fixed.
    – Sparhawk
    Commented Mar 30, 2016 at 12:23
  • For what it's worth... For my purposes this was the perfect answer - Switching gtk to the dark theme does a great job of making the text in meld unreadable
    – Dmitri DB
    Commented Feb 21, 2017 at 0:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .