#!/bin/bash

d="$@"
dir="$(dirname "$d")"
cd "$dir"
ttl=$"Decompress Archive"; icn="engrampa"
attr="--fixed --title=$ttl --window-icon=$icn --borders=20 --button=OK --text="
[ -z "$d" ] && yad $attr$"&#9;No archive specified!&#9;&#10;" && exit 2
[ ! -e "$d" ] && yad $attr$"&#9;'$d' not found!&#9;&#9;&#10;" && exit 1
[[ ! "$(xdg-mime query filetype "$d")" =~ compressed|rar|tar|zip ]] && yad $attr$"&#9;'$d' isn't an archive!&#9;&#9;&#10;" && exit 1
engrampa -h "$d"
