Skip to content

Instantly share code, notes, and snippets.

@pkillnine
Created December 20, 2016 11:43
Show Gist options
  • Save pkillnine/6edef00d56b5944b13dafb4014da43c5 to your computer and use it in GitHub Desktop.
Save pkillnine/6edef00d56b5944b13dafb4014da43c5 to your computer and use it in GitHub Desktop.
script
#!/bin/bash
if (( $# < 1 )); then
BASECMD="qutebrowser --backend webengine"
elif (( $# >= 1 )); then
BASECMD="$@"
fi
TMPBASEDIR=/tmp/qutebrowser_tmp_basedir_`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1`
QBCONFIGDIR="$HOME/.config/qutebrowser"
QBDATADIR="$HOME/.local/share/qutebrowser"
function qbcommand {
echo Executing: $BASECMD --basedir $TMPBASEDIR ':set ui window-title-format "[P] {perc}{title}{title_sep}Qutebrowser"' ':set tabs title-format "[P] {index}: {title}"'
$BASECMD --basedir $TMPBASEDIR ':set ui window-title-format "[P] {perc}{title}{title_sep}Qutebrowser"' ':set tabs title-format "[P] {index}: {title}"'
}
function cleanup {
echo Removing "$TMPBASEDIR"
rm -rf "$TMPBASEDIR"
}
mkdir -p "$TMPBASEDIR/config"
cp -r $QBCONFIGDIR/* "$TMPBASEDIR/config"
cat $QBDATADIR/blocked-hosts >> "$TMPBASEDIR/config/blocked-hosts"
qbcommand
trap cleanup EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment