Chromium managed policy is mandatory for every profile. World-writable dirs let any local uid plant policy, including force-installed extensions. Write goes through the omarchy-browser-policy group at 2775 so theme colour still works without other-write.
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Apply the current theme color to Chromium, Chrome, Edge, and Brave
|
|
# omarchy:hidden=true
|
|
|
|
CHROMIUM_THEME=$HOME/.local/state/omarchy/current/theme/chromium.theme
|
|
|
|
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_HEX_COLOR="#1c2027"
|
|
fi
|
|
|
|
source "$OMARCHY_PATH/install/helpers/browser-policy.sh"
|
|
|
|
set_browser_policy() {
|
|
browser_policy_write_color "$1" "$THEME_HEX_COLOR"
|
|
}
|
|
|
|
refresh_running_browser() {
|
|
local process="$1"
|
|
local command="$2"
|
|
local pgrep_args="${3:--x}"
|
|
|
|
if omarchy-cmd-present "$command" && pgrep $pgrep_args "$process" >/dev/null; then
|
|
"$command" --refresh-platform-policy --no-startup-window &>/dev/null
|
|
fi
|
|
}
|
|
|
|
failed=0
|
|
set_browser_policy /etc/chromium/policies/managed || failed=1
|
|
refresh_running_browser chromium chromium
|
|
|
|
set_browser_policy /etc/opt/chrome/policies/managed || failed=1
|
|
refresh_running_browser chrome google-chrome-stable || refresh_running_browser chrome google-chrome
|
|
|
|
set_browser_policy /etc/opt/edge/policies/managed || failed=1
|
|
refresh_running_browser msedge microsoft-edge-stable
|
|
|
|
set_browser_policy /etc/brave/policies/managed || failed=1
|
|
refresh_running_browser brave brave
|
|
# Match on the binary path: the running process is named plain "brave", and a
|
|
# bare -f brave-origin pattern would also match the installer's own terminal.
|
|
refresh_running_browser /opt/brave-origin-bin/ brave-origin -f
|
|
|
|
exit "$failed"
|