Created
May 18, 2023 14:51
-
-
Save nx10/dc9eb3a2d3fbaeba6c3432c84ced9c66 to your computer and use it in GitHub Desktop.
Ubuntu chrome dark mode patcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if (($EUID != 0)); then | |
if [[ -t 1 ]]; then | |
sudo "$0" "$@" | |
else | |
exec 1>output_file | |
gksu "$0 $@" | |
fi | |
exit | |
fi | |
LAUNCH_CONF="/usr/share/applications/google-chrome.desktop" | |
if ! grep -q "force-dark-mode" "$LAUNCH_CONF" ; then | |
sed -i '/^Exec.*[^d][^e]$/ s/$/ --enable-features=WebUIDarkMode --force-dark-mode/' "$LAUNCH_CONF" | |
echo "Successfully applied fix!" | |
else | |
echo "Fix seems to be applied already." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Makes Chrome properly respect
prefers-color-theme
in Ubuntu which has been broken for a long timeMake sure to set Settings > Apperance > Theme to GTK for this to work.

Has to be re-run after every Chrome update.