Skip to content

Instantly share code, notes, and snippets.

@nx10
Created May 18, 2023 14:51
Show Gist options
  • Save nx10/dc9eb3a2d3fbaeba6c3432c84ced9c66 to your computer and use it in GitHub Desktop.
Save nx10/dc9eb3a2d3fbaeba6c3432c84ced9c66 to your computer and use it in GitHub Desktop.
Ubuntu chrome dark mode patcher
#!/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
@nx10
Copy link
Author

nx10 commented May 18, 2023

Makes Chrome properly respect prefers-color-theme in Ubuntu which has been broken for a long time

Make sure to set Settings > Apperance > Theme to GTK for this to work.
image

Has to be re-run after every Chrome update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment