Closed apatel762 closed 2 years ago
actually the above configuration doesn't work, for some reason, Brave just resets the Preferences
file straight after I update it
will see if I can use a management policy (a bit overkill but oh well)
https://chromium.googlesource.com/chromium/chromium/+/master/chrome/app/policy/policy_templates.json
found some instructions for creating a policy list for chromium and then installing it so that it actually gets used (not sure if it'll work for flatpak, or brave browser, but going to give it a try.
documenting the steps below (these should be automated by Ansible if they work)
mkdir -p /etc/chromium/policies/{managed,recommended}
chmod -w /etc/chromium/policies/managed
touch /etc/chromium/policies/managed/00-custom_policy.json
in the JSON file, add some policy:
{
"HomepageLocation": "https://www.chromium.org"
}
Refs.:
the above steps didn't work... i think it's something to do with how flatpak sandboxes its applications
https://github.com/flathub/com.brave.Browser/blob/master/com.brave.Browser.yaml#L86
i tried adding a flatpak_policy.json
, with my policy, to $HOME/.local/share/flatpak-brave
but i don't think it has picked it up
removed this line: https://github.com/apatel762/home-infra/blob/d4e58f2b4f6f85e3771d17f5cdb1372bf55e8136/workstation/configuration-playbook/group_vars/local.yml#L45
apparently the brave flatpak will automatically symlink the host policy to the sandbox, so from here, we just repeat the steps from my previous comment, but instead of /etc/chromium
, we put our policies in /etc/brave
- so the commands would be:
sudo -i
mkdir -p /etc/brave/policies/{managed,recommended}
chmod -w /etc/brave/policies/managed
touch /etc/brave/policies/managed/00-custom_policy.json
and then put some policy into the file just to see if it works
{
"HomepageLocation": "file:///var/home/apatel/Documents/Homepage/index.html",
"NewTabPageLocation": "file:///var/home/apatel/Documents/Homepage/index.html",
"HomepageIsNewTabPage": true
}
close the browser & restart it - if you open the settings drop-down (top-right) it should say that the browser is managed (& you should automatically be taken to the startpage)
you can also visit brave://policy/
to see the active policy
Refs.:
you can actually configure the web browser via Ansible (for Chromium browsers at least) by looking up the
Preferences
JSON file and changing the value in there.For Brave Browser flatpak, this is the abs path to the file:
$HOME/.var/app/com.brave.Browser/config/BraveSoftware/Brave-Browser/Default/Preferences
we need to change the "homepage" var, which you can see via: