gitk looks ugly / doesn't honor theme settings

32

13

I'm running Xubuntu, (actually linux mint with xfce on top, but I suppose it's essentially the same thing)

I set my appearance theme to (a modified version of) MurrinaStormCloud, but if I run gitk, it uses ugly font rendering, ugly colors, ugly widgets.

I think tcl is the thing to blame here, but can I fix it?

Here's a picture for comparison between what firefox looks like under the current theme and what gitk looks like:

gitk ugly theme

hasen

Posted 2009-08-26T18:56:07.957

Reputation: 4 556

1nice that we have gitg, but I still vote this question up to see if anyone can solve tcl/tk ugliness. gitk is still more compact than gitg. – u0b34a0f6ae – 2009-08-27T20:07:57.417

Answers

25

gitk is implemented in tcl/tk. I've searched around but there doesn't seem to be much you can do; it is scolded as ugly on Linux everywhere. And apart from using a hideous toolkit, gitk has been growing worse for me as they put in more functions (mostly not used) the UI becomes even more confusing.

So I instead of a solution I recommend gitg, which is a similar tool, less mature, using GTK+.

u0b34a0f6ae

Posted 2009-08-26T18:56:07.957

Reputation: 560

In 2016 gitg looks pretty mature. – Luís de Sousa – 2016-04-12T09:33:10.087

gitg is much nicer. +1 for that! – crazy2be – 2011-05-14T17:58:58.210

3+1 gitg didn't know about thatone – Joakim Elofsson – 2009-08-26T20:43:22.530

I've heard about gitg. Sounds promising.

Though, the thing is, gitk looked OK on windows, if I remember correctly. – hasen – 2009-08-27T00:14:39.280

2All tcl/tk apps look hideous, unfortunately. – jpaugh – 2011-12-03T19:07:45.007

1@jpaugh No, not all, just those that don't use ttk styles, the Tk 'theme' system. – Lloeki – 2012-12-05T15:00:30.540

11

tcl/tk 8.5 is actually themeable and looks rather native on Windows 7 and apparently on Mac. Less care seems to have been given to write theme engine bridges for it under linux, but you can do one of three things:

To have it persist between reboots add the line *TkTheme: clam to ~/.Xresources, but I'm not sure if that's read whether you launch your desktop environment with startx or not.

Under Ubuntu 11.04 it was pretty easy, adapt the tcl/tk library paths as needed (some people have reported that those instructions are outdated):

$./configure --with-tcl=/usr/lib/tcl8.5/ --with-tk=/usr/lib/tk8.5/

$make

$sudo checkinstall

checkinstall being for creating a quick .deb instead of installing directly, keeps the system tidy.

Then afterwards as above, get tk to use your qt themes:

$echo '*TkTheme: tileqt' | xrdb -merge -
  • There's also a tile-gtk in the same sourceforge repo as tile-qt, but it's thouroughly out-of date. I did manage to build it and install it after much fiddling but the visual results were messy - not recommended.

Gabriel Morin

Posted 2009-08-26T18:56:07.957

Reputation: 146

10

To fix this the Debian (Ubuntu) way:

$ sudo apt-get install tk8.5
$ sudo update-alternatives --config wish

And then pick the wish8.5 alternative.

speakman

Posted 2009-08-26T18:56:07.957

Reputation: 241

4This is what I get on Ubuntu 14.04: update-alternatives: error: no alternatives for wish – Luís de Sousa – 2016-04-12T09:28:49.867

This no longer works - perhaps due to changes in Debian-based distributions over the years. Tried it with Debian 9. – einpoklum – 2019-01-07T13:32:11.523

That's much nicer looking, although it still doesn't follow the Gtk+ or Qt theme. +1 – crazy2be – 2011-05-14T17:54:55.263

Thank you, I didn't expect perfect desktop integration but 8.5 does look much much better that the ones in 8.4. – Lucian Adrian Grijincu – 2011-05-20T20:36:13.207

This answer should be up there! Simply changing tk to 8.5 greatly improves the looks of gitk. – pedromanoel – 2013-04-02T13:17:34.687

8

Gabriel Morin's post is good, but tile-qt doesn't build anymore with those instructions and, though the blog post he linked to (mine, by the way) still works, it's no longer the best solution I know.

For people who want something better than the "clam" theme, PySolFC includes a Clearlooks theme for Ttk and I wrote another blog post which explains how to install it.

Here are the relevant parts of it, adapted for a Lubuntu user (which I now am):

# Get the theme
sudo apt-get install pysolfc

# Copy it into your user profile to not rely on PySolFC's presence
mkdir -p ~/.local/share/tkthemes
cp -r /usr/share/games/pysolfc/themes/clearlooks ~/.local/share/tkthemes/

# (optional) Remove PySolFC now
sudo apt-get remove pysolfc
sudo apt-get autoremove

# Add it to Ttk's search path
echo "export TCLLIBPATH=~/.local/share/tkthemes" >> ~/.xsessionrc

# Set the theme
echo "*TkTheme: clearlooks" >> ~/.Xresources

# Test it in this specific terminal window
export TCLLIBPATH=~/.local/share/tkthemes
xrdb -merge ~/.Xresources
git gui     # gitk's "this isn't a repo" dialog is always ugly

