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

  Fix ownership of directories used by gdm.
  Start a dbus session for gdm and remember it's address and PID.
  Configure parameters of gdm, such as the font.
  Kill the dbus session.
  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


Reply via email to