-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenbrowser.lib
More file actions
executable file
·58 lines (52 loc) · 1.75 KB
/
openbrowser.lib
File metadata and controls
executable file
·58 lines (52 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
#
# ############################################################################
# Project: scripts (none)
# File...: openbrowser.lib
# Created: Thursday, 2023/08/31 - 20:08:57
# Author.: @fbnmtz, (fabiano.matoz@gmail.com)
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Last Modified: Thursday, 2023/08/31 - 20:51:42
# Modified By..: @fbnmtz, (fabiano.matoz@gmail.com)
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Version: 0.0.1.17
# ~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~·~·~·~·~·~·~·~~·~·~·~·~·~~·~·~·~·~·~·~·~
# Description:
# >
# ############################################################################
# HISTORY:
#
_xLIB_OPENBROWSER_=true
# default browser to use
BROWSERS=(qutebrowser chromium chrome firefox brave w3m)
BROWSER_RUN=$(getPath "${BROWSERS[@]}")
SEARCH_ENGINES=(
"https://www.google.com/search?q="
"https://duckduckgo.com/?q="
"https://searx.me/?q="
)
mpv_command(){
local MSOCK=~/.fbnmtz/mpv.sock
local MPLAYLIST=~/.fbnmtz/tmp/openbrowser-playlist
[ ! -f $MSOCK ] && touch $MSOCK
url=$1
if xdotool search --classname 'mpvOB'; then
echo "loadfile $url append" | socat - $MSOCK
echo "$url" >> $MPLAYLIST
else
[ -f $MPLAYLIST ] && rm $MPLAYLIST
mpv --x11-name='mpvOB' \
--profile=openbrowser \
--screenshot-template=~/videos/ytdl/img/%f-%n \
--input-ipc-server=$MSOCK \
$url
fi
}
isUrl(){
local query=$1
echo "$query" | grep --quiet -E '^https|^http|\.com|\.io|\.edu.br|\.br|\.net|\.org'
}
getDomain(){
local url=$1
echo "$url" | cut -d ':' -f2 | sed 's/\/\///' | cut -d '/' -f1 | sed 's/^www.//'
}