# ...and then log out and back in to apply .xsessionrc for the whole desktop

There are some widgets which are still ugly (the menu bar and the SHA1 ID: text, which needs to be patched in gitk to be themable) but I don't know enough Tcl/Tk to patch things.

(And I've heard rumors that the menu bar wasn't made themable because it's delegated to the OS to draw on Windows and MacOS)

ssokolow

Posted 2009-08-26T18:56:07.957

Reputation: 696

I like the fact that you noticed the link to your blog and came back with an improved solution :) . If I find some time to set myself up again I might update the build instructions for tileqt, since I imagine it's still a viable alternative to what you propose. – Gabriel Morin – 2014-08-25T15:28:26.910

This script indeed does something, it is just not visible. Still get the ugly light coloured theme. Tested on Ubuntu 14.04. – Luís de Sousa – 2016-04-13T09:13:40.190

Well, I'm on a Lubuntu 14.04 system that got frankenstein'd into a partly Kubuntu 14.04 system and I can say that this works perfectly with git gui (which I use daily), so I have no idea what might be wrong on your end. This should fall firmly within the common core shared by all *buntu distros. – ssokolow – 2016-04-14T03:23:56.577

4

You cannot easily make gitk follow your other themes, but its appearance is fairly customisable.

As mentioned elsewhere you can choose your fonts manually. Nearly all colors are modifiable as well, in your ~/.gitk. Make sure gitk is not running while modifying this file though, as it overwrites the content at exit.

Here is what I have (my ~/.gitk file): enter image description here

Gauthier

Posted 2009-08-26T18:56:07.957

Reputation: 1 003

1

(Disclaimer: I'm the maintainer.) There is now an official Dracula dark theme for gitk: https://draculatheme.com/gitk

– Aurelien – 2018-04-16T18:03:30.083

1@Aurelien Good to see others using gitk theming, I wrote the commit that allows changing these parameters ;) (but Dracula has too high contrast for me. Nice job though!) – Gauthier – 2018-04-16T18:14:51.303

Gauthier, @Aurelien: I tried placing the linked-to text in my ~/.gitk file - it had no effect. – einpoklum – 2019-01-07T13:37:43.730

@Aurelien: Are there other themes? Particularly, is there a theme which looks like the default but less ugly? – einpoklum – 2019-01-07T13:40:51.520

1

@einpoklum: personally I put this text in ~/.config/git/gitk instead of ~/.gitk. See https://draculatheme.com/gitk/ . Does this help? I don't know about other themes.

– Aurelien – 2019-01-14T14:42:45.347

1@Aurelien: It does. – einpoklum – 2019-01-14T14:49:26.413

1

as kaizer.se said gitk (and also git gui) is implemented using tcl/tk, tk is the widget toolkit and do not care about gtk-based themes (or any at all afaik). And no this is not something you can fix (well rewriting gitk to use gtk widget's is ofc not impossible but hardly a 'fix') other than replacing it with something else.

You can change the font's in the preferences to make it slightly better, I use:
Main font: Helvetica 9
Diff display font: Courier 9
User interface font: Helvetica 9

This looks a little better and not as broken as the default's, well for me.

Joakim Elofsson

Posted 2009-08-26T18:56:07.957

Reputation: 2 056

0

I have built tile-gtk (on Mint 17.2) with following commands:

sudo apt install tcl-dev tk-dev glib2.0-dev libglib2.0-dev
git clone git://git.code.sf.net/p/tktable/tile-gtk tktable-tile-gtk
cd tktable-tile-gtk
./configure --with-glib-lib-inc=$(pkg-config --cflags glib-2.0) --with-gtk-lib-inc=$(pkg-config --cflags gdk-2.0)
make
sudo make install
echo '*TkTheme: tilegtk' | xrdb -merge -

Works good, looks good; unfortunately I can run only one instance of gitk at time due to tilegtk.

p2rkw

Posted 2009-08-26T18:56:07.957

Reputation: 123

0

After some of the suggestions here and elsewhere, I came to the conclusion this whole Tcl/Tk business is an helpless case - it never manages to use the DE theme.

Therefore I decided to try other GUIs for Git. The Git Wiki lists a number of GUIs, some of which are quite able:

  • git-cola - based on PyQt4 and seems to be most powerful in term of functionality.

  • QGit - based on Qt, looks great but lacks some functionality, especially in what concerns branches.

  • GitKraken - a powerful and elegant interface based on Electron and loaded with features; free, but requires user registration with the vendor.

My advice for users struggling with git-gui/gitk is to simply switch to one of the above.

Luís de Sousa

Posted 2009-08-26T18:56:07.957

Reputation: 319

0

In my case, the correct version of tk and wish were installed on the system, and the problem arose from having installed anaconda.

The anaconda install script adds export PATH=":/path/to/anaconda3/bin:$PATH" to your ~/.bashrc, which causes the wish program installed there to take precedence.

Rewriting this line to export PATH="$PATH:/path/to/anaconda3/bin" allowed the system's wish to be executed by gitk, and solved the font problem.

ysalmon

Posted 2009-08-26T18:56:07.957

Reputation: 143