gtksettings

package
v0.2.21 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 10 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

func Paths added in v0.2.15

func Paths(env xdg.Env) []string

Paths lists the settings.ini files Load reads, in load order: the system config dirs from least to most important ($XDG_CONFIG_DIRS lists the most important first), then the user's.

Types

type HintStyle added in v0.2.15

type HintStyle uint8

HintStyle is gtk-xft-hintstyle.

const (
	// HintStyleUnset means no file sets gtk-xft-hintstyle.
	HintStyleUnset HintStyle = iota
	// HintNone is hintnone.
	HintNone
	// HintSlight is hintslight.
	HintSlight
	// HintMedium is hintmedium.
	HintMedium
	// HintFull is hintfull.
	HintFull
)

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 Toggle
	// DecorationLayout is gtk-decoration-layout, the buttons of a
	// client-side titlebar ("icon:minimize,maximize,close").
	DecorationLayout string
	// XftAntialias is gtk-xft-antialias.
	XftAntialias Toggle
	// XftHinting is gtk-xft-hinting.
	XftHinting Toggle
	// XftHintStyle is gtk-xft-hintstyle.
	XftHintStyle HintStyle
	// XftRGBA is gtk-xft-rgba.
	XftRGBA SubpixelOrder
	// CursorBlink is gtk-cursor-blink.
	CursorBlink Toggle
	// CursorBlinkTime is gtk-cursor-blink-time, one whole blink cycle.
	CursorBlinkTime time.Duration
	// CursorBlinkTimeout is gtk-cursor-blink-timeout, how long the
	// caret keeps blinking after the last keypress.
	CursorBlinkTimeout time.Duration
	// DoubleClickTime is gtk-double-click-time.
	DoubleClickTime time.Duration
	// DndDragThreshold is gtk-dnd-drag-threshold, in logical pixels.
	DndDragThreshold uint32
	// EnablePrimaryPaste is gtk-enable-primary-paste.
	EnablePrimaryPaste Toggle
	// OverlayScrolling is gtk-overlay-scrolling.
	OverlayScrolling Toggle
	// ShowStatusShapes is gtk-show-status-shapes.
	ShowStatusShapes Toggle
	// SoundThemeName is gtk-sound-theme-name.
	SoundThemeName string
	// EnableEventSounds is gtk-enable-event-sounds.
	EnableEventSounds Toggle
}

Settings are the settings.ini keys a desktop's GTK apps take their look and feel 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 SubpixelOrder added in v0.2.15

type SubpixelOrder uint8

SubpixelOrder is gtk-xft-rgba, the layout of a pixel's subpixels.

const (
	// SubpixelUnset means no file sets gtk-xft-rgba.
	SubpixelUnset SubpixelOrder = iota
	// SubpixelNone is none: grayscale antialiasing.
	SubpixelNone
	// SubpixelRGB is rgb.
	SubpixelRGB
	// SubpixelBGR is bgr.
	SubpixelBGR
	// SubpixelVRGB is vrgb.
	SubpixelVRGB
	// SubpixelVBGR is vbgr.
	SubpixelVBGR
)

type Toggle added in v0.2.15

type Toggle uint8

Toggle is a boolean key: unset when no file sets it, so GTK's own default stands.

const (
	// ToggleUnset means no file sets the key.
	ToggleUnset Toggle = iota
	// ToggleOn is the key set true.
	ToggleOn
	// ToggleOff is the key set false.
	ToggleOff
)

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