Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Modifying gtk2 fonts <SOLVED>

378 views
Skip to first unread message

Steve Litt

unread,
Jul 4, 2014, 11:30:02 AM7/4/14
to
Hi all,

I use dwm, a window manager that gives you no help with fonts: You need
to modify fonts yourself.

Thunar and xchat had the tiniest fonts you can imagine. The ldd command
revealed both are gtk2, so I followed tens of suggestions listed on
the web (many contradictory, few explicit), to change gtk2 fonts with
files like ~/.gtkrc-2.0 and ~/.gtkrc.mine, but nothing change.

Finally I ran lxappearance changed the fonts that way, and Thunar and
Xchat now had readable fonts. But of course, I use dwm for low memory
usage, so I don't want to be running lxappearance every time I start X.

And I don't have to. lxappearance does its magic by writing the
*correct* stuff to ~/.gtkrc-2.0. From then on, that file remains, boot
after boot, until something or somebody deliberately changes it. No
further lxappearance runs needed.

So, if anybody else has been tearing out their hair trying to follow
all the contradictory Web suggestions for changing fonts on gtk2 apps,
now you can save what hair you have left.

SteveT

Steve Litt * http://www.troubleshooters.com/
Troubleshooting Training * Human Performance


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20140704112...@mydesq2.domain.cxm

Siard

unread,
Jul 4, 2014, 3:10:02 PM7/4/14
to
Steve Litt wrote:
> lxappearance does its magic by writing the *correct* stuff to
> ~/.gtkrc-2.0.

The traditional way to set gtk2 fonts used to be: either from within
Gnome or by running gnome-settings-daemon.
But editing ~/.gtkrc-2.0 is indeed the easiest and most hassle-free way
when not using Gnome.

To set the default gtk2-font, add something like this:

gtk-font-name = "Liberation Sans 11"

I also find this one useful:

gtk-can-change-accels = 1

It allows you to create a keyboard shortcut by hovering the mouse
pointer over a menu item and pressing the desired key or key
combination. It works for GTK2 applications, such as the Claws Mail
that you're using.

These are two more examples I saw somewhere, though I did not try them
myself:

gtk-theme-name = "AIR"
gtk-icon-theme-name = "Tango"


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20140704210510.f...@kpnplanet.nl

Steve Litt

unread,
Jul 4, 2014, 4:00:03 PM7/4/14
to
On Fri, 4 Jul 2014 21:05:10 +0200
Siard <shie...@kpnplanet.nl> wrote:

> Steve Litt wrote:
> > lxappearance does its magic by writing the *correct* stuff to
> > ~/.gtkrc-2.0.
>
> The traditional way to set gtk2 fonts used to be: either from within
> Gnome or by running gnome-settings-daemon.
> But editing ~/.gtkrc-2.0 is indeed the easiest and most hassle-free
> way when not using Gnome.
>
> To set the default gtk2-font, add something like this:
>
> gtk-font-name = "Liberation Sans 11"

The preceding doesn't work on my machine. I tried.

>
> I also find this one useful:
>
> gtk-can-change-accels = 1
>
> It allows you to create a keyboard shortcut by hovering the mouse
> pointer over a menu item and pressing the desired key or key
> combination. It works for GTK2 applications, such as the Claws Mail
> that you're using.

Nice!

I'll try it.

>
> These are two more examples I saw somewhere, though I did not try them
> myself:
>
> gtk-theme-name = "AIR"
> gtk-icon-theme-name = "Tango"

SteveT

Steve Litt * http://www.troubleshooters.com/
Troubleshooting Training * Human Performance


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20140704155...@mydesq2.domain.cxm

Brian

unread,
Jul 4, 2014, 4:20:01 PM7/4/14
to
On Fri 04 Jul 2014 at 21:05:10 +0200, Siard wrote:

> Steve Litt wrote:
> > lxappearance does its magic by writing the *correct* stuff to
> > ~/.gtkrc-2.0.
>
> The traditional way to set gtk2 fonts used to be: either from within
> Gnome or by running gnome-settings-daemon.
> But editing ~/.gtkrc-2.0 is indeed the easiest and most hassle-free way
> when not using Gnome.

The OP didn't edit ~/.gtkrc-2.0; lxappearance did. But you are correct,
it is the easiest way.

