diff --git a/bin/omarchy-install-browser b/bin/omarchy-install-browser index 4593bc72d87b..e4e1c3f6ee60 100755 --- a/bin/omarchy-install-browser +++ b/bin/omarchy-install-browser @@ -17,6 +17,19 @@ announce_browser_installed() { echo "$1 browser installed. Make it the default via Setup > Defaults > Browser." } +register_widevine() { + # The widevine package registers its CDM for Chromium and Firefox only. Other + # Chromium-family browsers look for the CDM inside their own install + # directory, so link the system one in; without it DRM sites (Netflix, Apple + # TV+, Spotify) fail with no useful error. No-op when the widevine package is + # not installed, which is the case wherever the browser ships its own CDM. + local install_dir=$1 + + if [[ -d /opt/WidevineCdm/chromium ]] && [[ -d $install_dir ]] && [[ ! -e $install_dir/WidevineCdm ]]; then + sudo ln -sfn /opt/WidevineCdm/chromium "$install_dir/WidevineCdm" + fi +} + copy_chromium_flags() { mkdir -p ~/.config cp -f "$OMARCHY_PATH/config/chromium-flags.conf" "$1" @@ -63,6 +76,7 @@ brave) setup_chromium_policy_directory /etc/brave/policies/managed copy_chromium_flags ~/.config/brave-flags.conf + register_widevine /opt/brave-bin omarchy-theme-set-browser announce_browser_installed "Brave" ;; diff --git a/migrations/1789843016.sh b/migrations/1789843016.sh new file mode 100644 index 000000000000..9f90a970ab35 --- /dev/null +++ b/migrations/1789843016.sh @@ -0,0 +1,16 @@ +echo "Register the Widevine CDM for an installed Brave" + +# The widevine package registers its CDM for Chromium and Firefox only, so a +# Brave installed through `omarchy install browser brave` never finds one and +# DRM sites (Netflix, Apple TV+, Spotify) fail to play with no useful error. +# omarchy-install-browser links it for new installs; repair existing ones here. +if [[ ! -d /opt/WidevineCdm/chromium ]]; then + echo "Widevine CDM not installed; nothing to register." +elif [[ ! -d /opt/brave-bin ]]; then + echo "Brave not installed; nothing to register." +elif [[ -e /opt/brave-bin/WidevineCdm ]]; then + echo "Brave already has a Widevine CDM registered." +else + sudo ln -sfn /opt/WidevineCdm/chromium /opt/brave-bin/WidevineCdm + echo "Registered the Widevine CDM for Brave; restart Brave to pick it up." +fi