Files
Nomarchy/bin/nomarchy-theme-set-browser
Bernardo Magri 33deeb494b initial commit
2026-04-01 17:06:01 +01:00

25 lines
965 B
Bash
Executable File

#!/bin/bash
CHROMIUM_THEME=~/.config/nomarchy/current/theme/chromium.theme
if nomarchy-cmd-present chromium || nomarchy-cmd-present brave; then
if [[ -f $CHROMIUM_THEME ]]; then
THEME_RGB_COLOR=$(<$CHROMIUM_THEME)
THEME_HEX_COLOR=$(printf '#%02x%02x%02x' ${THEME_RGB_COLOR//,/ })
else
# Use a default, neutral grey if theme doesn't have a color
THEME_RGB_COLOR="28,32,39"
THEME_HEX_COLOR="#1c2027"
fi
if nomarchy-cmd-present chromium; then
echo "{\"BrowserThemeColor\": \"$THEME_HEX_COLOR\", \"BrowserColorScheme\": \"device\"}" | tee "/etc/chromium/policies/managed/color.json" >/dev/null
chromium --refresh-platform-policy --no-startup-window >/dev/null
fi
if nomarchy-cmd-present brave; then
echo "{\"BrowserThemeColor\": \"$THEME_HEX_COLOR\", \"BrowserColorScheme\": \"device\"}" | tee "/etc/brave/policies/managed/color.json" >/dev/null
brave --refresh-platform-policy --no-startup-window >/dev/null
fi
fi