Last active
February 14, 2021 10:46
-
-
Save mcepl/0d5564dbf085c45adcb93b3498a3153d to your computer and use it in GitHub Desktop.
import-gsettings script for https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# usage: import-gsettings | |
import configparser | |
import os | |
import os.path | |
from gi import require_version | |
require_version('Gio', '2.0') | |
from gi.repository import Gio | |
translate_keys = { | |
'gtk-theme-name': 'gtk-theme', | |
'gtk-icon-theme-name': 'icon-theme', | |
'gtk-cursor-theme-name': 'cursor-theme', | |
'gtk-font-name': 'document-font-name', | |
'monospace-font-name': 'monospace-font-name', | |
} | |
config = configparser.ConfigParser() | |
config.read([ | |
os.path.expandvars('$XDG_CONFIG_HOME/gtk-3.0/settings.ini'), | |
os.path.expanduser('~/.config/gtk-3.0/settings.ini')]) | |
sect = config['Settings'] | |
iface = Gio.Settings.new('org.gnome.desktop.interface') | |
for key in translate_keys: | |
iface.set_string(translate_keys[key], sect[key]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment