168 lines
4.5 KiB
Fish
Executable File
168 lines
4.5 KiB
Fish
Executable File
#
|
|
# ~/.config/fish/configs/arch_config.fish
|
|
#
|
|
|
|
source $HOME/.config/fish/configs/uni.fish
|
|
|
|
function get_pkg_version
|
|
set pkg $argv[1]
|
|
|
|
if pacman -Q $pkg >/dev/null 2>&1
|
|
pacman -Q $pkg
|
|
else
|
|
echo ""
|
|
end
|
|
end
|
|
|
|
function kernel_to_pkg
|
|
set kernel (uname -r)
|
|
|
|
if string match -q "*zen*" $kernel
|
|
echo linux-zen
|
|
else if string match -q "*lts*" $kernel
|
|
echo linux-lts
|
|
else if string match -q "*hardened*" $kernel
|
|
echo linux-hardened
|
|
else
|
|
echo linux
|
|
end
|
|
end
|
|
|
|
function updateall
|
|
######## Get current versions (if installed)
|
|
if command -q discord
|
|
set discord_version (get_pkg_version discord)
|
|
end
|
|
set kernel_version (get_pkg_version (kernel_to_pkg))
|
|
|
|
######## Run PACMAN updates
|
|
set_color cyan
|
|
echo "#### Updating pacman ####"
|
|
set_color normal
|
|
sudo pacman -Syu
|
|
|
|
######## Do additional Discord Updates
|
|
if command -q discord; and test "$discord_version" != "$(get_pkg_version discord)"
|
|
set_color cyan
|
|
echo "Discord version changed: $discord_version -> $(get_pkg_version discord)"
|
|
set_color normal
|
|
if test -e /usr/bin/curl
|
|
echo "Running Vencord installer..."
|
|
sh -c "$(curl -sS https://raw.githubusercontent.com/Vendicated/VencordInstaller/main/install.sh)"
|
|
else
|
|
echo "'curl' is not installed. Install it to update Discord plugins."
|
|
end
|
|
end
|
|
|
|
######## Run FLATPAK Updates
|
|
|
|
if test -e /usr/bin/flatpak
|
|
set_color cyan
|
|
echo "#### Updating flatpak ####"
|
|
set_color normal
|
|
flatpak update
|
|
end
|
|
|
|
######## Run GIT Updates
|
|
|
|
set_color cyan
|
|
echo "#### Updating quickshell ####"
|
|
set_color normal
|
|
if test -d ~/.config/quickshell && test -d ~/.config/quickshell/.git
|
|
pushd ~/.config/quickshell/
|
|
git pull
|
|
popd
|
|
end
|
|
|
|
set_color cyan
|
|
echo "#### Updating fish ####"
|
|
set_color normal
|
|
if test -d ~/.config/fish && test -d ~/.config/fish/.git
|
|
pushd ~/.config/fish/
|
|
git pull
|
|
popd
|
|
end
|
|
|
|
set_color cyan
|
|
echo "#### Updating hyprland ####"
|
|
set_color normal
|
|
if test -d ~/.config/hypr && test -d ~/.config/hypr/.git
|
|
pushd ~/.config/hypr/
|
|
git pull
|
|
popd
|
|
end
|
|
|
|
######## Run AUR Updates
|
|
|
|
set_color cyan
|
|
echo "#### Updating AUR ####"
|
|
set_color normal
|
|
if test -e /usr/bin/paru
|
|
paru -Sua --sudoloop
|
|
else if test -e /usr/bin/yay
|
|
yay -Sua --sudoloop
|
|
end
|
|
|
|
######## Restart if Kernel Updated
|
|
|
|
if test "$kernel_version" != "$(get_pkg_version $(kernel_to_pkg))"
|
|
set_color cyan
|
|
echo "Kernel changed: $kernel_version -> $(get_pkg_version $(kernel_to_pkg))"
|
|
read -P "Reboot now? [y/N]: " answer
|
|
set_color normal
|
|
|
|
if test "$answer" = "y" -o "$answer" = "Y"
|
|
reboot
|
|
else
|
|
echo "Skipping reboot."
|
|
end
|
|
end
|
|
end
|
|
|
|
alias fixpacman='sudo rm -f /var/lib/pacman/db.lck'
|
|
|
|
if test -e /usr/bin/expac
|
|
alias rip='expac --timefmt="%Y-%m-%d %T" "%l\t%n %v" | sort | tail -200 | nl'
|
|
alias big='expac -H M "%m\t%n" | sort -h | nl'
|
|
else
|
|
alias rip="echo 'expac is not installed. Install it to list last deinstalled packages.'"
|
|
alias big="echo 'expac is not installed. Install it to list biggest packages.'"
|
|
end
|
|
|
|
function cleanup
|
|
while pacman -Qdtq >/dev/null 2>&1
|
|
set orphans (pacman -Qdtq 2>/dev/null)
|
|
if test -z "$orphans"
|
|
break
|
|
end
|
|
sudo pacman -R $orphans
|
|
end
|
|
echo "No more orphaned packages."
|
|
end
|
|
|
|
if test -x $HOME/.local/python-3.11.9/bin/python3.11
|
|
alias py311="$HOME/.local/python-3.11.9/bin/python3.11"
|
|
end
|
|
|
|
if test -e /usr/bin/tmux
|
|
function quickshell-reload
|
|
if test -e /usr/bin/quickshell
|
|
tmux kill-session -t qs 2>/dev/null
|
|
tmux new-session -d -s qs 'quickshell'
|
|
else
|
|
echo "'quickshell' is not installed. Install it via your package manager."
|
|
end
|
|
end
|
|
else
|
|
function quickshell-reload
|
|
echo "'tmux' is not installed. Install it via your package manager."
|
|
end
|
|
end
|
|
|
|
if test -e /usr/bin/reflector
|
|
alias mirror='sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist'
|
|
alias mirrora='sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist'
|
|
alias mirrord='sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist'
|
|
alias mirrors='sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist'
|
|
end
|