-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The font setup is still problematic because of this bug in NerdFonts. ryanoasis/nerd-fonts#270
- Loading branch information
Showing
6 changed files
with
286 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
- hosts: all | ||
tasks: | ||
- name: Install Zsh | ||
become: yes | ||
apt: | ||
name: | ||
- dconf-cli | ||
- font-manager | ||
- git | ||
- unzip | ||
- zsh | ||
update_cache: yes | ||
|
||
- name: Check current user | ||
shell: whoami | ||
register: username | ||
|
||
- name: Check current shell | ||
shell: "getent passwd $USER | cut --delimiter=: --fields=7" | ||
register: current_shell | ||
|
||
- name: Set default shell to Zsh | ||
become: yes | ||
shell: "chsh --shell $(which zsh) {{ username.stdout }}" | ||
when: current_shell.stdout != '/usr/bin/zsh' | ||
|
||
- name: Install oh-my-zsh | ||
shell: sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | ||
args: | ||
creates: ~/.oh-my-zsh | ||
|
||
- name: Configure Zsh | ||
file: | ||
path: ~/.zshrc | ||
src: "{{ playbook_dir }}/../../zsh/zshrc" | ||
force: true | ||
state: link | ||
|
||
- name: Install patched font | ||
become: yes | ||
shell: "{{ playbook_dir }}/../../zsh/install_font.sh" | ||
args: | ||
creates: "/usr/local/share/fonts/NerdFonts/Inconsolata Nerd Font Complete.otf" | ||
|
||
- name: Check for terminal profile | ||
shell: "{{ playbook_dir }}/../../zsh/is_theme_configured.sh" | ||
register: has_profile | ||
|
||
- name: Create terminal profile | ||
shell: "{{ playbook_dir }}/../../zsh/create_solarized_theme.sh" | ||
when: has_profile.stdout != 'true' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname $0)" | ||
|
||
source './theme_vars.sh' | ||
|
||
# Creates a new, blank profile. | ||
function create_new_profile() { | ||
local existing_profile_ids="$(dconf read "$dconf_profile_dir"/list | tr -d "[]")" | ||
[ ${#existing_profile_ids} -gt 0 ] && local delimiter=, | ||
|
||
local profile_id="$(uuidgen)" | ||
local profile_name="$1" | ||
|
||
gsettings set $gsettings_profiles_dir default "'$profile_id'" | ||
dconf write $dconf_profile_dir/list "[${existing_profile_ids}${delimiter} '$profile_id']" | ||
|
||
local profile_dir="$dconf_profile_dir/:$profile_id" | ||
dconf write $profile_dir/visible-name "'$profile_name'" | ||
|
||
echo $profile_id | ||
} | ||
|
||
# Gets the name of a profile by its ID. | ||
function get_profile_name() { | ||
local profile_id="$1" | ||
|
||
echo $(gsettings get $gsettings_profile_dir:$dconf_profile_dir/:$profile_id/ visible-name | tr --delete "\'") | ||
} | ||
|
||
# Join an array of strings with the given character. | ||
function join_on() { | ||
local IFS="$1" | ||
|
||
shift | ||
|
||
echo "$*" | ||
} | ||
|
||
# Removes any old profiles from previous playbook runs. | ||
function remove_old_profiles() { | ||
local current_profile_id="$1" | ||
|
||
declare -a profile_ids | ||
profile_ids=($(gsettings get $gsettings_profiles_dir list | tr --delete "[],\'")) | ||
|
||
declare -a remaining_ids | ||
remaining_ids=() | ||
|
||
for profile_id in ${profile_ids[*]}; do | ||
local profile_name=$(get_profile_name $profile_id) | ||
|
||
if [[ "$profile_name" != "$base_profile_name"* ]] || [ "$profile_id" == "$current_profile_id" ]; | ||
then | ||
remaining_ids+=("'$profile_id'") | ||
continue | ||
fi | ||
|
||
gsettings reset-recursively $gsettings_profile_dir:$dconf_profile_dir/:$profile_id/ | ||
done | ||
|
||
dconf write "$dconf_profile_dir"/list "[$(join_on ',' "${remaining_ids[@]}")]" | ||
} | ||
|
||
profile_id=$(create_new_profile $profile_name) | ||
|
||
pushd ~/.local/share | ||
|
||
git clone --depth 1 https://github.com/Anthony25/gnome-terminal-colors-solarized | ||
|
||
pushd gnome-terminal-colors-solarized | ||
./install.sh --profile $profile_name --scheme $theme_scheme --install-dircolors | ||
popd # gnome-terminal-colors-solarized | ||
|
||
popd # ~/.local/share | ||
|
||
rm --recursive --force ~/.local/share/gnome-terminal-colors-solarized | ||
|
||
remove_old_profiles $profile_id |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
nerd_font_version=v2.0.0 | ||
font_name=SourceCodePro | ||
font_dir=~/.local/share/fonts | ||
|
||
mkdir --parents $font_dir | ||
|
||
pushd $font_dir | ||
curl \ | ||
--fail \ | ||
--location \ | ||
--output "$font_name.zip" \ | ||
https://github.com/ryanoasis/nerd-fonts/releases/download/$nerd_font_version/$font_name.zip | ||
unzip $font_name.zip | ||
rm $font_name.zip | ||
popd |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname $0)" | ||
|
||
source './theme_vars.sh' | ||
|
||
declare -a profile_ids | ||
profile_ids=($(gsettings get $gsettings_profiles_dir list | tr --delete "[],\'")) | ||
|
||
has_theme="false" | ||
for profile_id in ${profile_ids[*]}; do | ||
name=$(gsettings get $gsettings_profile_dir:$dconf_profile_dir/:$profile_id/ visible-name | tr --delete "\'") | ||
|
||
if [ "$name" == "$profile_name" ]; | ||
then | ||
has_theme="true" | ||
fi | ||
done | ||
|
||
echo $has_theme |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# The base name for managed profiles. | ||
base_profile_name=SolarizedDark-v | ||
|
||
# The current profile version. | ||
profile_version=1 | ||
|
||
# The name of the terminal profile. | ||
profile_name=$base_profile_name$profile_version | ||
|
||
# The color scheme of the theme (light/dark). | ||
theme_scheme=dark | ||
|
||
# DConf directory for terminal profiles. | ||
dconf_profile_dir=/org/gnome/terminal/legacy/profiles: | ||
|
||
# GSettings directory for listing terminal profiles. | ||
gsettings_profiles_dir=org.gnome.Terminal.ProfilesList | ||
|
||
# GSettings directory for getting a terminal profile. | ||
gsettings_profile_dir=org.gnome.Terminal.Legacy.Profile |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# If you come from bash you might have to change your $PATH. | ||
# export PATH=$HOME/bin:/usr/local/bin:$PATH | ||
|
||
# Path to your oh-my-zsh installation. | ||
export ZSH="/home/james/.oh-my-zsh" | ||
|
||
# Set name of the theme to load --- if set to "random", it will | ||
# load a random theme each time oh-my-zsh is loaded, in which case, | ||
# to know which specific one was loaded, run: echo $RANDOM_THEME | ||
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes | ||
ZSH_THEME="candy" | ||
|
||
# Set list of themes to pick from when loading at random | ||
# Setting this variable when ZSH_THEME=random will cause zsh to load | ||
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ | ||
# If set to an empty array, this variable will have no effect. | ||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) | ||
|
||
# Uncomment the following line to use case-sensitive completion. | ||
# CASE_SENSITIVE="true" | ||
|
||
# Uncomment the following line to use hyphen-insensitive completion. | ||
# Case-sensitive completion must be off. _ and - will be interchangeable. | ||
# HYPHEN_INSENSITIVE="true" | ||
|
||
# Uncomment the following line to disable bi-weekly auto-update checks. | ||
# DISABLE_AUTO_UPDATE="true" | ||
|
||
# Uncomment the following line to change how often to auto-update (in days). | ||
# export UPDATE_ZSH_DAYS=13 | ||
export UPDATE_ZSH_DAYS=7 | ||
|
||
# Uncomment the following line to disable colors in ls. | ||
# DISABLE_LS_COLORS="true" | ||
|
||
# Uncomment the following line to disable auto-setting terminal title. | ||
DISABLE_AUTO_TITLE="true" | ||
|
||
# Uncomment the following line to enable command auto-correction. | ||
# ENABLE_CORRECTION="true" | ||
|
||
# Uncomment the following line to display red dots whilst waiting for completion. | ||
COMPLETION_WAITING_DOTS="true" | ||
|
||
# Uncomment the following line if you want to disable marking untracked files | ||
# under VCS as dirty. This makes repository status check for large repositories | ||
# much, much faster. | ||
# DISABLE_UNTRACKED_FILES_DIRTY="true" | ||
|
||
# Uncomment the following line if you want to change the command execution time | ||
# stamp shown in the history command output. | ||
# You can set one of the optional three formats: | ||
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" | ||
# or set a custom format using the strftime function format specifications, | ||
# see 'man strftime' for details. | ||
# HIST_STAMPS="mm/dd/yyyy" | ||
|
||
# Would you like to use another custom folder than $ZSH/custom? | ||
# ZSH_CUSTOM=/path/to/new-custom-folder | ||
|
||
# Which plugins would you like to load? | ||
# Standard plugins can be found in ~/.oh-my-zsh/plugins/* | ||
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ | ||
# Example format: plugins=(rails git textmate ruby lighthouse) | ||
# Add wisely, as too many plugins slow down shell startup. | ||
plugins=( | ||
colorize | ||
docker | ||
dotenv | ||
git | ||
) | ||
|
||
source $ZSH/oh-my-zsh.sh | ||
|
||
# User configuration | ||
export LANG=en_US.UTF-8 | ||
export EDITOR='nvim' | ||
export PATH=/usr/local/bin:$PATH | ||
|
||
# Tmux configuration | ||
export TERM="screen-256color-bce" | ||
alias tmux="TERM=screen-256color-bce tmux -u" | ||
|
||
# NVim configuration | ||
export MYNVIMRC=~/.config/nvim/init.vim | ||
|
||
# Pipsi configuration | ||
export PATH=~/.local/bin:$PATH | ||
|
||
# Setup dircolors to match terminal theme | ||
eval `dircolors ~/.dir_colors/dircolors` | ||
|
||
# Local configuration | ||
if [ -f ~/.zshrc_local ]; | ||
then | ||
source ~/.zshrc_local | ||
fi |