diff --git a/roles/bash/files/.bashrc b/roles/bash/files/.bashrc index 04e2def3..ca28664b 100644 --- a/roles/bash/files/.bashrc +++ b/roles/bash/files/.bashrc @@ -158,10 +158,8 @@ for file in $HOME/.config/bash/*.sh; do source "$file" done -if [[ -f "$HOME/.bash_lumen" ]]; then - source "$HOME/.bash_lumen" -fi - +[ -f ~/.bash_lumen] && source ~/.bash_lumen +[ -f ~/.fzf.bash ] && source ~/.fzf.bash toilet "TechDufus" -F border:gay -f emboss2 diff --git a/roles/bash/files/bash/k8s_functions.sh b/roles/bash/files/bash/k8s_functions.sh index d1270262..9c2b9a0d 100644 --- a/roles/bash/files/bash/k8s_functions.sh +++ b/roles/bash/files/bash/k8s_functions.sh @@ -67,6 +67,21 @@ function k.node.debug() { kubectl debug node/$1 -qit --image=mcr.microsoft.com/dotnet/runtime-deps:6.0 --target $1 -- chroot /host bash } +function k.togglePromptInfo() { + # create export if not exists + if [ -z "$SHOW_K8S_PROMPT_INFO" ]; then + export SHOW_K8S_PROMPT_INFO="false" + return + elif [ "$SHOW_K8S_PROMPT_INFO" == "true" ]; then + export SHOW_K8S_PROMPT_INFO="false" + return + elif [ "$SHOW_K8S_PROMPT_INFO" == "false" ]; then + export SHOW_K8S_PROMPT_INFO="true" + return + fi +} + + complete -o nospace -F __kc_complete kc complete -o nospace -F __kgnonly_complete k.node.debug k.node.exec diff --git a/roles/bash/files/bash/vars.sh b/roles/bash/files/bash/vars.sh index c41d31dc..3379eeed 100644 --- a/roles/bash/files/bash/vars.sh +++ b/roles/bash/files/bash/vars.sh @@ -19,5 +19,3 @@ BOOK="${RED}\xF0\x9F\x93\x8B${NC}" HOT="${ORANGE}\xF0\x9F\x94\xA5${NC}" WARNING="${RED}\xF0\x9F\x9A\xA8${NC}" RIGHT_ANGLE="${GREEN}\xE2\x88\x9F${NC}" - - diff --git a/roles/bash/files/themes/axin/axin.theme.sh b/roles/bash/files/themes/axin/axin.theme.sh index 2bfe6b07..99abbeb4 100644 --- a/roles/bash/files/themes/axin/axin.theme.sh +++ b/roles/bash/files/themes/axin/axin.theme.sh @@ -33,7 +33,23 @@ else RESET="\033[m" fi +function k.togglePromptInfo() { + if [ "$SHOW_K8S_PROMPT_INFO" == "true" ]; then + echo -e "${ARROW} ${YELLOW}SHOW_K8S_PROMPT_INFO is set to true, setting to false${NC}" + export SHOW_K8S_PROMPT_INFO="false" + return + elif [ "$SHOW_K8S_PROMPT_INFO" == "false" ]; then + echo -e "${ARROW} ${YELLOW}SHOW_K8S_PROMPT_INFO is set to false, setting to true${NC}" + export SHOW_K8S_PROMPT_INFO="true" + return + fi +} + function k8s_info() { + # Only show k8s info in prompt if it is enabled + if [[ "$SHOW_K8S_PROMPT_INFO" == "false" ]]; then + return + fi local k8s_data="$(kubectl config view --minify --output 'jsonpath={..namespace}@{.current-context}' 2> /dev/null)" if [[ "$k8s_data" != "" ]]; then echo "[$k8s_data]" diff --git a/roles/bash/tasks/ubuntu.yml b/roles/bash/tasks/ubuntu.yml index 1b8c0429..3b2af48e 100644 --- a/roles/bash/tasks/ubuntu.yml +++ b/roles/bash/tasks/ubuntu.yml @@ -76,12 +76,3 @@ create: true mode: "0600" state: present - -- name: Bash | Install profile dependencies - ansible.builtin.apt: - name: "{{ item }}" - state: present - update_cache: true - become: true - loop: - - fzf diff --git a/roles/fzf/handlers/main.yml b/roles/fzf/handlers/main.yml new file mode 100644 index 00000000..b8bb494e --- /dev/null +++ b/roles/fzf/handlers/main.yml @@ -0,0 +1,12 @@ +--- +- name: Cleanup fzf downloaded tar + ansible.builtin.file: + path: "/tmp/{{ fzf_file }}.tar.gz" + state: absent + become: true + +- name: Remove extracted fzf directory + ansible.builtin.file: + path: /tmp/fzf + state: absent + become: true diff --git a/roles/fzf/tasks/main.yml b/roles/fzf/tasks/main.yml new file mode 100644 index 00000000..45778ae9 --- /dev/null +++ b/roles/fzf/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- name: Run Ubuntu Tasks + ansible.builtin.import_tasks: ubuntu.yml + when: ansible_os_family == 'Debian' diff --git a/roles/fzf/tasks/ubuntu.yml b/roles/fzf/tasks/ubuntu.yml new file mode 100644 index 00000000..90a8c224 --- /dev/null +++ b/roles/fzf/tasks/ubuntu.yml @@ -0,0 +1,109 @@ +--- +# - name: "FZF | Download Latest Version JSON" +# ansible.builtin.uri: +# url: https://api.github.com/repos/junegunn/fzf/releases/latest +# register: fzf_latest_version_json +# changed_when: false +# +# - name: "FZF | Registering fzf Latest Release" +# ansible.builtin.set_fact: +# fzf_latest_release: "{{ fzf_latest_version_json.json.tag_name }}" +# +# - name: "FZF | Registering fzf Latest Version" +# ansible.builtin.set_fact: +# fzf_latest_version: "{{ fzf_latest_release.stdout | default('') }}" +# +# - name: "FZF | Getting version information" +# ansible.builtin.shell: +# cmd: | +# /usr/local/bin/fzf version -s | grep -o 'v[0-9]*\.[0-9]*\.[0-9]*' +# register: current_fzf_version +# changed_when: false +# failed_when: false +# +# - name: "FZF | Show current_fzf_version debug" +# ansible.builtin.debug: +# var: current_fzf_version.stdout +# +# - name: "FZF | Show fzf_latest_release debug" +# ansible.builtin.debug: +# var: fzf_latest_release +# +# - name: "FZF | Install" +# when: fzf_latest_release not in current_fzf_version.stdout|default('') +# block: +# - name: "FZF | Define fzfarch" +# ansible.builtin.set_fact: +# fzfarch: "{{ ansible_machine | replace('x86_64', 'amd64') | replace('aarch64', 'arm64') }}" +# +# - name: "FZF | Define fzfos" +# ansible.builtin.set_fact: +# fzfos: "{{ ansible_system | lower }}" +# +# - name: "FZF | Debug fzfarch" +# ansible.builtin.debug: +# var: fzfarch +# +# - name: "FZF | Debug fzfos" +# ansible.builtin.debug: +# var: fzfos +# +# - name: "FZF | Define fzf_file" +# ansible.builtin.set_fact: +# fzf_file: "fzf-{{ fzf_latest_release }}-{{ fzfos }}_{{ fzfarch }}" +# +# - name: "FZF | Ensure clean download destination" +# ansible.builtin.file: +# path: "/tmp/{{ fzf_file }}.tar.gz" +# state: absent +# become: true +# +# - name: "FZF | Downloading fzf Release" +# ansible.builtin.get_url: +# url: "https://github.com/junegunn/fzf/releases/download/{{ fzf_latest_release }}/{{ fzf_file }}.tar.gz" +# dest: /tmp/ +# mode: "0644" +# force: true +# notify: +# - Cleanup fzf downloaded tar +# +# - name: "FZF | Ensure clean extraction destination" +# ansible.builtin.file: +# path: "/tmp/fzf" +# state: absent +# become: true +# +# - name: "FZF | Extract fzf tar file" +# ansible.builtin.unarchive: +# src: "/tmp/{{ fzf_file }}.tar.gz" +# dest: /tmp +# +# - name: "FZF | Remove any current fzf installations" +# ansible.builtin.file: +# path: /usr/local/bin/fzf +# state: absent +# become: true +# +# - name: "FZF | Install fzf" +# ansible.builtin.copy: +# remote_src: true +# src: /tmp/fzf +# dest: /usr/local/bin/ +# owner: "{{ host_user }}" +# group: "{{ host_user }}" +# force: true +# mode: "0755" +# become: true +# notify: +# - Remove extracted fzf directory + +- name: "FZF | Clone Latest Version" + ansible.builtin.git: + repo: https://github.com/junegunn/fzf.git + depth: 1 + dest: "{{ ansible_user_dir }}/.fzf" + register: fzf_git_clone + +- name: "FZF | Install" + when: fzf_git_clone.changed + shell: "{{ ansible_user_dir }}/.fzf/install --all --no-update-rc --no-zsh --no-fish" diff --git a/roles/system/tasks/ubuntu.yml b/roles/system/tasks/ubuntu.yml index 8f495e99..f836c2b7 100644 --- a/roles/system/tasks/ubuntu.yml +++ b/roles/system/tasks/ubuntu.yml @@ -3,6 +3,7 @@ ansible.builtin.apt: update_cache: true upgrade: "yes" + state: latest autoremove: true autoclean: true become: true diff --git a/roles/tmux/files/tmux/tmux.conf b/roles/tmux/files/tmux/tmux.conf index 16e37302..a835fe42 100644 --- a/roles/tmux/files/tmux/tmux.conf +++ b/roles/tmux/files/tmux/tmux.conf @@ -2,7 +2,7 @@ set-option -sa terminal-overrides ",xterm*:Tc" set -g default-terminal "screen-256color" set -g terminal-overrides ',xterm-256color:RGB' set -g mouse on -set -sg escape-time 50 +set -sg escape-time 0 set -g base-index 1 # Start indexing windows at 1 instead of 0 set -g pane-base-index 1 # Same for panes setw -g pane-base-index 1 # Same for panes @@ -39,9 +39,7 @@ set -g @plugin 'wfxr/tmux-fzf-url' set -g @plugin 'christoomey/vim-tmux-navigator' set -g @plugin 'catppuccin/tmux' set -g @plugin 'omerxx/tmux-sessionx' -# set -g @catppuccin_date_time "%Y-%m-%d %H:%M:%S CST" -# set -g @catppuccin_prepend 'TESTING' -# set -g @plugin 'olimorris/tmux-pomodoro-plus' +set -g @catppuccin_date_time "%H:%M:%S CST %m-%d-%Y" set -g @sessionx-bind 'o' set -g @continuum-restore 'on' @@ -62,7 +60,6 @@ set -g @catppuccin_status_right_separator_inverse "no" set -g @catppuccin_status_fill "icon" set -g @catppuccin_status_connect_separator "no" set -g @catppuccin_directory_text "#{pane_current_path}" -set -g @catppuccin_meetings_text "#($HOME/.config/tmux/scripts/cal.sh)" set -g @catppuccin_date_time_text "%H:%M" run -b '~/.tmux/plugins/tpm/tpm'