From 7262357500aa4d4655d4df90e2bea7d9f9562b34 Mon Sep 17 00:00:00 2001 From: DarkXero-dev Date: Fri, 26 Jul 2024 21:16:29 +0300 Subject: [PATCH] OMP update (From source) --- .../Home/.config/ohmyposh/easy-term.omp.json | 156 ------------------ .../ohmyposh/tokyonight_storm.omp.json | 152 +++++++++++++++++ install.sh | 56 +++++-- 3 files changed, 195 insertions(+), 169 deletions(-) delete mode 100644 Configs/Home/.config/ohmyposh/easy-term.omp.json create mode 100644 Configs/Home/.config/ohmyposh/tokyonight_storm.omp.json diff --git a/Configs/Home/.config/ohmyposh/easy-term.omp.json b/Configs/Home/.config/ohmyposh/easy-term.omp.json deleted file mode 100644 index af025e5..0000000 --- a/Configs/Home/.config/ohmyposh/easy-term.omp.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", - "blocks": [ - { - "alignment": "left", - "newline": true, - "segments": [ - { - "background": "#0c7bbb", - "foreground": "#ffffff", - "leading_diamond": "\u256d\u2500\ue0b2", - "properties": { - "alpine": "\uf300", - "arch": "\uf303", - "centos": "\uf304", - "debian": "\uf306", - "elementary": "\uf309", - "fedora": "\uf30a", - "gentoo": "\uf30d", - "linux": "\ue712", - "macos": "\ue711", - "manjaro": "\uf312", - "mint": "\uf30f", - "opensuse": "\uf314", - "raspbian": "\uf315", - "ubuntu": "\uf31c", - "windows": "\ue70f" - }, - "style": "diamond", - "template": " {{ if .WSL }}\ue712 on {{ end }}{{ .Icon }} ", - "type": "os" - }, - { - "background": "#DA627D", - "foreground": "#ffffff", - "powerline_symbol": "\ue0b0", - "style": "diamond", - "template": " 🏠 ", - "type": "text" - }, - { - "background": "#8a62da", - "foreground": "#ffffff", - "powerline_symbol": "\ue0b0", - "properties": { - "style": "folder" - }, - "style": "powerline", - "template": " {{ .Path }} ", - "type": "path" - }, - { - "background": "#191f48", - "foreground": "#43CCEA", - "style": "powerline", - "powerline_symbol": "\ue0b0", - "foreground_templates": [ - "{{ if or (.Working.Changed) (.Staging.Changed) }}#FF9248{{ end }}", - "{{ if and (gt .Ahead 0) (gt .Behind 0) }}#ff4500{{ end }}", - "{{ if gt .Ahead 0 }}#B388FF{{ end }}", - "{{ if gt .Behind 0 }}#B388FF{{ end }}" - ], - "properties": { - "branch_max_length": 25, - "fetch_stash_count": true, - "fetch_status": true, - "fetch_upstream_icon": true - }, - "template": " {{ .UpstreamIcon }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} \uf044 {{ .Working.String }}{{ end }}{{ if and (.Working.Changed) (.Staging.Changed) }} |{{ end }}{{ if .Staging.Changed }} \uf046 {{ .Staging.String }}{{ end }}{{ if gt .StashCount 0 }} \ueb4b {{ .StashCount }}{{ end }} ", - "trailing_diamond": "\ue0b4", - "type": "git" - } - ], - "type": "prompt" - }, - { - "alignment": "right", - "segments": [ - { - "foreground": "#81ff91", - "style": "diamond", - "template": "<#cc7eda> \u007C <#7eb8da>RAM: {{ (div ((sub .PhysicalTotalMemory .PhysicalFreeMemory)|float64) 1073741824.0) }}/{{ (div .PhysicalTotalMemory 1073741824.0) }}GB", - "type": "sysinfo" - }, - { - "foreground": "#81ff91", - "properties": { - "fetch_version": true - }, - "style": "powerline", - "template": "<#cc7eda> \u007C <#7eb8da>\ue718 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }}", - "type": "node" - }, - { - "type": "php", - "style": "powerline", - "foreground": "#81ff91", - "template": "<#cc7eda> \u007C <#7eb8da>\ue73d {{ .Full }}" - }, - { - "type": "npm", - "style": "powerline", - "foreground": "#81ff91", - "template": "<#cc7eda> \u007C <#7eb8da>\ue71e {{ .Full }}" - }, - { - "type": "sysinfo", - "style": "powerline", - "foreground": "#81ff91", - "template": "<> " - }, - { - "background": "#cecece", - "foreground": "#4b4b4b", - "leading_diamond": "\ue0b2", - "trailing_diamond": "\ue0b0", - "properties": { - "style": "austin", - "threshold": 150 - }, - "style": "diamond", - "template": "⌛ {{ .FormattedMs }} ", - "type": "executiontime" - }, - { - "background": "#cecece", - "foreground": "#4b4b4b", - "leading_diamond": "\ue0b2", - "properties": { - "time_format": "15:04:05" - }, - "style": "diamond", - "template": "⏰ {{ .CurrentDate | date .Format }} ", - "trailing_diamond": "\ue0b0", - "type": "time" - } - ], - "type": "prompt" - }, - { - "alignment": "left", - "newline": true, - "segments": [ - { - "foreground": "#0c7bbb", - "style": "plain", - "template": "\u2570\u2500", - "type": "text" - } - ], - "type": "prompt" - } - ], - "final_space": true, - "version": 2 -} diff --git a/Configs/Home/.config/ohmyposh/tokyonight_storm.omp.json b/Configs/Home/.config/ohmyposh/tokyonight_storm.omp.json new file mode 100644 index 0000000..228c791 --- /dev/null +++ b/Configs/Home/.config/ohmyposh/tokyonight_storm.omp.json @@ -0,0 +1,152 @@ +{ + "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json", + "console_title_template": " {{ .Folder }} :: {{if .Root}}Admin{{end}}", + "palette": { + "main-bg": "#24283b", + "terminal-red": "#f7768e", + "pistachio-green": "#9ece6a", + "terminal-green": "#73daca", + "terminal-yellow": "#e0af68", + "terminal-blue": "#7aa2f7", + "celeste-blue": "#b4f9f8", + "light-sky-blue": "#7dcfff", + "terminal-white": "#c0caf5", + "white-blue": "#a9b1d6", + "blue-bell": "#9aa5ce", + "pastal-grey": "#cfc9c2", + "terminal-magenta": "#bb9af7", + "blue-black": "#565f89", + "terminal-black": "#414868", + "t-background": "p:main-bg" + }, + "blocks": [ + { + "alignment": "left", + "segments": [ + { + "type": "text", + "style": "plain", + "background": "transparent", + "foreground": "p:terminal-blue", + "template": "\u279c " + }, + { + "type": "path", + "style": "plain", + "foreground": "p:terminal-magenta", + "properties": { + "style": "folder" + }, + "template": "{{ .Path }} \u26a1" + }, + { + "type": "git", + "style": "plain", + "foreground": "p:light-sky-blue", + "foreground_templates": [ + "{{ if or (.Working.Changed) (.Staging.Changed) }}p:terminal-red{{ end }}", + "{{ if and (gt .Ahead 0) (gt .Behind 0)}}p:light-sky-blue {{ end }}", + "{{ if gt .Ahead 0 }}p:terminal-blue{{ end }}", + "{{ if gt .Behind 0 }}p:celeste-blue{{ end }}" + ], + "auto_upgrade": { + "type": "boolean", + "title": "Enable automatic upgrades for Oh My Posh (supports Windows/macOS only)", + "description": "https://ohmyposh.dev/docs/configuration/general#general-settings", + "default": false + }, + "template": "({{ .HEAD}})", + "properties": { + "fetch_status": true, + "branch_icon": "\ue725 " + } + }, + { + "type": "status", + "style": "plain", + "foreground": "p:terminal-red", + "template": " \uf00d" + } + ], + "type": "prompt" + }, + { + "alignment": "right", + "overflow": "hide", + "segments": [ + { + "type": "node", + "style": "plain", + "foreground": "p:pistachio-green", + "template": "\ue718 {{ .Full }} " + }, + { + "type": "php", + "style": "plain", + "foreground": "p:terminal-blue", + "template": "\ue73d {{ .Full }} " + }, + { + "type": "python", + "style": "plain", + "foreground": "p:terminal-yellow", + "template": "\uE235 {{ .Full }}" + }, + { + "type": "julia", + "style": "plain", + "foreground": "p:terminal-magenta", + "template": "\uE624 {{ .Full }}" + }, + { + "type": "ruby", + "style": "plain", + "foreground": "p:terminal-red", + "template": "\uE791 {{ .Full}}" + }, + { + "type": "go", + "style": "plain", + "foreground": "p:light-sky-blue", + "template": "\uFCD1 {{ .Full}}" + }, + { + "type": "command", + "style": "plain", + "foreground": "p:white-blue", + "properties": { + "command": "git log --pretty=format:%cr -1 || date +%H:%M:%S", + "shell": "bash" + } + } + ], + "type": "prompt" + }, + { + "alignment": "left", + "newline": true, + "segments": [ + { + "foreground": "p:pistachio-green", + "style": "plain", + "template": "\u25b6", + "type": "text" + } + ], + "type": "prompt" + } + ], + "secondary_prompt": { + "background": "transparent", + "foreground": "p:terminal-blue", + "template": "\u279c " + }, + "transient_prompt": { + "background": "p:t-background", + "foreground": "p:terminal-blue", + "template": "\u279c " + }, + "final_space": true, + "version": 2, + "terminal_background": "p:t-background" +} diff --git a/install.sh b/install.sh index fd52c96..9f5333e 100755 --- a/install.sh +++ b/install.sh @@ -24,7 +24,7 @@ else exit 1 fi # Install packages using the detected AUR helper -$aur_helper -S --noconfirm --needed ttf-meslo-nerd-font-powerlevel10k oh-my-posh-bin +$aur_helper -S --noconfirm --needed ttf-meslo-nerd-font-powerlevel10k sleep 2 echo echo "Creating Backup & Applying new Rice, hold on..." @@ -75,19 +75,49 @@ case "$response" in esac sleep 2 echo -echo "Applying OhMy-Posh to Bash" +echo "Oh-My-Posh Setup." echo -# Check if the folder exists, if not create it and download the file -if [ ! -d "$HOME/.config/ohmyposh" ]; then - mkdir -p "$HOME/.config/ohmyposh" -fi -curl -o "$HOME/.config/ohmyposh/tokyonight_storm.omp.json" https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/tokyonight_storm.omp.json -sleep 2 -# Check if the line exists in ~/.bashrc, if not add it -if ! grep -Fxq 'eval "$(oh-my-posh init bash --config $HOME/.config/ohmyposh/tokyonight_storm.omp.json)"' "$HOME/.bashrc"; then - echo '' >> "$HOME/.bashrc" - echo 'eval "$(oh-my-posh init bash --config $HOME/.config/ohmyposh/tokyonight_storm.omp.json)"' >> "$HOME/.bashrc" -fi +echo "Installing Oh-My-Posh" +curl -s https://ohmyposh.dev/install.sh | bash -s +echo +sleep 3 +echo "Injecting OMP to .bashrc" + +# Define the lines to be added +line1='# Oh-My-Posh' +line2='PATH="$HOME/.local/bin:$PATH"' +line3='# Oh-My-Posh Config' +line4='eval "$(oh-my-posh init bash --config $HOME/.config/ohmyposh/tokyonight_storm.omp.json)"' + +# Define the .bashrc file +bashrc_file="$HOME/.bashrc" + +# Function to add lines if not already present +add_lines() { + if ! grep -qxF "$line1" "$bashrc_file"; then + echo "" >> "$bashrc_file" # Add an empty line before line1 + echo "$line1" >> "$bashrc_file" + fi + + if ! grep -qxF "$line2" "$bashrc_file"; then + echo "$line2" >> "$bashrc_file" + echo "" >> "$bashrc_file" # Add an empty line after line2 + fi + + if ! grep -qxF "$line3" "$bashrc_file"; then + echo "$line3" >> "$bashrc_file" + fi + + if ! grep -qxF "$line4" "$bashrc_file"; then + echo "$line4" >> "$bashrc_file" + fi +} + +# Run the function to add lines +add_lines + +echo "Oh-My-Posh injection complete." +sleep 3 echo echo "Applying Grub Theme...." echo "#######################"