Set font size in gdm (login manager)

2 replies [Last post]
hpb
hpb
Offline
Joined: 08/09/2013

Hi,

Can somebody tell me how I can change the font size in GDM (login manager)? It seems that there is no font setting possibility in /etc/init/gdm.conf. I'm using Trisquel 6.0 Gnome ed.

Thanx.

mYself
Offline
Joined: 01/18/2012

Same problem with Trisquel 5.5. Since the migration to Gnome 3, the usual methods doesn't work anymore. After many different tries I let it be the way it was. I doesn't say it can be done though, but the solution will be very complicated, or you will require a third-party application for this.

Mampir
Offline
Joined: 12/16/2009

It's rather complicated, but I managed find out how you do it. Here's an outline of the steps:

  1. Fix ownership of directories used by gdm.
  2. Start a dbus session for gdm and remember it's address and PID.
  3. Configure parameters of gdm, such as the font.
  4. Kill the dbus session.
  5. Restart gdm.

Fix the ownership of directories for GDM, otherwise you will not have the needed permission to configure anything:

sudo chown -cR gdm: /var/lib/gdm/.config

Start a D-Bus session as GDM, so you can use gsettings to configure it. Also copy the output of the command:

sudo -u gdm dbus-launch

The previous command will output stuff. You should save the two lines similar to the following:

DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-hbrQyUX0jK,guid=83294e9d35f2e0c5a969fcd9000007ad

DBUS_SESSION_BUS_PID=1234

Now you can set the font size of GDM. It's done with one long command. You use the "...ADDRESS=" from previous output. In my example I set the font to "DejaVu Sans 9":

sudo -u gdm DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-hbrQyUX0jK,guid=83294e9d35f2e0c5a969fcd9000007ad gsettings set org.gnome.desktop.interface font-name 'DejaVu Sans 9'

You can set other things with gsettings, such as the icon theme. When you're ready as good practice, you should close the D-Bus session you've started. You use the "...PID=" line from before:

sudo kill 1234

If you want to see what you've done now, you can restart GDM. Keep in mind that this command will probably close all you programs:

sudo restart gdm

Thats's it.

I've also wrote a script for this:

#! /bin/bash

# Give GDM ownership to its files
sudo chown -cR gdm: /var/lib/gdm/.config

dbus_address=""
dbus_pid=0

# Start a D-Bus session for GDM and save its address and PID
for var in $(sudo -u gdm dbus-launch); do
    echo $var
    if [ $(echo $var | grep -E '^DBUS_SESSION_BUS_ADDRESS=') ]; then
        dbus_address=$(
            echo $var |
            sed -r 's/^DBUS_SESSION_BUS_ADDRESS=//'
        )
    elif [ $(echo $var | grep -E '^DBUS_SESSION_BUS_PID=') ]; then
        dbus_pid=$(
            echo $var |
            sed -r 's/^DBUS_SESSION_BUS_PID=//'
        )
    fi
done

# Set GDM settings
sudo -u gdm DBUS_SESSION_BUS_ADDRESS="$dbus_address" \
    gsettings set org.gnome.desktop.interface font-name 'Sans 9'

# Close the D-Bus session
sudo kill $dbus_pid