diff --git a/bin/omarchy-upgrade-to-quattro b/bin/omarchy-upgrade-to-quattro index f3cdd346..ec96c6ba 100755 --- a/bin/omarchy-upgrade-to-quattro +++ b/bin/omarchy-upgrade-to-quattro @@ -589,6 +589,30 @@ install_omarchy_quattro_packages() { mark_packages_explicit "${audio_packages[@]}" } +install_hardware_transition_packages() { + local hardware_packages=() + + if lspci | grep -qiE '(Multimedia audio controller|Audio device).*Intel'; then + hardware_packages+=(sof-firmware) + fi + + if lspci | grep -iE '(VGA|Display).*Intel' >/dev/null; then + hardware_packages+=(vulkan-intel) + fi + if lspci | grep -iE '(VGA|Display).*AMD' >/dev/null; then + hardware_packages+=(vulkan-radeon) + fi + if lspci | grep -iE '(VGA|Display).*Apple' >/dev/null; then + hardware_packages+=(vulkan-asahi) + fi + + if (( ${#hardware_packages[@]} > 0 )); then + log "Installing hardware support needed by the Omarchy quattro layout" + as_root pacman -S --needed --noconfirm "${hardware_packages[@]}" + mark_packages_explicit "${hardware_packages[@]}" + fi +} + remove_retired_default_packages() { local retired_packages=( asdcontrol-git @@ -2226,6 +2250,16 @@ rm -f "$state_dir/finalize-user.done" USER_SETUP } +apply_user_hardware_transition() { + if grep -qi "DX13260" /sys/class/dmi/id/product_name 2>/dev/null || + grep -qi "DX13260" /sys/class/dmi/id/product_family 2>/dev/null; then + log "Adjusting text scaling for Dell XPS 13 DX13260" + if ! run_as_user_session gsettings set org.gnome.desktop.interface text-scaling-factor 0.95; then + warn "Could not adjust text scaling for Dell XPS 13 DX13260; continuing." + fi + fi +} + write_legacy_theme_hyprland_conf() { run_as_user env HOME="$target_home" bash <<'THEME_COMPAT' set -euo pipefail @@ -2339,6 +2373,7 @@ remove_legacy_installer_package remove_legacy_limine_configs remove_conflicting_legacy_packages install_omarchy_quattro_packages +install_hardware_transition_packages normalize_limine_config configure_snapper_policy configure_lock_authentication @@ -2347,6 +2382,7 @@ cleanup_legacy_user_paths apply_system_transition suppress_hyprland_config_reload apply_user_transition +apply_user_hardware_transition run_as_user env \ HOME="$target_home" \ USER="$target_user" \ diff --git a/migrations/1784401744.sh b/migrations/1784401744.sh new file mode 100644 index 00000000..423c1ecf --- /dev/null +++ b/migrations/1784401744.sh @@ -0,0 +1,35 @@ +echo "Backfill hardware support and tmux settings added before Omarchy quattro" + +tmux_config="$HOME/.config/tmux/tmux.conf" +if [[ -f $tmux_config ]]; then + sed -i 's/^set -g terminal-features\[3\] "xterm-kitty:extkeys"$/set -ag terminal-features "xterm-kitty:extkeys"/' "$tmux_config" + + if ! grep -q 'M-S-Enter' "$tmux_config"; then + sed -i '/^# Pane Controls$/a\bind -n M-Enter split-window -v -c "#{pane_current_path}"\nbind -n M-S-Enter split-window -h -c "#{pane_current_path}"\nbind -n M-Escape kill-pane\n' "$tmux_config" + fi + + omarchy-restart-tmux +fi + +hardware_packages=() +if lspci | grep -qiE '(Multimedia audio controller|Audio device).*Intel' && omarchy-pkg-missing sof-firmware; then + hardware_packages+=(sof-firmware) +fi +if lspci | grep -iE '(VGA|Display).*Intel' >/dev/null && omarchy-pkg-missing vulkan-intel; then + hardware_packages+=(vulkan-intel) +fi +if lspci | grep -iE '(VGA|Display).*AMD' >/dev/null && omarchy-pkg-missing vulkan-radeon; then + hardware_packages+=(vulkan-radeon) +fi +if lspci | grep -iE '(VGA|Display).*Apple' >/dev/null && omarchy-pkg-missing vulkan-asahi; then + hardware_packages+=(vulkan-asahi) +fi + +if (( ${#hardware_packages[@]} > 0 )); then + omarchy-pkg-add "${hardware_packages[@]}" + omarchy-state set reboot-required +fi + +if omarchy-hw-match "DX13260"; then + gsettings set org.gnome.desktop.interface text-scaling-factor 0.95 +fi diff --git a/test/shell.d/upgrade-to-quattro-test.sh b/test/shell.d/upgrade-to-quattro-test.sh index 0682a1f0..a68bb094 100644 --- a/test/shell.d/upgrade-to-quattro-test.sh +++ b/test/shell.d/upgrade-to-quattro-test.sh @@ -55,3 +55,10 @@ pass "Omarchy 4 upgrade retires systemd-networkd for NetworkManager" grep -F 'omarchy-bar defaults' "$upgrade_to_quattro" >/dev/null pass "Omarchy 4 upgrade restores service-aware bar defaults" + +grep -F 'install_hardware_transition_packages' "$upgrade_to_quattro" >/dev/null +grep -F 'sof-firmware' "$upgrade_to_quattro" >/dev/null +grep -F 'vulkan-intel' "$upgrade_to_quattro" >/dev/null +grep -F 'apply_user_hardware_transition' "$upgrade_to_quattro" >/dev/null +grep -F 'DX13260' "$upgrade_to_quattro" >/dev/null +pass "Omarchy 4 upgrade backfills hardware support from the legacy release"