#!/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