Advertisement
poetician

Turquoise | gnome-terminal 256

Apr 3rd, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. # Base16 oomox-Turquoise - Gnome Terminal color scheme install script
  3. # oomox-Turquoise
  4.  
  5. [[ -z "$PROFILE_NAME" ]] && PROFILE_NAME="Base 16 oomox-Turquoise 256"
  6. [[ -z "$PROFILE_SLUG" ]] && PROFILE_SLUG="base-16-oomox-turquoise-256"
  7. [[ -z "$DCONF" ]] && DCONF=dconf
  8. [[ -z "$UUIDGEN" ]] && UUIDGEN=uuidgen
  9.  
  10. dset() {
  11. local key="$1"; shift
  12. local val="$1"; shift
  13.  
  14. if [[ "$type" == "string" ]]; then
  15. val="'$val'"
  16. fi
  17.  
  18. "$DCONF" write "$PROFILE_KEY/$key" "$val"
  19. }
  20.  
  21. # Because dconf still doesn't have "append"
  22. dlist_append() {
  23. local key="$1"; shift
  24. local val="$1"; shift
  25.  
  26. local entries="$(
  27. {
  28. "$DCONF" read "$key" | tr -d '[]' | tr , "\n" | fgrep -v "$val"
  29. echo "'$val'"
  30. } | head -c-1 | tr "\n" ,
  31. )"
  32.  
  33. "$DCONF" write "$key" "[$entries]"
  34. }
  35.  
  36. # Newest versions of gnome-terminal use dconf
  37. if which "$DCONF" > /dev/null 2>&1; then
  38. # Check that uuidgen is available
  39. type $UUIDGEN >/dev/null 2>&1 || { echo >&2 "Requires uuidgen but it's not installed. Aborting!"; exit 1; }
  40.  
  41. [[ -z "$BASE_KEY_NEW" ]] && BASE_KEY_NEW=/org/gnome/terminal/legacy/profiles:
  42.  
  43. if [[ -n "`$DCONF list $BASE_KEY_NEW/`" ]]; then
  44. if which "$UUIDGEN" > /dev/null 2>&1; then
  45. PROFILE_SLUG=`uuidgen`
  46. fi
  47.  
  48. if [[ -n "`$DCONF read $BASE_KEY_NEW/default`" ]]; then
  49. DEFAULT_SLUG=`$DCONF read $BASE_KEY_NEW/default | tr -d \'`
  50. else
  51. DEFAULT_SLUG=`$DCONF list $BASE_KEY_NEW/ | grep '^:' | head -n1 | tr -d :/`
  52. fi
  53.  
  54. DEFAULT_KEY="$BASE_KEY_NEW/:$DEFAULT_SLUG"
  55. PROFILE_KEY="$BASE_KEY_NEW/:$PROFILE_SLUG"
  56.  
  57. # Copy existing settings from default profile
  58. $DCONF dump "$DEFAULT_KEY/" | $DCONF load "$PROFILE_KEY/"
  59.  
  60. # Add new copy to list of profiles
  61. dlist_append $BASE_KEY_NEW/list "$PROFILE_SLUG"
  62.  
  63. # Update profile values with theme options
  64. dset visible-name "'$PROFILE_NAME'"
  65. dset palette "['#2aa1b7', '#c73202', '#586442', '#7e5c02', '#1b58cb', '#8e47ac', '#416289', '#073351', '#186983', '#c73202', '#586442', '#7e5c02', '#1b58cb', '#8e47ac', '#416289', '#b9e2f6']"
  66. dset background-color "'#2aa1b7'"
  67. dset foreground-color "'#073351'"
  68. dset bold-color "'#073351'"
  69. dset bold-color-same-as-fg "true"
  70. dset cursor-colors-set "true"
  71. dset cursor-background-color "'#073351'"
  72. dset cursor-foreground-color "'#2aa1b7'"
  73. dset use-theme-colors "false"
  74. dset use-theme-background "false"
  75.  
  76. unset PROFILE_NAME
  77. unset PROFILE_SLUG
  78. unset DCONF
  79. unset UUIDGEN
  80. exit 0
  81. fi
  82. fi
  83.  
  84. # Fallback for Gnome 2 and early Gnome 3
  85. [[ -z "$GCONFTOOL" ]] && GCONFTOOL=gconftool
  86. [[ -z "$BASE_KEY" ]] && BASE_KEY=/apps/gnome-terminal/profiles
  87.  
  88. PROFILE_KEY="$BASE_KEY/$PROFILE_SLUG"
  89.  
  90. gset() {
  91. local type="$1"; shift
  92. local key="$1"; shift
  93. local val="$1"; shift
  94.  
  95. "$GCONFTOOL" --set --type "$type" "$PROFILE_KEY/$key" -- "$val"
  96. }
  97.  
  98. # Because gconftool doesn't have "append"
  99. glist_append() {
  100. local type="$1"; shift
  101. local key="$1"; shift
  102. local val="$1"; shift
  103.  
  104. local entries="$(
  105. {
  106. "$GCONFTOOL" --get "$key" | tr -d '[]' | tr , "\n" | fgrep -v "$val"
  107. echo "$val"
  108. } | head -c-1 | tr "\n" ,
  109. )"
  110.  
  111. "$GCONFTOOL" --set --type list --list-type $type "$key" "[$entries]"
  112. }
  113.  
  114. # Append the Base16 profile to the profile list
  115. glist_append string /apps/gnome-terminal/global/profile_list "$PROFILE_SLUG"
  116.  
  117. gset string visible_name "$PROFILE_NAME"
  118. gset string palette "#2aa1b7:#c73202:#586442:#7e5c02:#1b58cb:#8e47ac:#416289:#073351:#186983:#c73202:#586442:#7e5c02:#1b58cb:#8e47ac:#416289:#b9e2f6"
  119. gset string background_color "#2aa1b7"
  120. gset string foreground_color "#073351"
  121. gset string bold_color "#073351"
  122. gset bool bold_color_same_as_fg "true"
  123. gset bool cursor-colors-set "true"
  124. gset string cursor-background-color "'#073351'"
  125. gset string cursor-foreground-color "'#2aa1b7'"
  126. gset bool use_theme_colors "false"
  127. gset bool use_theme_background "false"
  128.  
  129. unset PROFILE_NAME
  130. unset PROFILE_SLUG
  131. unset DCONF
  132. unset UUIDGEN
  133.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement