Skip to content

Commit

Permalink
fix prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Oct 2, 2024
1 parent d68ee67 commit fc2cd37
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions tv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,35 @@ set_firefox_preferences() {
echo "Setting Firefox preferences"
FIREFOX_DIR="/home/kids/.mozilla/firefox"
mkdir -p "$FIREFOX_DIR"
if [ ! -d "$FIREFOX_DIR"/*.default ]; then
PROFILE_DIR="$FIREFOX_DIR/profile.default"
mkdir -p "$PROFILE_DIR"
else
PROFILE_DIR=$(find "$FIREFOX_DIR" -maxdepth 1 -type d -name "*.default" | head -n 1)
fi

# Create a new Firefox profile
PROFILE_NAME="kids_profile"
firefox -CreateProfile "$PROFILE_NAME $FIREFOX_DIR/$PROFILE_NAME"

PROFILE_DIR="$FIREFOX_DIR/$PROFILE_NAME"
PREFS_FILE="$PROFILE_DIR/prefs.js"
touch "$PREFS_FILE"
echo 'user_pref("browser.startup.homepage", "http://devxt-nas01:31437");' >> "$PREFS_FILE"
echo 'user_pref("browser.startup.page", 1);' >> "$PREFS_FILE"
echo 'user_pref("browser.startup.homepage_override.mstone", "ignore");' >> "$PREFS_FILE"
USER_JS_FILE="$PROFILE_DIR/user.js"

# Create user.js file to override default preferences
cat > "$USER_JS_FILE" << EOF
user_pref("browser.startup.homepage", "http://devxt-nas01:31437");
user_pref("browser.startup.page", 1);
user_pref("browser.startup.homepage_override.mstone", "ignore");
user_pref("trailhead.firstrun.didSeeAboutWelcome", true);
user_pref("browser.shell.checkDefaultBrowser", false);
user_pref("datareporting.policy.dataSubmissionEnabled", false);
user_pref("browser.newtabpage.activity-stream.showSponsoredTopSites", false);
user_pref("browser.uitour.enabled", false);
EOF

# Update Firefox desktop file to use the new profile
DESKTOP_FILE="/usr/share/applications/firefox.desktop"
sed -i 's/Exec=firefox/Exec=firefox -P kids_profile/' "$DESKTOP_FILE"

# Update the Firefox autostart file
AUTOSTART_FILE="/home/kids/.config/autostart/firefox-fullscreen.desktop"
sed -i 's/Exec=firefox --kiosk/Exec=firefox -P kids_profile --kiosk/' "$AUTOSTART_FILE"

chown -R kids:kids "$FIREFOX_DIR"
}

Expand Down

0 comments on commit fc2cd37

Please sign in to comment.