> To set the default gtk2-font, add something like this:
>
> gtk-font-name = "Liberation Sans 11"
>
> I also find this one useful:
>
> gtk-can-change-accels = 1
>
> It allows you to create a keyboard shortcut by hovering the mouse
> pointer over a menu item and pressing the desired key or key
> combination. It works for GTK2 applications, such as the Claws Mail
> that you're using.
>
> These are two more examples I saw somewhere, though I did not try them
> myself:
>
> gtk-theme-name = "AIR"
> gtk-icon-theme-name = "Tango"

A search with "gtk settings" presents you immediately with the primary
source:

https://developer.gnome.org/gtk3/stable/GtkSettings.html

Even "~/.gtkrc-2.0 font" leads you there after a click or two.

What is written by lxappearance is unknown; it's probably similar to the
examples give above.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20140704201...@copernicus.demon.co.uk

Siard

unread,
Jul 5, 2014, 9:10:02 AM7/5/14
to
Steve Litt:
> Siard:
> > But editing ~/.gtkrc-2.0 is indeed the easiest and most hassle-free
> > way when not using Gnome.
> >
> > To set the default gtk2-font, add something like this:
> >
> > gtk-font-name = "Liberation Sans 11"
>
> The preceding doesn't work on my machine. I tried.

To use the font mentioned here, the package fonts-liberation has to be
installed. Liberation Sans is my favorite font for display on screen.
Otherwise, I don't know why it doesn't work on your machine. For me, it
has worked as long as GTK2 exists.
Could you show how lxappearance has written the font and font size into
your ~/.gtkrc-2.0 ?


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20140705150415.5...@kpnplanet.nl

Steve Litt

unread,
Jul 5, 2014, 11:50:02 AM7/5/14
to
On Sat, 5 Jul 2014 15:04:15 +0200
Siard <shie...@kpnplanet.nl> wrote:

> Steve Litt:
> > Siard:
> > > But editing ~/.gtkrc-2.0 is indeed the easiest and most
> > > hassle-free way when not using Gnome.
> > >
> > > To set the default gtk2-font, add something like this:
> > >
> > > gtk-font-name = "Liberation Sans 11"
> >
> > The preceding doesn't work on my machine. I tried.
>
> To use the font mentioned here, the package fonts-liberation has to be
> installed. Liberation Sans is my favorite font for display on screen.
> Otherwise, I don't know why it doesn't work on your machine. For me,
> it has worked as long as GTK2 exists.

No, that's not it, I was using Sans 17 or something like that. A font I
definitely had.

> Could you show how lxappearance has written the font and font size
> into your ~/.gtkrc-2.0 ?

Certainly:

===========================================
# DO NOT EDIT! This file will be overwritten by LXAppearance.
# Any customization should be done in ~/.gtkrc-2.0.mine instead.

gtk-theme-name="Simple-Green"
gtk-icon-theme-name="hicolor"
gtk-font-name="Sans 17"
gtk-cursor-theme-size=0
gtk-toolbar-style=GTK_TOOLBAR_BOTH
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR
gtk-button-images=1
gtk-menu-images=1
gtk-enable-event-sounds=1
gtk-enable-input-feedback-sounds=1
gtk-xft-antialias=1
gtk-xft-hinting=1
gtk-xft-hintstyle="hintslight"
gtk-xft-rgba="rgb"
include "/home/slitt/.gtkrc-2.0.mine"
===========================================

The preceding works perfectly. Sad thing is, I'm almost positive I did
the "gtk-font-name="Sans 17"" thing manually earlier, and it didn't
affect Thunar or xchat.

SteveT

Steve Litt * http://www.troubleshooters.com/
Troubleshooting Training * Human Performance


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20140705114...@mydesq2.domain.cxm

Siard

unread,
Jul 5, 2014, 2:00:02 PM7/5/14
to
Steve Litt wrote:
> I was using Sans 17 or something like that. A font I definitely had.

'Sans' is a generic font name, just like 'serif' and 'monospace'.
It is an alias of some existing sans font, e.g. Deja Vu Sans.
As far as I can see, this is done in /etc/fonts/fonts.conf
("Accept deprecated 'sans' alias, replacing it with 'sans-serif'")
and /etc/fonts/conf.avail/40-generic.conf, replacing sans-serif with
some sans-serif font that exists on your system.

> > Could you show how lxappearance has written the font and font size
> > into your ~/.gtkrc-2.0 ?
>
> Certainly:
>
> <snip>

Interesting. I'll try these.

> The preceding works perfectly. Sad thing is, I'm almost positive I did
> the "gtk-font-name="Sans 17"" thing manually earlier, and it didn't
> affect Thunar or xchat.

Mysterious. Some permission problem perhaps.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20140705195622.4...@kpnplanet.nl
0 new messages