Sxiv: Opening URLs with curl

Created on 18 Sep 2016  路  4Comments  路  Source: muennich/sxiv

In principle something like
sxiv http://link.to/image should be possible with curl.
Thats a whishlist item I would like to bring up for future versions.

Most helpful comment

Possible to add file descriptor support ? like

sxiv <(curl -s https://i.redd.it/gy65o4mk3oe01.png)

All 4 comments

No, because this can easily be achieved in a script outside of sxiv.

Possible to add file descriptor support ? like

sxiv <(curl -s https://i.redd.it/gy65o4mk3oe01.png)

@BurhanDanger I've added support for that in my branch: https://github.com/muennich/sxiv/pull/369

Alternatively, a script that you can put in your path:

#!/usr/bin/env bash

SXIV_PATH='/usr/bin/sxiv'

INPUT_ARGS=("$@")
NEW_INPUT_ARGS=("$SXIV_PATH")

for arg in "${INPUT_ARGS[@]}";
  do
    if [[ -f "$arg" ]]; then
      NEW_INPUT_ARGS+=("$arg")
    else
      tmp="$(mktemp --suffix="-sxiv")"
      if curl "$arg" --output "$tmp" 2> /dev/null; then
        NEW_INPUT_ARGS+=("$tmp")
      else
        echo "sxiv: $arg: No such file or directory"
        echo "sxiv: $arg: Failed to curl"
      fi
    fi
  done

exec "${NEW_INPUT_ARGS[@]}"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

astier picture astier  路  17Comments

rpdelaney picture rpdelaney  路  9Comments

anko picture anko  路  4Comments

causes- picture causes-  路  3Comments

crocket picture crocket  路  6Comments