#!/usr/bin/env zsh platform=$(uname) if [[ "$platform" == "Linux" ]]; then # To use mpv for youtube links if [[ $1 != "" ]]; then if printf $1 2>/dev/null | grep -q "youtube.com"; then mpv "$1" exit fi fi # scale on highres displays if [[ $(dpi) -gt 120 ]]; then SCALE=1.4 else SCALE=1.0 fi # maybe use firefox distributed in binary bin=$(which firefox) if [[ $? -eq 1 ]]; then bin=$(which firefox-bin) fi # for mutt copy the file before it disappears case "$1" in *tmp/pks/mutt/*) cp $1 $1.html TZ=UTC GDK_SCALE=$SCALE GDK_DPI_SCALE=$SCALE /usr/bin/env $bin -new-tab $1.html ;; *) TZ=UTC GDK_SCALE=$SCALE GDK_DPI_SCALE=$SCALE /usr/bin/env $bin -new-tab $@ ;; esac elif [[ "$platform" == "Darwin" ]]; then case "$1" in *tmp/pks/mutt/*) cp $1 $1.html open -g -j -a "Firefox" "$1.html" ;; *) open -g -j -a "Firefox" "$1" ;; esac return 0 fi