1
0
Fork
You've already forked xsettingsd
0
forked from derat/xsettingsd
Configure X11 applications via XSETTINGS specification
  • C++ 92.6%
  • Roff 2.7%
  • Python 2.5%
  • CMake 2.2%
2023年08月06日 10:49:34 +02:00
.gitignore remove debian/ 2021年01月08日 10:57:38 -04:00
CMakeLists.txt Move to codeberg.org. 2023年04月18日 09:07:29 -04:00
common.cc Fall back to checking XDG locations for config files. 2015年06月14日 19:02:00 -06:00
common.h Fall back to checking XDG locations for config files. 2015年06月14日 19:02:00 -06:00
common_test.cc Fall back to checking XDG locations for config files. 2015年06月14日 19:02:00 -06:00
config_parser.cc Don't cast fgetc()'s return value to a char. 2014年11月22日 21:08:36 -07:00
config_parser.h Don't cast fgetc()'s return value to a char. 2014年11月22日 21:08:36 -07:00
config_parser_test.cc Remove failed-assert tests from config_parser_test.cc. 2023年04月14日 09:27:19 -04:00
COPYING add COPYING file 2009年08月08日 14:33:39 -07:00
data_reader.cc add DataReader 2009年08月08日 12:47:22 -07:00
data_reader.h add DataReader 2009年08月08日 12:47:22 -07:00
data_writer.cc add copyright notice 2009年08月04日 19:58:53 -07:00
data_writer.h add DataReader 2009年08月08日 12:47:22 -07:00
dump_xsettings.1 Move to codeberg.org. 2023年04月18日 09:07:29 -04:00
dump_xsettings.cc Return 1 to indicate error from main() 2018年06月25日 10:58:59 -05:00
README.md Move to codeberg.org. 2023年04月18日 09:07:29 -04:00
SConstruct Update SConstruct 2017年10月13日 08:19:50 +05:30
setting.cc add awful, awful support for reading colors 2009年08月08日 13:50:05 -07:00
setting.h add awful, awful support for reading colors 2009年08月08日 13:50:05 -07:00
setting_test.cc add test for writing colors 2009年08月08日 15:41:39 -07:00
settings_manager.cc add one more missing stdio.h include 2009年12月08日 08:52:30 -08:00
settings_manager.h fix timestamp when announcing manager selection 2009年08月24日 08:06:28 -07:00
xsettingsd.1 Move to codeberg.org. 2023年04月18日 09:07:29 -04:00
xsettingsd.cc Fall back to checking XDG locations for config files. 2015年06月14日 19:02:00 -06:00
xsettingsd.service.in added capability to the systemd user service to trigger config reload in the daemon 2023年08月06日 10:49:34 +02:00

xsettingsd

xsettingsd is a daemon that implements the XSETTINGS specification.

It is intended to be small, fast, and minimally dependent on other libraries. It can serve as an alternative to gnome-settings-daemon for users who are not using the GNOME desktop environment but who still run GTK+ applications and want to configure things such as themes, font antialiasing/hinting, and UI sound effects.

Installation

Requirements:

  • C++ compiler
  • CMake or SCons
  • X11 headers (libx11-dev in Debian)
  • GoogleTest (optional, libgtest-dev in Debian)

To compile and install using CMake:

mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/path ..
make
make install

To run tests:

make test

To delete all installed files:

make uninstall

Alternatively, you can compile xsettingsd and dump_xsettings using SCons:

sudo apt-get install scons g++ libstdc++-dev libx11-dev
scons xsettingsd dump_xsettings

Configuration

You may wish to dump your existing settings to use as a starting point. To do this, check that gnome-settings-daemon (or another program that implements XSETTINGS) is running and run the dump_xsettings program. Your current settings should be printed to stdout in xsettingsd's configuration format. To use this as your initial configuration, redirect the output of the program:

dump_xsettings >~/.xsettingsd

At startup, xsettingsd reads its configuration from $HOME/.xsettingsd by default. If it encounters any errors, it exits; otherwise it becomes the XSETTINGS manager on all screens.

After modifying the .xsettingsd file, you can trigger a configuration reload by sending a HUP signal to xsettingsd, e.g.

killall -HUP xsettingsd

If there in a problem with the new configuration, xsettingsd will continue using the previous version.

