@@ -1,5 +1,8 @@
#!/bin/sh
#!/bin/sh
browser_cmd="brave-browser"
browser_new_cmd="brave-browser --new-window"
launch() {
launch() {
app=$(printf "Notes
app=$(printf "Notes
Files
Files
@@ -23,8 +26,8 @@ case $app in
LBRY) lbry;;
LBRY) lbry;;
Chat) element-desktop;;
Chat) element-desktop;;
Music) st -e ncmpcpp;;
Music) st -e ncmpcpp;;
Browser) brave-browser ;;
Email) brave-browser mail.protonmail.com/login;;
Browser) $browser_cmd ;;
Email) $browser_cmd mail.protonmail.com/login;;
Processes) st -e htop;;
Processes) st -e htop;;
esac
esac
}
}
@@ -37,6 +40,7 @@ action() {
Command to clipboard
Command to clipboard
Search github
Search github
Search ddg
Search ddg
Search godoc
Select VPN
Select VPN
Disable VPN
Disable VPN
Enable VPN
Enable VPN
@@ -54,6 +58,7 @@ case $action in
'Disable Bar') tmux set -g status off;;
'Disable Bar') tmux set -g status off;;
'Enable Bar') tmux set -g status on;;
'Enable Bar') tmux set -g status on;;
'Search github') github;;
'Search github') github;;
'Search godoc') godoc;;
'Search ddg') ddg;;
'Search ddg') ddg;;
'Command') cmd;;
'Command') cmd;;
'Command to clipboard') cmd_clip;;
'Command to clipboard') cmd_clip;;
@@ -85,11 +90,11 @@ both" |
}
}
search_type() {
search_type() {
search_string="$(printf "New window\nBookmarks\nHistory" | dmenu -p "ddg ")"
search_string="$(printf "New window\nBookmarks\nHistory" | dmenu -p "$1 ")"
search_mode='tab'
search_mode='tab'
case "$search_string" in
case "$search_string" in
'New window') search_mode='window'; search_string=$(printf '' | dmenu -p 'new ddg' );;
'New window') search_mode='window'; search_string=$(printf '' | dmenu -p "new $1" );;
'Bookmarks');;
'Bookmarks');;
'History') ;;
'History') ;;
# *) printf "Invalid argument";;
# *) printf "Invalid argument";;
@@ -99,15 +104,15 @@ search_type() {
brave_search() {
brave_search() {
search_prefix="$1"
search_prefix="$1"
search_info="$(search_type)"
search_info="$(search_type "$2" )"
search_string=$(printf "$search_info" | cut -d'|' -f1)
search_string=$(printf "$search_info" | cut -d'|' -f1)
search_mode=$(printf "$search_info" | cut -d'|' -f2)
search_mode=$(printf "$search_info" | cut -d'|' -f2)
if [ -z "$search_string" ]; then exit; fi
if [ -z "$search_string" ]; then exit; fi
new_string=$(rawurlencode "$search_string")
new_string=$(rawurlencode "$search_string")
search="$search_prefix$new_string"
search="$search_prefix$new_string"
case "$search_mode" in
case "$search_mode" in
tab) brave-browser "$search";;
window) brave-browser --new-window "$search";;
tab) $browser_cmd "$search";;
window) $browser_new_cmd "$search";;
esac
esac
}
}
@@ -132,11 +137,29 @@ rawurlencode() {
}
}
ddg() {
ddg() {
brave_search "https://duckduckgo.com/?q="
brave_search "https://duckduckgo.com/?q=" "ddg"
}
}
github() {
github() {
brave_search "https://github.com/search?q="
brave_search "https://github.com/search?q=" "github"
}
godoc() {
brave_search "https://golang.org/pkg/" "godoc"
}
manual() {
search=$(printf '' | dmenu -p 'manual')
result=$(man "$search")
printf "$result" | zathura -
# notify-send -u low -t 0 "Manual" "$result"
}
goinfo() {
#Maybe this can also show recent searches
search=$(printf '' | dmenu -p 'goinfo')
result=$(go doc "$search")
notify-send -u low -t -1 "Go documentation" "$result"
}
}
cmd() {
cmd() {
@@ -155,7 +178,10 @@ case $1 in
action) action;;
action) action;;
cmd) action;;
cmd) action;;
cmd_clip) cmd_clip;;
cmd_clip) cmd_clip;;
ddg) brave_search "https://duckduckgo.com/?q=";;
github) brave_search "https://github.com/search?q=";;
ddg) ddg;;
github) github;;
godoc) godoc;;
goinfo) goinfo;;
manual) manual;;
*) printf "Invalid argument";;
*) printf "Invalid argument";;
esac
esac