#!/bin/sh -e # inspired by peppermint OS's ice - user.js and userChrome.css is taken from them: # https://github.com/peppermintos/ice prefix="$HOME/.local/share/miniice" mkdir -p "$prefix/bin" mkdir -p "$prefix/firefox" help() { echo 'usage: miniice [list|add |del |-h|--help|help] miniice list - list all SSBs configured miniice add - create a new SSB miniice del - delete existing SSB miniice [help|-h|--help] - show this help' } add() { # TODO: check if exists name="$1" url="$2" mkdir -p "$prefix/firefox/$name" echo 'user_pref("browser.cache.disk.enable", false);user_pref("browser.cache.disk.capacity", 0);user_pref("browser.cache.disk.filesystem_reported", 1);user_pref("browser.cache.disk.smart_size.enabled", false);user_pref("browser.cache.disk.smart_size.first_run", false);user_pref("browser.cache.disk.smart_size.use_old_max", false);user_pref("browser.ctrlTab.previews", true);user_pref("browser.tabs.warnOnClose", false);user_pref("plugin.state.flash", 2);user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);' > "$prefix"/firefox/"$name"/user.js mkdir -p "$prefix/firefox/$name/chrome" echo '#nav-bar, #identity-box, #tabbrowser-tabs, #TabsToolbar { visibility: collapse !important; }' > "$prefix"/firefox/"$name"/chrome/userChrome.css echo "firefox --class SSB-$name --profile $prefix/firefox/$name --no-remote $url" > "$prefix/bin/$name" chmod 755 "$prefix/bin/$name" } del() { # TODO: check if exists name="$1" rm -rf "$prefix/firefox/$name" rm "$prefix/bin/$name" } list() { cd "$prefix"/bin for f in *; do [ "$f" = '*' ] && continue echo "$f" done } if [ "$1" = "-h" ] || [ "$1" = "--help" ] || [ "$1" = "help" ]; then help exit 0 elif [ "$1" = add ]; then shift ! [ $# = 2 ] && help && exit 1 add "$1" "$2" elif [ "$1" = del ]; then shift ! [ $# = 1 ] && help && exit 1 del "$1" elif [ "$1" = list ]; then shift ! [ $# = 0 ] && help && exit 1 list else help exit 1 fi