roles: add amfora, bash, foot

This commit is contained in:
Hoang Nguyen 2021-11-07 15:41:20 +07:00
parent 0c8cb81326
commit 571c4c91ac
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
11 changed files with 672 additions and 3 deletions

View File

@ -10,7 +10,7 @@ I use Alpine-edge aka. the best binary distro on Earth 😃. Therefore some task
### 🌟 Credits
- [eoli3n/dotfiles](https://github.com/eoli3n/dotfiles) for the idea
- [eoli3n/dotfiles](https://github.com/eoli3n/dotfiles)
### 📄 License

View File

@ -1,5 +1,6 @@
[defaults]
inventory = ./hosts
gathering = explicit
display_skipped_hosts = False
host_key_checking = False
interpreter_python = auto_silent

View File

@ -11,4 +11,7 @@
- '{{ ansible_env.PWD }}/palette.yml'
roles:
- alacritty
- amfora
- bash
- foot
- nvim

View File

@ -1,7 +1,8 @@
---
user_name: FollieHiyuki
user_email: folliekazetani@protonmail.com
default_browser: qutebrowser
term_font: Iosevka Nerd Font
cjk_font: Sarasa Mono J
font_size: 14
theme: nord
theme: nord # 'nord' or 'onedark'

View File

@ -0,0 +1,11 @@
---
- name: Create config directory
file:
path: ~/.config/amfora
state: directory
- name: Copy config
template:
src: config.j2
dest: ~/.config/amfora/config.toml
force: yes

View File

@ -0,0 +1,399 @@
# This is the default config file.
# It also shows all the default values, if you don't create the file.
# All URL values may omit the scheme and/or port, as well as the beginning double slash
# Valid URL examples:
# gemini://example.com
# //example.com
# example.com
# example.com:123
[a-general]
# Press Ctrl-H to access it
home = "gemini://folliehiyuki.com"
# Follow up to 5 Gemini redirects without prompting.
# A prompt is always shown after the 5th redirect and for redirects to protocols other than Gemini.
# If set to false, a prompt will be shown before following redirects.
auto_redirect = false
# What command to run to open a HTTP(S) URL.
# Set to "default" to try to guess the browser, or set to "off" to not open HTTP(S) URLs.
# If a command is set, than the URL will be added (in quotes) to the end of the command.
# A space will be prepended to the URL.
#
# The best to define a command is using a string array.
# Examples:
# http = ['firefox']
# http = ['custom-browser', '--flag', '--option=2']
# http = ['/path/with spaces/in it/firefox']
#
# Note the use of single quotes, so that backslashes will not be escaped.
# Using just a string will also work, but it is deprecated, and will degrade if
# you use paths with spaces.
http = '{{ default_browser }}'
# Any URL that will accept a query string can be put here
# search = "gemini://gus.guru/search"
search = "gemini://geminispace.info/search"
# Whether colors will be used in the terminal
color = true
# Whether ANSI color codes from the page content should be rendered
ansi = true
# Whether to replace list asterisks with unicode bullets
bullets = true
# Whether to show link after link text
show_link = true
# A number from 0 to 1, indicating what percentage of the terminal width the left margin should take up.
left_margin = 0.1
# The max number of columns to wrap a page's text to. Preformatted blocks are not wrapped.
max_width = 100
# 'downloads' is the path to a downloads folder.
# An empty value means the code will find the default downloads folder for your system.
# If the path does not exist it will be created.
# Note the use of single quotes, so that backslashes will not be escaped.
downloads = ''
# Max size for displayable content in bytes - after that size a download window pops up
page_max_size = 2097152 # 2 MiB
# Max time it takes to load a page in seconds - after that a download window pops up
page_max_time = 10
# Whether to replace tab numbers with emoji favicons, which are cached.
emoji_favicons = false
[auth]
# Authentication settings
# Note the use of single quotes for values, so that backslashes will not be escaped.
[auth.certs]
# Client certificates
# Set domain name equal to path to client cert
# "example.com" = 'mycert.crt'
[auth.keys]
# Client certificate keys
# Set domain name equal to path to key for the client cert above
# "example.com" = 'mycert.key'
[keybindings]
# In the future there will be more settings here.
# Hold down shift and press the numbers on your keyboard (1,2,3,4,5,6,7,8,9,0) to set this up.
# It is default set to be accurate for US keyboards.
shift_numbers = "!@#$%^&*()"
[url-handlers]
# Allows setting the commands to run for various URL schemes.
# E.g. to open FTP URLs with FileZilla set the following key:
# ftp = 'filezilla'
# You can set any scheme to "off" or "" to disable handling it, or
# just leave the key unset.
#
# DO NOT use this for setting the HTTP command.
# Use the http setting in the "a-general" section above.
#
# NOTE: These settings are overrided by the ones in the proxies section.
# Note the use of single quotes, so that backslashes will not be escaped.
# This is a special key that defines the handler for all URL schemes for which
# no handler is defined.
other = 'off'
# [[mediatype-handlers]] section
# ---------------------------------
#
# Specify what applications will open certain media types.
# By default your default application will be used to open the file when you select "Open".
# You only need to configure this section if you want to override your default application,
# or do special things like streaming.
#
# Note the use of single quotes for commands, so that backslashes will not be escaped.
#
#
# To open jpeg files with the feh command:
#
# [[mediatype-handlers]]
# cmd = ['feh']
# types = ["image/jpeg"]
#
# Each command that you specify must come under its own [[mediatype-handlers]]. You may
# specify as many [[mediatype-handlers]] as you want to setup multiple commands.
#
# If the subtype is omitted then the specified command will be used for the
# entire type:
#
# [[mediatype-handlers]]
# command = ['vlc', '--flag']
# types = ["audio", "video"]
#
# A catch-all handler can by specified with "*".
# Note that there are already catch-all handlers in place for all OSes,
# that open the file using your default application. This is only if you
# want to override that.
#
# [[mediatype-handlers]]
# cmd = ['some-command']
# types = [
# "application/pdf",
# "*",
# ]
#
# You can also choose to stream the data instead of downloading it all before
# opening it. This is especially useful for large video or audio files, as
# well as radio streams, which will never complete. You can do this like so:
#
# [[mediatype-handlers]]
# cmd = ['vlc', '-']
# types = ["audio", "video"]
# stream = true
#
# This uses vlc to stream all video and audio content.
# By default stream is set to off for all handlers
#
#
# If you want to always open a type in its viewer without the download or open
# prompt appearing, you can add no_prompt = true
#
# [[mediatype-handlers]]
# cmd = ['feh']
# types = ["image"]
# no_prompt = true
#
# Note: Multiple handlers cannot be defined for the same full media type, but
# still there needs to be an order for which handlers are used. The following
# order applies regardless of the order written in the config:
#
# 1. Full media type: "image/jpeg"
# 2. Just type: "image"
# 3. Catch-all: "*"
[cache]
# Options for page cache - which is only for text pages
# Increase the cache size to speed up browsing at the expense of memory
# Zero values mean there is no limit
max_size = 0 # Size in bytes
max_pages = 30 # The maximum number of pages the cache will store
# How long a page will stay in cache, in seconds.
timeout = 1800 # 30 mins
[proxies]
# Allows setting a Gemini proxy for different schemes.
# The settings are similar to the url-handlers section above.
# E.g. to open a gopher page by connecting to a Gemini proxy server:
# gopher = "example.com:123"
#
# Port 1965 is assumed if no port is specified.
#
# NOTE: These settings override any external handlers specified in
# the url-handlers section.
#
# Note that HTTP and HTTPS are treated as separate protocols here.
[subscriptions]
# For tracking feeds and pages
# Whether a pop-up appears when viewing a potential feed
popup = true
# How often to check for updates to subscriptions in the background, in seconds.
# Set it to 0 to disable this feature. You can still update individual feeds
# manually, or restart the browser.
#
# Note Amfora will check for updates on browser start no matter what this setting is.
update_interval = 1800 # 30 mins
# How many subscriptions can be checked at the same time when updating.
# If you have many subscriptions you may want to increase this for faster
# update times. Any value below 1 will be corrected to 1.
workers = 3
# The number of subscription updates displayed per page.
entries_per_page = 20
[theme]
# This section is for changing the COLORS used in Amfora.
# These colors only apply if 'color' is enabled above.
# Colors can be set using a W3C color name, or a hex value such as "#ffffff".
# Note that not all colors will work on terminals that do not have truecolor support.
# If you want to stick to the standard 16 or 256 colors, you can get
# a list of those here: https://jonasjacek.github.io/colors/
# DO NOT use the names from that site, just the hex codes.
# Definitions:
# bg = background
# fg = foreground
# dl = download
# btn = button
# hdg = heading
# bkmk = bookmark
# modal = a popup window/box in the middle of the screen
# EXAMPLES:
# hdg_1 = "green"
# hdg_2 = "#5f0000"
# Available keys to set:
# bg: background for pages, tab row, app in general
# tab_num: The number/highlight of the tabs at the top
# tab_divider: The color of the divider character between tab numbers: |
# bottombar_label: The color of the prompt that appears when you press space
# bottombar_text: The color of the text you type
# bottombar_bg
# hdg_1
# hdg_2
# hdg_3
# amfora_link: A link that Amfora supports viewing. For now this is only gemini://
# foreign_link: HTTP(S), Gopher, etc
# link_number: The silver number that appears to the left of a link
# regular_text: Normal gemini text, and plaintext documents
# quote_text
# preformatted_text
# list_text
# btn_bg: The bg color for all modal buttons
# btn_text: The text color for all modal buttons
# dl_choice_modal_bg
# dl_choice_modal_text
# dl_modal_bg
# dl_modal_text
# info_modal_bg
# info_modal_text
# error_modal_bg
# error_modal_text
# yesno_modal_bg
# yesno_modal_text
# tofu_modal_bg
# tofu_modal_text
# subscription_modal_bg
# subscription_modal_text
# input_modal_bg
# input_modal_text
# input_modal_field_bg: The bg of the input field, where you type the text
# input_modal_field_text: The color of the text you type
# bkmk_modal_bg
# bkmk_modal_text
# bkmk_modal_label
# bkmk_modal_field_bg
# bkmk_modal_field_text
{% if theme == 'nord' %}
bg = "{{ background }}"
fg = "{{ foreground }}"
tab_num = "{{ cyan }}"
tab_divider = "{{ grey3 }}"
bottombar_label = "{{ cyan }}"
bottombar_text = "{{ foreground }}"
bottombar_bg = "{{ grey1 }}"
hdg_1 = "{{ dark_blue }}"
hdg_2 = "{{ blue }}"
hdg_3 = "{{ yellow }}"
amfora_link = "{{ cyan }}"
foreign_link = "{{ purple }}"
link_number = "{{ green }}"
regular_text = "{{ foreground }}"
quote_text = "{{ blue }}"
preformatted_text = "{{ teal }}"
list_text = "{{ foreground }}"
btn_bg = "{{ grey3 }}"
btn_text = "{{ foreground }}"
dl_choice_modal_bg = "{{ grey1 }}"
dl_choice_modal_text = "{{ foreground }}"
dl_modal_bg = "{{ grey1 }}"
dl_modal_text = "{{ foreground }}"
info_modal_bg = "{{ grey1 }}"
info_modal_text = "{{ foreground }}"
error_modal_bg = "{{ red }}"
error_modal_text = "{{ foreground }}"
yesno_modal_bg = "{{ grey1 }}"
yesno_modal_text = "{{ foreground }}"
tofu_modal_bg = "{{ grey1 }}"
tofu_modal_text = "{{ foreground }}"
subscription_modal_bg = "{{ grey1 }}"
subscription_modal_text = "{{ foreground }}"
input_modal_bg = "{{ grey1 }}"
input_modal_text = "{{ foreground }}"
input_modal_field_bg = "{{ grey3 }}"
input_modal_field_text = "{{ foreground }}"
bkmk_modal_bg = "{{ grey1 }}"
bkmk_modal_text = "{{ foreground }}"
bkmk_modal_label = "{{ foreground }}"
bkmk_modal_field_bg = "{{ grey3 }}"
bkmk_modal_field_text = "{{ foreground }}"
{% elif theme == 'onedark' %}
bg = "{{ background }}"
fg = "{{ foreground }}"
tab_num = "{{ foreground }}"
tab_divider = "{{ foreground }}"
bottombar_bg = "{{ foreground }}"
bottombar_text = "{{ background }}"
bottombar_label = "{{ background }}"
hdg_1 = "{{ red }}"
hdg_2 = "{{ orange }}"
hdg_3 = "{{ purple }}"
amfora_link = "{{ blue }}"
foreign_link = "{{ cyan }}"
link_number = "{{ foreground }}"
regular_text = "{{ foreground }}"
quote_text = "{{ green }}"
preformatted_text = "{{ yellow }}"
list_text = "{{ foreground }}"
btn_bg = "{{ background }}"
btn_text = "{{ foreground }}"
dl_choice_modal_bg = "{{ green }}"
dl_choice_modal_text = "{{ background }}"
dl_modal_bg = "{{ green }}"
dl_modal_text = "{{ background }}"
info_modal_bg = "{{ green }}"
info_modal_text = "{{ background }}"
error_modal_bg = "{{ red }}"
error_modal_text = "{{ background }}"
yesno_modal_bg = "{{ yellow }}"
yesno_modal_text = "{{ background }}"
tofu_modal_bg = "{{ yellow }}"
tofu_modal_text = "{{ background }}"
input_modal_bg = "{{ green }}"
input_modal_text = "{{ background }}"
input_modal_field_bg = "{{ background }}"
input_modal_field_text = "{{ foreground }}"
bkmk_modal_bg = "{{ green }}"
bkmk_modal_text = "{{ background }}"
bkmk_modal_label = "{{ background }}"
bkmk_modal_field_bg = "{{ background }}"
bkmk_modal_field_text = "{{ foreground }}"
subscription_modal_bg = "{{ purple }}"
subscription_modal_text = "{{ background }}"
{% endif %}

83
roles/bash/files/bashrc Normal file
View File

@ -0,0 +1,83 @@
#!/usr/bin/env bash
export BASH_COMPLETION_USER_DIR="$HOME/.local/share/bash"
export HISTFILE="$BASH_COMPLETION_USER_DIR/bash_history"
# ________ _______________
# __ ___/______ /__ /___(_)_____________ ________
# _____ \_ _ \ __/ __/_ /__ __ \_ __ `/_ ___/
# ____/ // __/ /_ / /_ _ / _ / / / /_/ /_(__ )
# /____/ \___/\__/ \__/ /_/ /_/ /_/_\__, / /____/
# /____/
# vi mode
set -o vi
# ignore upper and lowercase when TAB completion
bind "set completion-ignore-case on"
# Shell options
shopt -s autocd
shopt -s cdspell
shopt -s cmdhist
shopt -s dotglob
shopt -s checkwinsize
shopt -s expand_aliases
shopt -s histappend
# ________ _____
# ___ __ \___________________ _____________ /_
# __ /_/ /_ ___/ __ \_ __ `__ \__ __ \ __/
# _ ____/_ / / /_/ / / / / / /_ /_/ / /_
# /_/ /_/ \____//_/ /_/ /_/_ .___/\__/
# /_/
#
# get current branch in git repo
parse_git_branch() {
BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ ! "${BRANCH}" = "" ]
then
STAT=$(parse_git_dirty)
echo "${BRANCH}${STAT}"
else
echo ""
fi
}
# get current status of git repo
parse_git_dirty() {
status=$(git status 2>&1 | tee)
dirty=$(echo -n "${status}" 2> /dev/null | grep "modified:" &> /dev/null; echo "$?")
untracked=$(echo -n "${status}" 2> /dev/null | grep "Untracked files" &> /dev/null; echo "$?")
ahead=$(echo -n "${status}" 2> /dev/null | grep "Your branch is ahead of" &> /dev/null; echo "$?")
newfile=$(echo -n "${status}" 2> /dev/null | grep "new file:" &> /dev/null; echo "$?")
renamed=$(echo -n "${status}" 2> /dev/null | grep "renamed:" &> /dev/null; echo "$?")
deleted=$(echo -n "${status}" 2> /dev/null | grep "deleted:" &> /dev/null; echo "$?")
bits=''
if [ "${ahead}" = "0" ]; then
bits="*${bits}"
fi
if [ "${renamed}" = "0" ]; then
bits=">${bits}"
fi
if [ "${newfile}" = "0" ]; then
bits="+${bits}"
fi
if [ "${untracked}" = "0" ]; then
bits="?${bits}"
fi
if [ "${deleted}" = "0" ]; then
bits="x${bits}"
fi
if [ "${dirty}" = "0" ]; then
bits="!${bits}"
fi
if [ ! "${bits}" = "" ]; then
echo " ${bits}"
else
echo ""
fi
}
# Prompt
export PS1="\033[1;31m╭─[\033[1;33m\u\033[1;32m@\033[1;34m\h \$(if [[ \$? == 0 ]]; then echo \"\033[1;32m\342\234\223\"; else echo \"\033[1;31m\342\234\227\"; fi)\033[1;31m] \033[1;35m\w \033[1;32m\`parse_git_branch\`\n\033[1;31m╰\033[0m "
export PS2="\[\033[1;31m\]>\033[0m "

View File

@ -0,0 +1,6 @@
---
- name: Copy config
copy:
src: bashrc
dest: ~/.bashrc
force: yes

11
roles/foot/tasks/main.yml Normal file
View File

@ -0,0 +1,11 @@
---
- name: Create config directory
file:
path: ~/.config/foot
state: directory
- name: Copy config
template:
src: foot.j2
dest: ~/.config/foot/foot.ini
force: yes

View File

@ -0,0 +1,154 @@
# -*- conf -*-
# shell=$SHELL (if set, otherwise user's default shell from /etc/passwd)
# term=foot (or xterm-256color if built with -Dterminfo=disabled)
# login-shell=no
font={{ term_font }}:style=Regular:size={{ font_size }}, {{ cjk_font }}:style=Regular:size={{ font_size }}
font-bold={{ term_font }}:style=Bold:size={{ font_size }}, {{ cjk_font }}:style=Bold:size={{ font_size }}
font-italic={{ term_font }}:style=Italic:size={{ font_size }}, {{ cjk_font }}:style=Italic:size={{ font_size }}
font-bold-italic={{ term_font }}:style=Bold Italic:size={{ font_size }}, {{ cjk_font }}:style=Bold Italic:size={{ font_size }}
# line-height=<font metrics>
# letter-spacing=0
# horizontal-letter-offset=0
# vertical-letter-offset=0
# underline-offset=<font metrics>
# box-drawings-uses-font-glyphs=no
dpi-aware=no
initial-window-size-pixels=800x600 # Or,
# initial-window-size-chars=<COLSxROWS>
# initial-window-mode=windowed
# pad=2x2 # optionally append 'center'
# resize-delay-ms=100
# notify=notify-send -a foot -i foot ${title} ${body}
# bold-text-in-bright=no
# bell=none
# word-delimiters=,│`|:"'()[]{}<>
# selection-target=primary
# workers=<number of logical CPUs>
[bell]
# urgent=no
# notify=no
# command=
# command-focused=no
[scrollback]
lines=10000
# multiplier=3.0
# indicator-position=relative
# indicator-format=
[url]
# launch=xdg-open ${url}
# label-letters=sadfjklewcmpgh
# osc8-underline=url-mode
# protocols = http, https, ftp, ftps, file, gemini, gopher
[cursor]
# style=block
color={{ background | regex_replace('^#', '') }} {{ foreground | regex_replace('^#', '') }}
# blink=no
beam-thickness=1.0
# underline-thickness=<font underline thickness>
[mouse]
hide-when-typing=yes
# alternate-scroll-mode=yes
[colors]
alpha=1.0
foreground={{ foreground | regex_replace('^#', '') }}
background={{ background | regex_replace('^#', '') }}
regular0={{ color0 | regex_replace('^#', '') }}
regular1={{ color1 | regex_replace('^#', '') }}
regular2={{ color2 | regex_replace('^#', '') }}
regular3={{ color3 | regex_replace('^#', '') }}
regular4={{ color4 | regex_replace('^#', '') }}
regular5={{ color5 | regex_replace('^#', '') }}
regular6={{ color6 | regex_replace('^#', '') }}
regular7={{ color7 | regex_replace('^#', '') }}
bright0={{ color8 | regex_replace('^#', '') }}
bright1={{ color9 | regex_replace('^#', '') }}
bright2={{ color10 | regex_replace('^#', '') }}
bright3={{ color11 | regex_replace('^#', '') }}
bright4={{ color12 | regex_replace('^#', '') }}
bright5={{ color13 | regex_replace('^#', '') }}
bright6={{ color14 | regex_replace('^#', '') }}
bright7={{ color15 | regex_replace('^#', '') }}
# selection-foreground=<inverse foreground/background>
# selection-background=<inverse foreground/background>
# jump-labels=<regular0> <regular3>
# urls=<regular3>
[csd]
# preferred=server
# size=26
# color=<foreground color>
# button-width=26
# button-color=<background color>
# button-minimize-color=<regular4>
# button-maximize-color=<regular2>
# button-close-color=<regular1>
[key-bindings]
# scrollback-up-page=Shift+Page_Up
# scrollback-up-half-page=none
# scrollback-up-line=none
# scrollback-down-page=Shift+Page_Down
# scrollback-down-half-page=none
# scrollback-down-line=none
# clipboard-copy=Control+Shift+C
# clipboard-paste=Control+Shift+V
# primary-paste=Shift+Insert
# search-start=Control+Shift+R
# font-increase=Control+plus Control+equal Control+KP_Add
# font-decrease=Control+minus Control+KP_Subtract
# font-reset=Control+0 Control+KP_0
# spawn-terminal=Control+Shift+N
# minimize=none
# maximize=none
fullscreen=F11
pipe-visible=[sh -c "xurls | wofi -d -i | xargs -r {{ default_browser }}"] none
pipe-scrollback=[sh -c "xurls | wofi -d -i | xargs -r {{ default_browser }}"] none
pipe-selected=[xargs -r {{ default_browser }}] none
# show-urls-launch=Control+Shift+u
# show-urls-copy=none
[search-bindings]
# cancel=Control+g Escape
# commit=Return
# find-prev=Control+r
# find-next=Control+s
cursor-left=Left Shift+h
cursor-left-word=Control+Left Control+Shift+h
cursor-right=Right Shift+l
cursor-right-word=Control+Right Control+Shift+l
# cursor-home=Home Control+a
# cursor-end=End Control+e
# delete-prev=BackSpace
delete-prev-word=Control+BackSpace
# delete-next=Delete
delete-next-word=Control+Delete
# extend-to-word-boundary=Control+w
# extend-to-next-whitespace=Control+Shift+W
# clipboard-paste=Control+v Control+y
# primary-paste=Shift+Insert
[url-bindings]
# cancel=Control+g Control+d Escape
# toggle-url-visible=t
[mouse-bindings]
# primary-paste=BTN_MIDDLE
# select-begin=BTN_LEFT
# select-begin-block=Control+BTN_LEFT
# select-extend=BTN_RIGHT
# select-extend-character-wise=Control+BTN_RIGHT
# select-word=BTN_LEFT-2
# select-word-whitespace=Control+BTN_LEFT-2
# select-row=BTN_LEFT-3

View File

@ -4,7 +4,7 @@
msg: Theme needs to be 'nord' or 'onedark'
when: theme != 'nord' and theme != 'onedark'
- name: Create color variables
- name: Generate color variables
template:
src: palette.j2
dest: '{{ ansible_env.PWD }}/palette.yml'