added the file

This commit is contained in:
Riley Apeldoorn 2021-03-02 07:50:54 +01:00
commit 6336a2f125
1 changed files with 42 additions and 0 deletions

42
entile Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env bash
regex='m/\-\ (http(s|)\:\/\/([\w_-]+[\w.,^#@%?+&\/_-]*))/; print $1'
alias='/home/riley/.config/entile/alias.conf'
browser='chromium'
if [[ "$@" =~ ^-[h?]$ ]] || [[ "$1" = "" ]]
then
echo "urlapp - open url as google chrome app"
echo ""
echo "Usage: urlapp [-u|-i] -c|-t|url"
echo -e " -c\tClose focused chrome tab and reopen it as a chrome app"
echo -e " -u\tOpen only if no other windows with that name exist, otherwise focus that window"
echo -e " -i\tOpen in incognito"
echo ""
echo "Dependencies: xdotool, chromium, i3-wm, perl"
exit 0
fi
if [[ "$@" =~ -\w*t\w* ]]
then
url=$(xdotool getactivewindow getwindowname | perl -nle "$regex")
elif [[ "$@" =~ -\w*c\w* ]]
then
url=$(xclip -o -clip)
else
arg=${*: -1}
maybe_alias=$(cat $alias | grep "$arg" | cut -d ' ' -f 2)
[ ! -z "$tmp" ] && url=$maybe_alias || url=$arg
fi
if [[ "$@" =~ -\w*u\w* ]] && [[ "$(xdotool search $url)" ]]
then
i3-msg [id="$(xdotool search $url | head -n 1)"] focus
else
if [[ "$@" =~ -\w*n\w* ]]
then
browser='chromium --incognito'
fi
url=$(echo "$url" | rg .*:// || echo "https://""$url")
$browser --app="$url" &
fi