-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmenu-browser-search
executable file
·56 lines (50 loc) · 1.23 KB
/
dmenu-browser-search
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
#!/usr/bin/env bash
options=(
"amazon"
"amazon prime music"
"amazon prime videos"
"chat gpt"
"classsroom"
"codeforces"
"discord"
"github"
"gmail"
"linkedin"
"whatsapp"
"youtube"
)
options_urls=(
"https://www.amazon.in/"
"https://music.amazon.in/my/library"
"https://www.primevideo.com/"
"https://chat.openai.com/"
"https://classroom.google.com/u/1/h"
"https://codeforces.com/"
"https://discord.com/channels/@me"
"https://github.com/"
"https://mail.google.com/"
"https://www.linkedin.com/feed/"
"https://web.whatsapp.com/"
"https://www.youtube.com/"
)
url=$(printf "%s\n" "${options[@]}" | dmenu -i -sb purple -p "Search Term " -l 15 -nb black)
if [ -n "$url" ]; then
#OPTIONAL : i3 config to open window in workspace 2
i3-msg "workspace 2"
index=0
flag=0
for search in "${options[@]}"; do
if [ "$search" = "$url" ]; then
url="${options_urls[index]}"
flag=1
break
fi
((index++))
done
if [ "$flag" == 0 ]; then
url="https://www.google.com/search?q=$(echo "$url" | sed 's/ /+/g')"
google-chrome -incognito "$url"
else
google-chrome "$url"
fi
fi