From 0d2cde7e36c4a1f7b943223f8ce0513b20c92373 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 28 May 2024 11:55:50 -0400 Subject: [PATCH] fish: Add tmp function This is the preferred way of starting qutebrowser. --- home/fish.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/home/fish.nix b/home/fish.nix index 4ee88ae9..cb37e44e 100644 --- a/home/fish.nix +++ b/home/fish.nix @@ -168,6 +168,32 @@ echo "Usage: epub2pdf [file.epub]" end ''; + + tmp = /* fish */ '' + set MULLVAD_CACHE "/tmp/mullvad.json" + + if not test -e $MULLVAD_CACHE + curl https://api.mullvad.net/www/relays/wireguard > $MULLVAD_CACHE + end + + set CONTAINER_PROXY (random choice (cat $MULLVAD_CACHE | jq -r '.[] | select(.active) | select(.hostname | startswith("jp")) | .socks_name')) + set CONTAINER_ID "qtb-$(uuidgen)" + set SHORT (string split "." "$CONTAINER_PROXY" -f 1) + + mkdir -p "/tmp/$CONTAINER_ID/config/bookmarks" + mkdir -p "/tmp/$CONTAINER_ID/data/userscripts" + + ln -s ~/.config/qutebrowser/bookmarks/urls "/tmp/$CONTAINER_ID/config/bookmarks/urls" + ln -s ~/.config/qutebrowser/quickmarks "/tmp/$CONTAINER_ID/config/quickmarks" + + TZ="Asia/Tokyo" lnch qutebrowser \ + --set content.proxy "socks5://$CONTAINER_PROXY:1080" \ + --set window.title_format "{perc}[$SHORT]{title_sep}{current_title}" \ + --basedir "/tmp/$CONTAINER_ID" \ + --config-py "$HOME/.config/qutebrowser/config.py" \ + :adblock-update \ + "$argv" + ''; }; }; }