rofi: Format rofi-surfraw with shellcheck
This commit is contained in:
parent
34fca7670f
commit
377ab6ea56
1 changed files with 36 additions and 35 deletions
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# source surfraw config
|
# source surfraw config
|
||||||
source $HOME/.surfraw.conf
|
source $HOME/.surfraw.conf
|
||||||
|
@ -23,7 +23,7 @@ fi
|
||||||
if [[ $@ == *"--no-list"* ]]; then
|
if [[ $@ == *"--no-list"* ]]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
# list=$(sr -elvi | awk '{ print "?"$1 }' | tail -n +2)
|
# list=$(sr -elvi | awk '{ print "?"$1 }' | tail -n +2)
|
||||||
list=$(sr -elvi | awk '{if (NR!=1) print "?"$1 }')
|
list=$(sr -elvi | awk '{if (NR!=1) print "?"$1 }')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -31,19 +31,20 @@ fi
|
||||||
if [[ $@ == *"--no-custom"* ]]; then
|
if [[ $@ == *"--no-custom"* ]]; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
# custom=$(cat $HOME/.config/rofi-surfraw/searchengines | awk -F ' - ' '{ print $1 }')
|
# custom=$(cat $HOME/.config/rofi-surfraw/searchengines | awk -F ' - ' '{ print $1 }')
|
||||||
custom=$(awk -F ' - ' '{ print $1 }' $HOME/.config/rofi-surfraw/searchengines)
|
custom=$(awk -F ' - ' '{ print $1 }' $HOME/.config/rofi-surfraw/searchengines)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
main () {
|
main() {
|
||||||
# Draw Menu
|
# Draw Menu
|
||||||
HELP_MSG="<span color=\"$help_color\">Hit Ctrl+Space to complete Engine Name
|
HELP_MSG="<span color=\"$help_color\">Hit Ctrl+Space to complete Engine Name
|
||||||
Searches without prepended engine use "${default}"</span>"
|
Searches without prepended engine use "${default}"</span>"
|
||||||
elvi=$(echo -e "${list}\n${custom}" | rofi -dmenu -mesg "${HELP_MSG}" -p "Search > ")
|
elvi=$(echo -e "${list}\n${custom}" | rofi -dmenu -mesg "${HELP_MSG}" -p "Search > ")
|
||||||
|
|
||||||
# Some logic
|
# Some logic
|
||||||
if [[ $elvi == "" ]]; then exit
|
if [[ $elvi == "" ]]; then
|
||||||
elif [[ $elvi == "!"* ]]; then
|
exit
|
||||||
|
elif [[ $elvi == "!"* ]]; then
|
||||||
entry=$(grep "$(echo "${elvi}" | awk '{ print $1 }')" "$HOME/.config/rofi-surfraw/searchengines")
|
entry=$(grep "$(echo "${elvi}" | awk '{ print $1 }')" "$HOME/.config/rofi-surfraw/searchengines")
|
||||||
method=$(echo "${entry}" | awk -F ' - ' '{ print $2 }')
|
method=$(echo "${entry}" | awk -F ' - ' '{ print $2 }')
|
||||||
bang=$(echo "${entry}" | awk -F ' - ' '{ print $3 }')
|
bang=$(echo "${entry}" | awk -F ' - ' '{ print $3 }')
|
||||||
|
@ -53,11 +54,11 @@ elif [[ $elvi == "!"* ]]; then
|
||||||
elif [[ $method == "custom" ]]; then
|
elif [[ $method == "custom" ]]; then
|
||||||
"$SURFRAW_graphical_browser" $SURFRAW_graphical_browser_args ${bang}"${search}"
|
"$SURFRAW_graphical_browser" $SURFRAW_graphical_browser_args ${bang}"${search}"
|
||||||
fi
|
fi
|
||||||
elif [[ $elvi == "?"* ]]; then
|
elif [[ $elvi == "?"* ]]; then
|
||||||
name=$(echo "${elvi}" | awk '{ print $1 }' | cut -c 2-)
|
name=$(echo "${elvi}" | awk '{ print $1 }' | cut -c 2-)
|
||||||
search=$(echo "${elvi}" | awk '{$1=""; print $0}' | cut -c 2-)
|
search=$(echo "${elvi}" | awk '{$1=""; print $0}' | cut -c 2-)
|
||||||
sr ${name} ${search}
|
sr ${name} ${search}
|
||||||
else
|
else
|
||||||
if [[ $default == "!"* ]]; then
|
if [[ $default == "!"* ]]; then
|
||||||
entry=$(grep "$(echo "${default}" | awk '{ print $1 }')" "$HOME/.config/rofi-surfraw/searchengines")
|
entry=$(grep "$(echo "${default}" | awk '{ print $1 }')" "$HOME/.config/rofi-surfraw/searchengines")
|
||||||
method=$(echo "${entry}" | awk -F ' - ' '{ print $2 }')
|
method=$(echo "${entry}" | awk -F ' - ' '{ print $2 }')
|
||||||
|
@ -72,7 +73,7 @@ else
|
||||||
elif [[ $method == "custom" ]]; then
|
elif [[ $method == "custom" ]]; then
|
||||||
"$SURFRAW_graphical_browser" $SURFRAW_graphical_browser_args ${bang}"${search}"
|
"$SURFRAW_graphical_browser" $SURFRAW_graphical_browser_args ${bang}"${search}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $1 == "--help" ]]; then
|
if [[ $1 == "--help" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue