summary refs log tree commit diff
path: root/home/.local/bin/open
blob: 256a62e2fa1fda529f723733e45c6b825a4cb1ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
set -eu

if [ -n "${SSH_CLIENT:-}" ]; then
	exec pbd -o "$@"
fi

case "$1" in
	(*.gif|*.jpeg|*.jpg|*.png)
		curl -LSs "$1" | imv -
		;;
	(*.txt)
		exec xterm -hold -e sh -c 'curl -LSs "$1" | $PAGER' - "$1"
		;;
	(*)
		printf '%s' "$1" | pbcopy
		;;
esac