gtkrc-to-gsettings 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/bin/sh
  2. # If you don't use a (Gnome) settings daemon, this will manually add some values to the dconf database
  3. # (through gsettings)
  4. cmd="$1"
  5. do_cmd() {
  6. case $cmd in
  7. get) >&2 echo -n "$schema $key "; >&2 gsettings get "$schema" "$key"
  8. ;;
  9. set) >&2 gsettings set "$schema" "$key" "$val"
  10. ;;
  11. *) >&2 echo "unknown command \"$cmd\" - should be either get or set"
  12. exit 1
  13. ;;
  14. esac
  15. }
  16. ini="${XDG_CONFIG_HOME-$HOME/.config}/gtk-3.0/settings.ini"
  17. rex="gtk-theme-name|gtk-icon-theme-name|gtk-font-name|gtk-cursor-theme-name|gtk-cursor-theme-size"
  18. schema="org.gnome.desktop.interface"
  19. grep -E "^($rex)" "$ini" | while read -r line; do
  20. val="${line#*=}"
  21. key="${line%=*}"
  22. case "$key" in
  23. gtk-theme-name)
  24. [[ "$cmd" == set ]] && echo "$val" # see wiki.archlinux.org/title/GTK#Themes
  25. key="gtk-theme" ;;
  26. gtk-icon-theme-name) key="icon-theme" ;;
  27. gtk-font-name) key="font-name";;
  28. gtk-cursor-theme-name) key="cursor-theme";;
  29. gtk-cursor-theme-size) key="cursor-size";;
  30. gtk-enable-event-sounds) key="event-sounds";schema="org.gnome.desktop.sound";;
  31. gtk-enable-input-feedback-sounds) key="input-feedback-sounds";schema="org.gnome.desktop.sound";;
  32. esac
  33. [[ "$key" != "" && "$val" != "" ]] && {
  34. [[ "$val" =~ ^[0-9]+$ ]] || val="'$val'"
  35. }
  36. do_cmd
  37. done
  38. rex="gtk-enable-event-sounds|gtk-enable-input-feedback-sounds"
  39. schema="org.gnome.desktop.sound"
  40. grep -E "^($rex)" "$ini" | while read -r line; do
  41. val="${line#*=}"
  42. key="${line%=*}"
  43. case "$key" in
  44. gtk-enable-event-sounds) key="event-sounds";;
  45. gtk-enable-input-feedback-sounds) key="input-feedback-sounds";;
  46. esac
  47. [[ "$key" != "" && "$val" != "" ]] && {
  48. [[ "$val" =~ ^[01]+$ ]] && {
  49. [[ "$val" == 1 ]] && val=true || val=false
  50. } || val="'$val'"
  51. }
  52. do_cmd
  53. done
  54. ### GSETTINGS ###
  55. # org.gnome.desktop.interface avatar-directories @as []
  56. # org.gnome.desktop.interface can-change-accels false
  57. # org.gnome.desktop.interface clock-format '24h'
  58. # org.gnome.desktop.interface clock-show-date true
  59. # org.gnome.desktop.interface clock-show-seconds false
  60. # org.gnome.desktop.interface clock-show-weekday false
  61. # org.gnome.desktop.interface color-scheme 'default'
  62. # org.gnome.desktop.interface cursor-blink true
  63. # org.gnome.desktop.interface cursor-blink-time 1200
  64. # org.gnome.desktop.interface cursor-blink-timeout 10
  65. # org.gnome.desktop.interface cursor-size 24
  66. # org.gnome.desktop.interface cursor-theme 'Adwaita'
  67. # org.gnome.desktop.interface document-font-name 'Cantarell 11'
  68. # org.gnome.desktop.interface enable-animations false
  69. # org.gnome.desktop.interface enable-hot-corners true
  70. # org.gnome.desktop.interface font-antialiasing 'grayscale'
  71. # org.gnome.desktop.interface font-hinting 'slight'
  72. # org.gnome.desktop.interface font-name 'Cantarell 11'
  73. # org.gnome.desktop.interface font-rgba-order 'rgb'
  74. # org.gnome.desktop.interface gtk-color-palette 'black:white:gray50:red:purple:blue:light blue:green:yellow:orange:lavender:brown:goldenrod4:dodger blue:pink:light green:gray10:gray30:gray75:gray90'
  75. # org.gnome.desktop.interface gtk-color-scheme ''
  76. # org.gnome.desktop.interface gtk-enable-primary-paste true
  77. # org.gnome.desktop.interface gtk-im-module ''
  78. # org.gnome.desktop.interface gtk-im-preedit-style 'callback'
  79. # org.gnome.desktop.interface gtk-im-status-style 'callback'
  80. # org.gnome.desktop.interface gtk-key-theme 'Default'
  81. # org.gnome.desktop.interface gtk-theme 'Adwaita'
  82. # org.gnome.desktop.interface gtk-timeout-initial 200
  83. # org.gnome.desktop.interface gtk-timeout-repeat 20
  84. # org.gnome.desktop.interface icon-theme 'Adwaita'
  85. # org.gnome.desktop.interface locate-pointer false
  86. # org.gnome.desktop.interface menubar-accel 'F10'
  87. # org.gnome.desktop.interface menubar-detachable false
  88. # org.gnome.desktop.interface menus-have-tearoff false
  89. # org.gnome.desktop.interface monospace-font-name 'Source Code Pro 10'
  90. # org.gnome.desktop.interface overlay-scrolling true
  91. # org.gnome.desktop.interface scaling-factor uint32 0
  92. # org.gnome.desktop.interface show-battery-percentage false
  93. # org.gnome.desktop.interface text-scaling-factor 1.0
  94. # org.gnome.desktop.interface toolbar-detachable false
  95. # org.gnome.desktop.interface toolbar-icons-size 'large'
  96. # org.gnome.desktop.interface toolbar-style 'both-horiz'
  97. # org.gnome.desktop.interface toolkit-accessibility false
  98. ### GTK SETTINGS.INI ###
  99. # gtk-theme-name
  100. # gtk-icon-theme-name
  101. # gtk-font-name
  102. # gtk-cursor-theme-name
  103. # gtk-cursor-theme-size
  104. # gtk-toolbar-style
  105. # gtk-toolbar-icon-size
  106. # gtk-button-images
  107. # gtk-menu-images
  108. # gtk-enable-event-sounds
  109. # gtk-enable-input-feedback-sounds
  110. # gtk-xft-antialias
  111. # gtk-xft-hinting
  112. # gtk-xft-hintstyle
  113. # gtk-xft-rgba