Add logic to theme-set for brave browser, macos not working so far

This commit is contained in:
2025-11-13 02:11:45 -06:00
parent ac91c7974c
commit 91cc2cf14a
3 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1 @@
47,47,47

View File

@@ -36,6 +36,23 @@ theme_update_neovim() {
done done
} }
theme_update_browser() {
policy='BrowserThemeColor'
color_hex=$(
printf '#%02x%02x%02x' $(
cat $DIR_THEME_SETTINGS/.current-theme/brave.theme | tr ',' ' '
)
)
[[ "$OSTYPE" != *"darwin"* ]] && {
echo "{\"$policy\": \"$color_hex\"}" > "/etc/brave/policies/managed/color.json"
} || {
# currently not working, property is set and seen by brave, but colors are not
# actually applied, leaving here as is for now; TODO: fix or just remove
defaults write com.brave.browser $policy -string "$color_hex"
}
brave --refresh-platform-policy --no-startup-window
}
[[ ! -z $1 ]] && raw_target="$1" || [[ ! -z $1 ]] && raw_target="$1" ||
raw_target=$( raw_target=$(
find $DIR_THEME_SETTINGS -mindepth 1 -maxdepth 1 -type d -exec basename -- {} \; | find $DIR_THEME_SETTINGS -mindepth 1 -maxdepth 1 -type d -exec basename -- {} \; |
@@ -50,8 +67,8 @@ ln -sF "$target_theme" $DIR_THEME_SETTINGS/.current-theme
theme_update_terminal theme_update_terminal
theme_update_tmux theme_update_tmux
theme_update_neovim & theme_update_neovim &
theme_update_browser
# theme_update_obsidian # TODO: decide if theming beyond transparency is worth it, if so, implement # theme_update_obsidian # TODO: decide if theming beyond transparency is worth it, if so, implement
# theme_update_browser # TODO: implement
# theme_update_reaper # TODO: implement # theme_update_reaper # TODO: implement
# theme_update_mutt # TODO: possible and actually desired? # theme_update_mutt # TODO: possible and actually desired?

View File

@@ -0,0 +1,3 @@
#!/bin/sh
/Applications/Brave\ Browser.app/Contents/MacOS/Brave\ Browser $@