Extract pkg cmd abstractions and clean up all migrations (#1291)

* No using custom chromium.desktop any more

* Spacing

* Rely on $OMARCHY_PATH

* Add common pkg and cmd functions for use in migrations and elsewhere

* Simple pkg-adds

* Later migration does it

* Ensure running migrations on older installs have the new pkg/cmds available

* Spacing

* Use new abstractions

* Installed in later migration

* Needless comment

* Use new commands

* Fix package name from 'batt' to 'bat'
This commit is contained in:
David Heinemeier Hansson
2025-08-30 07:41:05 +02:00
committed by GitHub
parent 4f6f92b2cc
commit a3c5e589f6
65 changed files with 132 additions and 153 deletions

3
migrations/1751134562.sh Normal file
View File

@@ -0,0 +1,3 @@
echo "Ensure new pkg/cmd functions are available to old-run migrations"
source $OMARCHY_PATH/default/bash/functions

View File

@@ -1,5 +1,3 @@
echo "Add missing installation of bat (used by the ff alias)"
if ! command -v bat &>/dev/null; then
# Add missing installation of bat
sudo pacman -S --noconfirm --needed bat
fi
pkg-add bat

View File

@@ -1,5 +1,3 @@
echo "Installing missing fd terminal tool for finding files"
if ! command -v fd &>/dev/null; then
sudo pacman -S --noconfirm --needed fd
fi
pkg-add fd

View File

@@ -1,8 +1,9 @@
echo "Switching from vlc to mpv for the default video player"
if ! command -v mpv &>/dev/null; then
sudo pacman -Rns --noconfirm vlc
if cmd-missing mpv; then
pkg-remove vlc
rm ~/.local/share/applications/vlc.desktop
sudo pacman -S --noconfirm mpv
pkg-add mpv
xdg-mime default mpv.desktop video/mp4
xdg-mime default mpv.desktop video/x-msvideo
xdg-mime default mpv.desktop video/x-matroska

View File

@@ -1,5 +1,3 @@
echo "Add LocalSend as new default application"
if ! command -v localsend &>/dev/null; then
sudo pacman -S --noconfirm --needed localsend
fi
pkg-add localsend

View File

@@ -1,5 +1,3 @@
echo "Install ffmpegthumbnailer for video thumbnails in the file manager"
if ! command -v ffmpegthumbnailer &>/dev/null; then
sudo pacman -S --noconfirm --needed ffmpegthumbnailer
fi
pkg-add ffmpegthumbnailer

View File

@@ -1,5 +1,3 @@
echo "Install bash-completion"
if ! pacman -Q bash-completion &>/dev/null; then
sudo pacman -S --noconfirm --needed bash-completion
fi
pkg-add bash-completion

View File

@@ -1,6 +1,6 @@
echo "Install Impala as new wifi selection TUI"
if ! command -v impala &>/dev/null; then
sudo pacman -S --noconfirm --needed impala
echo "You need to update the Waybar config to use Impala Wi-Fi selector in top bar."
if cmd-missing impala; then
pkg-add impala
omarchy-refresh-waybar
fi

View File

@@ -1,2 +1,3 @@
echo "Permanently fix F-keys on Apple-mode keyboards (like Lofree Flow84)"
source ~/.local/share/omarchy/install/config/hardware/fix-fkeys.sh
source $OMARCHY_PATH/install/config/hardware/fix-fkeys.sh

View File

@@ -1,5 +1,3 @@
echo "Adding gnome-keyring to make 1password work with 2FA codes"
if ! command -v gnome-keyring &>/dev/null; then
sudo pacman -S --noconfirm --needed gnome-keyring
fi
pkg-add gnome-keyring

View File

@@ -1,4 +1,4 @@
echo "Install Plymouth splash screen"
sudo pacman -S --needed --noconfirm uwsm plymouth
source "$HOME/.local/share/omarchy/install/login/plymouth.sh"
pkg-add uwsm plymouth
source "$OMARCHY_PATH/install/login/plymouth.sh"

View File

@@ -1,4 +1,5 @@
echo "Switching to polkit-gnome for better fingerprint authentication compatibility"
if ! command -v /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &>/dev/null; then
sudo pacman -S --noconfirm --needed polkit-gnome
systemctl --user stop hyprpolkitagent

View File

@@ -1,4 +1,5 @@
echo "Migrate to the modular implementation of hyprlock"
if [ -L ~/.config/hypr/hyprlock.conf ]; then
rm ~/.config/hypr/hyprlock.conf
cp ~/.local/share/omarchy/config/hypr/hyprlock.conf ~/.config/hypr/hyprlock.conf

View File

@@ -1,7 +1,5 @@
echo "Update chromium.desktop to ensure we are always using wayland"
if [[ ! -f ~/.local/share/applications/chromium.desktop ]]; then
cp ~/.local/share/omarchy/applications/chromium.desktop ~/.local/share/applications/
xdg-settings set default-web-browser chromium.desktop
xdg-mime default chromium.desktop x-scheme-handler/http
xdg-mime default chromium.desktop x-scheme-handler/https
fi
xdg-settings set default-web-browser chromium.desktop
xdg-mime default chromium.desktop x-scheme-handler/http
xdg-mime default chromium.desktop x-scheme-handler/https

View File

@@ -1,4 +1,5 @@
echo "Migrate to the modular, variable-based implementation of waybar style.css"
if [ -L ~/.config/waybar/style.css ]; then
rm ~/.config/waybar/style.css
cp ~/.local/share/omarchy/config/waybar/style.css ~/.config/waybar/style.css

View File

@@ -1,5 +1,6 @@
echo "Update to use UWSM and seamless login"
if ! command -v uwsm &>/dev/null; then
if cmd-missing uwsm; then
sudo rm -f /etc/systemd/system/getty@tty1.service.d/override.conf
sudo rmdir /etc/systemd/system/getty@tty1.service.d/ 2>/dev/null || true
@@ -14,5 +15,5 @@ if ! command -v uwsm &>/dev/null; then
sed -i 's/^GTK_IM_MODULE=fcitx$//' "$HOME/.config/environment.d/fcitx.conf"
fi
source ~/.local/share/omarchy/install/login/plymouth.sh
source $OMARCHY_PATH/install/login/plymouth.sh
fi

View File

@@ -1,3 +1,4 @@
echo "Add color and animation to pacman installs"
grep -q '^Color' /etc/pacman.conf || sudo sed -i '/^\[options\]/a Color' /etc/pacman.conf
grep -q '^ILoveCandy' /etc/pacman.conf || sudo sed -i '/^\[options\]/a ILoveCandy' /etc/pacman.conf

View File

@@ -1,5 +1,3 @@
echo "Install missing docker-buildx package for out-of-the-box Kamal compatibility"
if ! docker buildx version &>/dev/null; then
sudo pacman -S --noconfirm --needed docker-buildx
fi
pkg-add docker-buildx

View File

@@ -1,4 +1,5 @@
echo "Make light themes possible"
if [[ -f ~/.local/share/applications/blueberry.desktop ]]; then
rm -f ~/.local/share/applications/blueberry.desktop
rm -f ~/.local/share/applications/org.pulseaudio.pavucontrol.desktop

View File

@@ -1,4 +1,5 @@
echo "Rename waybar config file for syntax highlighting"
if [[ -f ~/.config/waybar/config ]]; then
mv ~/.config/waybar/config ~/.config/waybar/config.jsonc
fi

View File

@@ -1,4 +1,5 @@
echo "Prevent docker from requiring network readiness on boot"
if [[ ! -f /etc/systemd/system/docker.service.d/no-block-boot.conf ]]; then
sudo mkdir -p /etc/systemd/system/docker.service.d/
sudo tee /etc/systemd/system/docker.service.d/no-block-boot.conf <<'EOF'

View File

@@ -1,4 +1,5 @@
echo "Add Catppuccin Latte light theme"
if [[ ! -L "~/.config/omarchy/themes/catppuccin-latte" ]]; then
ln -snf ~/.local/share/omarchy/themes/catppuccin-latte ~/.config/omarchy/themes/
fi

View File

@@ -1,5 +1,3 @@
echo "Install slurp + wl-screenrec for new ALT+PrintScreen screen recorder"
if ! command -v wl-screenrec &>/dev/null || ! command -v slurp &>/dev/null; then
sudo pacman -S --noconfirm --needed slurp wl-screenrec
fi
pkg-add slurp wl-screenrec

View File

@@ -1,9 +1,8 @@
echo "Replace volume control GUI with a TUI"
if ! command -v wiremix &>/dev/null; then
sudo pacman -S --noconfirm --needed wiremix
sudo pacman -Rns --noconfirm pavucontrol
if cmd-missing wiremix; then
pkg-add wiremix
pkg-remove pavucontrol
omarchy-refresh-applications
omarchy-refresh-waybar
fi

View File

@@ -1,4 +1,3 @@
echo "Remove needless fcitx5-configtool package"
if pacman -Qe fcitx5-configtool &>/dev/null; then
sudo pacman -Rns --noconfirm fcitx5-configtool
fi
pkg-remove fcitx5-configtool

View File

@@ -1,2 +1,3 @@
echo "Update .config/hypr/hyprlock.conf to include failed attempt counter"
omarchy-refresh-hyprlock

View File

@@ -1,5 +1,3 @@
echo "Install satty for the new screenshot flow"
if ! command -v satty &>/dev/null; then
sudo pacman -S --noconfirm --needed satty
fi
pkg-add satty

View File

@@ -1,9 +1,9 @@
echo "Replace wofi with walker as the default launcher"
if ! command -v walker &>/dev/null; then
sudo pacman -S --noconfirm --needed walker-bin libqalculate
if cmd-missing walker; then
pkg-add walker-bin libqalculate
sudo pacman -Rns --noconfirm wofi
pkg-remove wofi
rm -rf ~/.config/wofi
mkdir -p ~/.config/walker

View File

@@ -1,6 +1,6 @@
echo "Install swayOSD to show volume status"
if ! command -v swayosd-server &>/dev/null; then
sudo pacman -S --noconfirm --needed swayosd
if cmd-missing swayosd-server; then
pkg-add swayosd
setsid uwsm app -- swayosd-server &>/dev/null &
fi

View File

@@ -1,7 +1,3 @@
echo "Install wf-recorder for screen recording for nvidia"
if lspci | grep -qi 'nvidia'; then
if ! command -v wf-recorder &>/dev/null; then
sudo pacman -S --noconfirm --needed wf-recorder
fi
fi
pkg-add wf-recorder

View File

@@ -1,5 +0,0 @@
echo "Add Terminal Text Effects for rizzing Omarchy"
if ! pacman -Q python-terminaltexteffects &>/dev/null; then
sudo pacman -S --noconfirm python-terminaltexteffects
fi

View File

@@ -1,5 +1,6 @@
echo "Allow updating of timezone by right-clicking on the clock (or running omarchy-cmd-tzupdate)"
if ! command -v tzupdate &>/dev/null; then
bash ~/.local/share/omarchy/install/config/timezones.sh
if cmd-missing tzupdate; then
$OMARCHY_PATH/install/config/timezones.sh
omarchy-refresh-waybar
fi

View File

@@ -1,4 +0,0 @@
echo "Update Walker config to include = as the leader key for the calculator"
if ! grep -q 'prefix = "="' ~/.config/walker/config.toml; then
omarchy-refresh-walker
fi

View File

@@ -1,4 +0,0 @@
echo "Update Walker config to include . as the leader key for the finder"
if ! grep -q 'prefix = "\."' ~/.config/walker/config.toml; then
omarchy-refresh-walker
fi

View File

@@ -1,5 +0,0 @@
echo "Ensure screensaver doesn't start while the computer is locked"
if ! grep -q "pidof hyprlock || omarchy-launch-screensaver" ~/.config/hypr/hypridle.conf; then
omarchy-refresh-hypridle
fi

View File

@@ -1,5 +0,0 @@
echo "Update app launcher config to allow enough entries to show all keybindings on SUPER+K"
if ! grep "max_entries = 200" ~/.config/walker/config.toml; then
omarchy-refresh-walker
fi

View File

@@ -1,7 +1,7 @@
echo "Enable auto-discovery of network printers"
if [[ ! -f /etc/systemd/resolved.conf.d/10-disable-multicast.conf ]]; then
sudo pacman -S --noconfirm avahi nss-mdns
pkg-add avahi nss-mdns
# Disable multicast dns in resolved. Avahi will provide this for better network printer discovery
sudo mkdir -p /etc/systemd/resolved.conf.d
@@ -10,7 +10,7 @@ if [[ ! -f /etc/systemd/resolved.conf.d/10-disable-multicast.conf ]]; then
fi
if ! grep -q '^CreateRemotePrinters Yes' /etc/cups/cups-browsed.conf; then
sudo pacman -S --noconfirm cups-browsed
pkg-add cups-browsed
# Enable automatically adding remote printers
echo 'CreateRemotePrinters Yes' | sudo tee -a /etc/cups/cups-browsed.conf
sudo systemctl enable --now cups-browsed.service

View File

@@ -1,2 +1,3 @@
echo "Add support for accessing Android phone data via file manager"
sudo pacman -S --noconfirm --needed gvfs-mtp
pkg-add gvfs-mtp

View File

@@ -1,2 +0,0 @@
echo "Increase time before screensaver starts to 2.5 minutes (from 1 minute)"
omarchy-refresh-hypridle

View File

@@ -1,2 +1,3 @@
echo "Add chromium-flags.conf"
omarchy-refresh-config chromium-flags.conf

View File

@@ -1,4 +1,5 @@
echo "Change update-available icon in top bar from  to "
if grep -q '"format": "",' ~/.config/waybar/config.jsonc; then
sed -i 's/"format": ""/"format": ""/' ~/.config/waybar/config.jsonc
fi

View File

@@ -1,2 +0,0 @@
echo "Restart Walker to pick up menu selections"
omarchy-restart-walker

View File

@@ -1,2 +1,3 @@
echo "Remove old Omarchy TUI app now that we have the Omarchy Menu"
rm -rf ~/.local/share/applications/omarchy.desktop
rm -f ~/.local/share/applications/omarchy.desktop

View File

@@ -1,3 +1,3 @@
echo "Add xmlstarlet needed for updating fonts via Omarchy menu"
sudo pacman -S --noconfirm --needed xmlstarlet
pkg-add xmlstarlet

View File

@@ -1,3 +0,0 @@
echo "Update OS icon in About from Windows to Arch"
omarchy-refresh-config fastfetch/config.jsonc

View File

@@ -1,4 +1,3 @@
echo "Tune MTU probing for more reliable SSH"
# Solve common flakiness with SSH
echo "net.ipv4.tcp_mtu_probing=1" | sudo tee -a /etc/sysctl.d/99-sysctl.conf

View File

@@ -1,5 +0,0 @@
echo "Lock 1password on screen lock"
if ! grep -q "omarchy-lock-screen" ~/.config/hypr/hypridle.conf; then
omarchy-refresh-hypridle
fi

View File

@@ -1,2 +0,0 @@
echo "Update Walker config"
omarchy-refresh-walker

View File

@@ -1,4 +1,5 @@
echo "Update polkit policy to yield to fingerprint and fido2"
# If fprint exists in polkit, it was wrong and needs reset
if [ -f /etc/pam.d/polkit-1 ] && grep -Fq 'pam_fprintd.so' /etc/pam.d/polkit-1; then
sudo tee /etc/pam.d/polkit-1 >/dev/null <<'EOF'

View File

@@ -1,4 +1,5 @@
echo "Add start burst limit to login"
if [ -f /etc/systemd/system/omarchy-seamless-login.service ]; then
cat <<EOF | sudo tee /etc/systemd/system/omarchy-seamless-login.service
[Unit]

View File

@@ -1,2 +1,3 @@
echo "Update Walker config to add 60s timeout such that it won't conflict with screensaver"
omarchy-refresh-walker

View File

@@ -9,9 +9,9 @@ set_theme_colors() {
fi
}
if command -v chromium &>/dev/null; then
sudo pacman -Rns --noconfirm chromium || true
sudo pacman -S --noconfirm omarchy-chromium
if cmd-present chromium; then
pkg-remove chromium
pkg-add omarchy-chromium
if pgrep -x chromium; then
if gum confirm "Chromium must be restarted. Ready?"; then

View File

@@ -1,6 +1,6 @@
echo "Add minimal starship prompt to terminal"
if ! command -v starship &>/dev/null; then
sudo pacman -S --noconfirm starship
if cmd-missing starship; then
pkg-add starship
cp $OMARCHY_PATH/config/starship.toml ~/.config/starship.toml
fi

View File

@@ -1,9 +1,3 @@
echo "Ensure TTE and dependencies are installed"
if ! pacman -Q python-poetry-core &>/dev/null; then
sudo pacman -S --noconfirm python-poetry-core
fi
if ! pacman -Q python-terminaltexteffects &>/dev/null; then
sudo pacman -S --noconfirm python-terminaltexteffects
fi
pkg-add python-poetry-core python-terminaltexteffects

View File

@@ -1,5 +1,3 @@
echo "Add potentially missing dependency for power profile controls"
if ! pacman -Q python-gobject &>/dev/null; then
sudo pacman -S --noconfirm python-gobject
fi
pkg-add python-gobject

View File

@@ -1,3 +0,0 @@
echo "Update fastfetch config to include current theme name and colors"
omarchy-refresh-config fastfetch/config.jsonc

View File

@@ -1,3 +0,0 @@
echo "Turn on the screensaver by default again now that TTE has been fixed"
omarchy-refresh-hypridle

View File

@@ -1,5 +1,3 @@
echo "Install wf-recorder for intel based device"
if lspci | grep -Eqi 'nvidia|intel.*graphics'; then
sudo pacman -S --noconfirm --needed wf-recorder
fi
pkg-add wf-recorder

View File

@@ -1,6 +1,4 @@
echo "Switch from lazydocker-bin to lazydocker official"
if pacman -Q lazydocker-bin >/dev/null; then
sudo pacman -Rns --noconfirm lazydocker-bin
sudo pacman -S --noconfirm lazydocker
fi
pkg-remove lazydocker-bin
pkg-add lazydocker

View File

@@ -1,15 +1,13 @@
echo "Migrate AUR packages to official repos where possible"
reinstall_package_opr() {
if pacman -Q $1 >/dev/null; then
if pkg-present $1; then
sudo pacman -Rns --noconfirm $1
sudo pacman -S --noconfirm ${2:-$1}
fi
}
if pacman -Q yay-bin-debug >/dev/null; then
sudo pacman -Rns --noconfirm yay-bin-debug
fi
pkg-remove yay-bin-debug
reinstall_package_opr yay-bin yay
reinstall_package_opr obsidian-bin obsidian

View File

@@ -1,2 +0,0 @@
echo "Update Hypridle to prevent flash of unlocked screen after sleep"
omarchy-refresh-hypridle

View File

@@ -1,6 +1,6 @@
echo "Replace buggy native Zoom client with webapp"
if pacman -Q zoom >/dev/null; then
sudo pacman -Rns --noconfirm zoom
if pkg-present zoom; then
pkg-remove zoom
omarchy-webapp-install "Zoom" https://app.zoom.us/wc/home https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/png/zoom.png
fi

View File

@@ -1,12 +1,6 @@
echo "Remove any Chaotic-AUR infrastructure packages"
if pacman -Q chaotic-keyring 2>/dev/null; then
sudo pacman -Rns --noconfirm chaotic-keyring
fi
if pacman -Q chaotic-mirrorlist 2>/dev/null; then
sudo pacman -Rns --noconfirm chaotic-mirrorlist
fi
pkg-remove chaotic-keyring chaotic-mirrorlist
if sudo pacman-key --list-keys 3056513887B78AEB >/dev/null 2>&1; then
sudo pacman-key --delete 3056513887B78AEB

View File

@@ -1,5 +1,3 @@
echo "Add back ttf-ia-writer if it was missing"
if ! pacman -Q ttf-ia-writer 2>/dev/null; then
sudo pacman -S --noconfirm ttf-ia-writer
fi
pkg-add ttf-ia-writer