From 3c5375002bd51ec9ef692ad3117da7a550955bb6 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 19 Sep 2024 21:58:30 +0200 Subject: [PATCH] Configure `oh-my-posh` on Linux --- scripts/Arch/OS/install.fish | 3 +- scripts/Arch/Scripts/deploy.fish | 2 +- scripts/Arch/Software/Oh My Posh/main.fish | 20 +++++++++++++ scripts/Common/Software/Oh My Posh/main.fish | 31 ++++++++++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100755 scripts/Arch/Software/Oh My Posh/main.fish create mode 100644 scripts/Common/Software/Oh My Posh/main.fish diff --git a/scripts/Arch/OS/install.fish b/scripts/Arch/OS/install.fish index c46834c2..573da249 100755 --- a/scripts/Arch/OS/install.fish +++ b/scripts/Arch/OS/install.fish @@ -21,7 +21,8 @@ begin and yayinst \ linux-headers \ - pacman-contrib + pacman-contrib \ + yq end source "$dir/../../Common/OS/install.fish" diff --git a/scripts/Arch/Scripts/deploy.fish b/scripts/Arch/Scripts/deploy.fish index f1b7e909..9c9591b5 100644 --- a/scripts/Arch/Scripts/deploy.fish +++ b/scripts/Arch/Scripts/deploy.fish @@ -21,7 +21,6 @@ function deploySoftware -d "Deploys a the specified software action" -a action neofetch \ bash-completion \ wget \ - oh-my-posh-bin \ screen \ tmux \ htop \ @@ -37,6 +36,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action and source "$dir/../../Common/Software/bash/main.fish" $argv and source "$dir/../Software/sudo/main.fish" $argv + and source "$dir/../Software/Oh My Posh/main.fish" $argv and source "$dir/../Software/openssh/main.fish" $argv and source "$dir/../Software/vim/main.fish" $argv and source "$dir/../Software/git/main.fish" $argv diff --git a/scripts/Arch/Software/Oh My Posh/main.fish b/scripts/Arch/Software/Oh My Posh/main.fish new file mode 100755 index 00000000..f2a697ad --- /dev/null +++ b/scripts/Arch/Software/Oh My Posh/main.fish @@ -0,0 +1,20 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + set -l base "$dir/../../../Common/Software/Oh My Posh/main.fish" + source "$dir/../../Scripts/software.fish" + + function installSW + yayinst oh-my-posh-bin + end + + function configureSW -V base + fish "$base" configure + end + + function userConfig -S -V base -a name + fish "$base" userConfig $argv + end + + runInstaller $argv +end diff --git a/scripts/Common/Software/Oh My Posh/main.fish b/scripts/Common/Software/Oh My Posh/main.fish new file mode 100644 index 00000000..4ea03e7d --- /dev/null +++ b/scripts/Common/Software/Oh My Posh/main.fish @@ -0,0 +1,31 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + source "$dir/../../Scripts/software.fish" + + function configureSW -V dir + source "$dir/../bash/profile.fish" + source "$dir/../fish/profile.fish" + + begin + printf %s\n \ + 'set -x POSH_THEME $POSH_THEME' \ + "oh-my-posh init fish | source" \ + "oh-my-posh completion fish | source" + end | installFishProfile "oh-my-posh" + + begin + printf %s\n \ + 'eval "$(oh-my-posh init bash)"' \ + 'eval "$(oh-my-posh completion bash)"' + end | installBashProfile "oh-my-posh" + + sudo -HE pwsh "$dir/Manage.ps1" Configure + end + + function userConfig -S -V dir -a name + pwsh -CommandWithArgs '& $args[0] ConfigureUser @{ user=$args[1]; }' "$dir/Manage.ps1" $name + end + + runInstaller $argv +end