#!/usr/bin/env bash print_help() { cat <&1 | awk '/Stream.+Video/')" if [[ -n "$TMUX" && -z "$has_video" ]]; then tmux split-window -h sleep .2 # Let bash login, otherwise command won't get sent tmux send-keys "mpv $1" Enter else mpv --force-window "$1" &>/dev/null & fi ;; html) chromium "$1" &>/dev/null & ;; *) if [[ -n "$TMUX" ]] && file "$1" | grep -iq 'ascii'; then tmux new-window -c "#{pane_current_path}" sleep .2 # Let bash login, otherwise command won't get sent tmux send-keys "vi $1" Enter fi esac } if [[ -z ${SWAYSOCK+x} ]]; then printf 'Sway not running. Will not open gui apps\n' >&2 exit 1 fi for arg in "$@" do case "$arg" in -h|--help) print_help exit 0 ;; *) open_file "$arg" ;; esac done #swaymsg [con_mark=vifm_window] focus