gtksettings

package
v0.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 9 Imported by: 3 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gtksettings reads GTK 4's settings.ini: the Settings group GTK falls back to for every setting the desktop does not publish through its portal. The system files (each $XDG_CONFIG_DIRS entry, /etc/xdg by default) load first and the user's ($XDG_CONFIG_HOME/gtk-4.0/settings.ini) overrides them key by key, as gtksettings.c loads them. GTK 4 never reads gtk-3.0's file, so neither does Load.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Animations added in v0.2.1

type Animations uint8

Animations is gtk-enable-animations: unset when no file sets it, as GTK's default is on.

const (
	// AnimationsUnset means no file sets gtk-enable-animations.
	AnimationsUnset Animations = iota
	// AnimationsOn is gtk-enable-animations = true.
	AnimationsOn
	// AnimationsOff is gtk-enable-animations = false.
	AnimationsOff
)

type Settings

type Settings struct {
	// ThemeName is gtk-theme-name.
	ThemeName string
	// IconThemeName is gtk-icon-theme-name.
	IconThemeName string
	// CursorThemeName is gtk-cursor-theme-name.
	CursorThemeName string
	// CursorThemeSize is gtk-cursor-theme-size, in logical pixels.
	CursorThemeSize uint32
	// FontName is gtk-font-name, a Pango font description.
	FontName string
	// XftDPI is gtk-xft-dpi.
	XftDPI XftDPI
	// Animations is gtk-enable-animations.
	Animations Animations
}

Settings are the settings.ini keys a desktop's GTK apps take their look from. A zero field is one no file sets.

func Load

func Load(env xdg.Env) (Settings, error)

Load reads every settings.ini GTK 4 would under env, later files overriding earlier ones key by key. A missing file sets nothing. A file that exists but cannot be read is skipped and reported in the error, which joins one such failure per file; the Settings returned alongside hold what the readable files set.

func Parse

func Parse(data string) Settings

Parse reads the Settings group of one settings.ini: key = value lines, # and ; comments, values optionally double-quoted. Keys in other groups, malformed lines and malformed numbers are ignored, as GTK's permissive load ignores what it cannot use.

type XftDPI

type XftDPI int32

XftDPI is gtk-xft-dpi: the text resolution in 1024ths of a dot per inch, 0 when unset (GTK's -1, "default", reads as unset).

func (XftDPI) DotsPerInch

func (d XftDPI) DotsPerInch() float64

DotsPerInch is the resolution in dots per inch, 0 when unset.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL