+ librewolfSettingsBackup.sh

This commit is contained in:
committer@tuxwarrior
2026-02-26 10:11:59 -05:00
parent eee2ea5f0c
commit 34a5cad4a2
2 changed files with 60 additions and 4 deletions

View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# klevstul :: 26.02.26
# help function, to locate the profile dir for the browser
librewolf_profile_dir() {
ffdir=/home/poq/.config/librewolf/librewolf/
if ! [ -d "$ffdir" ]
then
echo "error: librewolf's main directory was not found at: '${ffdir}'"
else
pattern=".default-default"
old_dir=`pwd`
cd ${ffdir}
for _dir in *"${pattern}"*; do
[ -d "${_dir}" ] && dir="${_dir}" && break
done
cd ${old_dir}
if [ -z "$dir" ]
then
echo "error: librewolf's profile directory not found"
else
ffprofiledir=${ffdir}${dir}
echo "${ffprofiledir}"
fi
fi
}
trg="/home/poq/syncDir/gitRepos/gi.op.fo/lnx-arch/dots/librewolf/user.js"
# get the browser's profile dir, and get the ui customisation preference line from that file
lwpd=$(librewolf_profile_dir)
if [[ ${lwpd} == error* ]] ; then
echo ${lwpd}
else
prefs=${lwpd}/prefs.js
echo "prefs=${prefs}"
custState=$(grep -i "browser.uicustomization.state" ${prefs})
echo "custState=${custState}"
sed -i '/ui uicustomization/c\${custState}' ${trg} # update user.js in the repo
more ${trg}
fi