rc/bin/import-gsettings

20 lines
832 B
Text
Raw Normal View History

2021-02-14 23:02:01 +00:00
#!/bin/sh
# Inspired from https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
# usage: import-gsettings
config="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/settings.ini"
if [ ! -f "$config" ]; then exit 1; fi
gnome_schema="org.gnome.desktop.interface"
gtk_theme="$(sed -nE '/^gtk-theme-name/s/^gtk-theme-name\s*=\s*//p' "$config")"
icon_theme="$(sed -nE '/^gtk-icon-theme-name/s/^gtk-icon-theme-name\s*=\s*//p' "$config")"
cursor_theme="$(sed -nE '/^gtk-cursor-theme-name/s/^gtk-cursor-theme-name\s*=\s*//p' "$config")"
font_theme="$(sed -nE '/^gtk-font-name/s/^gtk-font-name\s*=\s*//p' "$config")"
gsettings set "$gnome_schema" gtk-theme "$gtk_theme"
gsettings set "$gnome_schema" icon-theme "$icon_theme"
gsettings set "$gnome_schema" cursor-theme "$cursor_theme"
gsettings set "$gnome_schema" font-name "$font_name"