The format for the configuration file is simple. Setting names and their corresponding values are whitespace-separated, with at most one setting per line.

  • Integer values appear as bare decimal numbers.
  • String values are double-quoted.
  • Color values are (R, G, B, A) or (R, G, B) tuples, where each value ranges between 0 and 65535 (omitting the alpha value results in full opacity).
  • Full-line comments can be started with a # character.

Here is an example .xsettingsd file:

# Configure our fonts.
Xft/Antialias 1
Xft/HintStyle "hintfull"
Xft/Hinting 1
Xft/RGBA "none"
Xft/lcdfilter "none"
# Create a color setting (haven't seen these used anywhere, though).
MyFavoriteColor (33667, 48059, 38036, 32768) # not really my favorite!
EscapedQuote "here's how to put a \" in a string!"

Running

If you are using a ~/.xsession file to control which programs are executed when you start an X session, you can add the following near the top of it:

/path/to/xsettingsd &

Settings

The following table lists some of things that can be configured in GTK+ applications using XSETTINGS. The Details column lists the corresponding properties in the GtkSettings class.

Name Type Description Values Details
Gtk/CursorThemeName string cursor theme (see also #23) e.g. subdirectories of /usr/share/icons gtk-cursor-theme-name
Gtk/DecorationLayout string layout of gtk titlebar buttons :=no titlebar buttons, :minimize,maximize,close=buttons right, see gtk documentation -> gtk-decoration-layout
Net/CursorBlink integer whether the (text editing) cursor should blink 0=no, 1=yes gtk-cursor-blink
Net/CursorBlinkTime integer length of the cursor blink cycle, in milleseconds 1200 (default), 500, etc. gtk-cursor-blink-time
Net/DndDragThreshold integer number of pixels the cursor can move before dragging 8 (default), 0, etc. gtk-dnd-drag-threshold
Net/DoubleClickDistance integer maximum distance allowed between two clicks for them to be considered a double click (in pixels) 5 (default), 20, etc. gtk-double-click-distance
Net/DoubleClickTime integer maximum time allowed between two clicks for them to be considered a double click (in milliseconds) 250 (default), 500, etc. gtk-double-click-time
Net/EnableEventSounds integer whether to play event sounds 0=no, 1=yes gtk-enable-event-sounds
Net/EnableInputFeedbackSounds integer if event sounds are enabled, should they be played in response to input? 0=no, 1=yes gtk-enable-input-feedback-sounds
Net/IconThemeName string icon theme e.g. subdirectories of /usr/share/icons gtk-icon-theme-name
Net/SoundThemeName string sound theme ? gtk-sound-theme-name
Net/ThemeName string widget theme e.g. subdirectories of /usr/share/themes gtk-theme-name
Xft/Antialias integer text antialiasing 0=no, 1=yes, -1=default gtk-xft-antialias
Xft/DPI integer display DPI 1024*dots/inch, -1=default gtk-xft-dpi
Xft/HintStyle string text hinting style hintnone, hintslight, hintmedium, hintfull gtk-xft-hintstyle
Xft/Hinting integer text hinting 0=no, 1=yes, -1=default gtk-xft-hinting
Xft/RGBA string text subpixel rendering none, rgb, bgr, vrgb, vbgr gtk-xft-rgba

https://www.freedesktop.org/wiki/Specifications/XSettingsRegistry/ also lists standardized settings.

Other Notes

Some applications (e.g. Firefox 3) don't seem to use XSETTINGS to control text rendering. You can try additionally putting something like the following in ~/.fonts.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="font" >
 <edit mode="assign" name="rgba">
 <const>none</const>
 </edit>
 </match>
 <match target="font" >
 <edit mode="assign" name="hinting">
 <bool>true</bool>
 </edit>
 </match>
 <match target="font" >
 <edit mode="assign" name="hintstyle">
 <const>hintfull</const>
 </edit>
 </match>
 <match target="font" >
 <edit mode="assign" name="antialias">
 <bool>true</bool>
 </edit>
 </match>
</fontconfig>

and in ~/.Xresources or ~/.Xdefaults:

Xft.antialias: 1
Xft.hinting: 1
Xft.rgba: none
Xft.hintstyle: hintfull

(Tweak the values to your own preferences, of course.)