mirror of
https://github.com/Lissy93/dotfiles.git
synced 2024-11-22 07:23:10 +01:00
Updates web-search and welcome-banner
This commit is contained in:
parent
300f426b15
commit
20467f3a8c
@ -91,6 +91,9 @@ ws_reddit() {
|
|||||||
ws_maps() {
|
ws_maps() {
|
||||||
ws_make_search 'https://www.google.com/maps/search/' $@
|
ws_make_search 'https://www.google.com/maps/search/' $@
|
||||||
}
|
}
|
||||||
|
ws_grepapp() {
|
||||||
|
ws_make_search 'https://grep.app/search?q=' $@
|
||||||
|
}
|
||||||
|
|
||||||
# Lists availible search options
|
# Lists availible search options
|
||||||
web_search() {
|
web_search() {
|
||||||
@ -106,6 +109,7 @@ web_search() {
|
|||||||
[[ $@ == "reddit"* ]] && ws_reddit "${@/reddit/}" && return
|
[[ $@ == "reddit"* ]] && ws_reddit "${@/reddit/}" && return
|
||||||
[[ $@ == "maps"* ]] && ws_maps "${@/maps/}" && return
|
[[ $@ == "maps"* ]] && ws_maps "${@/maps/}" && return
|
||||||
[[ $@ == "google"* ]] && ws_google "${@/google/}" && return
|
[[ $@ == "google"* ]] && ws_google "${@/google/}" && return
|
||||||
|
[[ $@ == "grepapp"* ]] && ws_grepapp "${@/grepapp/}" && return
|
||||||
fi
|
fi
|
||||||
# Otherwise show menu input for search engines
|
# Otherwise show menu input for search engines
|
||||||
choices=(
|
choices=(
|
||||||
@ -124,6 +128,7 @@ web_search() {
|
|||||||
wolframalpha) ws_wolframalpha $@; return;;
|
wolframalpha) ws_wolframalpha $@; return;;
|
||||||
reddit) ws_reddit $@; return;;
|
reddit) ws_reddit $@; return;;
|
||||||
maps) ws_maps $@; return;;
|
maps) ws_maps $@; return;;
|
||||||
|
grepapp) ws_grepapp $@; return;;
|
||||||
help) show_ws_help;;
|
help) show_ws_help;;
|
||||||
quit) break ;;
|
quit) break ;;
|
||||||
*)
|
*)
|
||||||
@ -144,6 +149,7 @@ alias wswa='ws_wolframalpha'
|
|||||||
alias wsrdt='ws_reddit'
|
alias wsrdt='ws_reddit'
|
||||||
alias wsmap='ws_maps'
|
alias wsmap='ws_maps'
|
||||||
alias wsggl='ws_google'
|
alias wsggl='ws_google'
|
||||||
|
alias wsgra='ws_grepapp'
|
||||||
|
|
||||||
# Set ws alias, only if not used by another program
|
# Set ws alias, only if not used by another program
|
||||||
if ! hash ws 2> /dev/null; then
|
if ! hash ws 2> /dev/null; then
|
||||||
@ -177,14 +183,15 @@ show_ws_help() {
|
|||||||
echo -e ' \033[0;35mReddit: \x1b[2m$ ws reddit or ($ wsrdt)\e[0m'
|
echo -e ' \033[0;35mReddit: \x1b[2m$ ws reddit or ($ wsrdt)\e[0m'
|
||||||
echo -e ' \033[0;35mMaps: \x1b[2m$ ws maps or ($ wsmap)\e[0m'
|
echo -e ' \033[0;35mMaps: \x1b[2m$ ws maps or ($ wsmap)\e[0m'
|
||||||
echo -e ' \033[0;35mGoogle: \x1b[2m$ ws google or ($ wsggl)\e[0m'
|
echo -e ' \033[0;35mGoogle: \x1b[2m$ ws google or ($ wsggl)\e[0m'
|
||||||
|
echo -e ' \033[0;35mGoogle: \x1b[2m$ ws grepapp or ($ wsgra)\e[0m'
|
||||||
echo -e '\e[0m'
|
echo -e '\e[0m'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine if file is being run directly or sourced
|
# Determine if file is being run directly or sourced
|
||||||
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] ||
|
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] ||
|
||||||
[[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" &&
|
[[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" &&
|
||||||
printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] ||
|
printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] ||
|
||||||
[[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)) && sourced=1 || sourced=0
|
[[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)) && sourced=1 || sourced=0
|
||||||
|
|
||||||
# If running directly, then show menu, or help
|
# If running directly, then show menu, or help
|
||||||
if [ $sourced -eq 0 ]; then
|
if [ $sourced -eq 0 ]; then
|
||||||
|
@ -1,60 +1,74 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Welcome script, prints time-based greeting and system info
|
# Welcome script, prints personalised, time-based greeting and system info
|
||||||
# Licensed under MIT, (C) Alicia Sykes 2021: https://aliciasykes.com
|
# Licensed under MIT, (C) Alicia Sykes 2021: https://aliciasykes.com
|
||||||
|
|
||||||
# Determine greeting based on the time of day
|
function welcome() {
|
||||||
h=`date +%H`
|
# Determine greeting based on the time of day
|
||||||
if [ $h -lt 04 ] || [[ $h -gt 22 ]]; then greeting="Good Night"
|
h=`date +%H`
|
||||||
elif [ $h -lt 12 ]; then greeting="Good morning"
|
if [ $h -lt 04 ] || [[ $h -gt 22 ]]; then greeting="Good Night"
|
||||||
elif [ $h -lt 18 ]; then greeting="Good afternoon"
|
elif [ $h -lt 12 ]; then greeting="Good morning"
|
||||||
elif [ $h -lt 22 ]; then greeting="Good evening"
|
elif [ $h -lt 18 ]; then greeting="Good afternoon"
|
||||||
else greeting="Hello"
|
elif [ $h -lt 22 ]; then greeting="Good evening"
|
||||||
|
else greeting="Hello"
|
||||||
|
fi
|
||||||
|
|
||||||
|
COLOR_P="\033[1;36m"
|
||||||
|
COLOR_S="\033[0;36m"
|
||||||
|
|
||||||
|
# Format user's name
|
||||||
|
name=$(echo "$USER" | sed 's/.*/\u&/')
|
||||||
|
|
||||||
|
# Make welcome message
|
||||||
|
WELCOME_MSG="$greeting $name!"
|
||||||
|
|
||||||
|
# Print welcome message, using figlet & lolcat if availible
|
||||||
|
if hash lolcat 2>/dev/null && hash figlet 2>/dev/null; then
|
||||||
|
echo "${WELCOME_MSG}" | figlet | lolcat
|
||||||
|
else
|
||||||
|
echo -e "$COLOR_P${WELCOME_MSG}\033[0m\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print system information with neofetch, if it's installed
|
||||||
|
if hash neofetch 2>/dev/null; then
|
||||||
|
neofetch --shell_version off \
|
||||||
|
--disable shell resolution de wm wm_theme theme icons terminal \
|
||||||
|
--backend off \
|
||||||
|
--colors 4 8 4 4 8 6 \
|
||||||
|
--color_blocks off \
|
||||||
|
--memory_display info
|
||||||
|
fi
|
||||||
|
|
||||||
|
timeout=0.5
|
||||||
|
|
||||||
|
echo -e "\033[1;34mToday\n------"
|
||||||
|
|
||||||
|
# Print date time
|
||||||
|
echo -e "$COLOR_S$(date '+🗓️ Date: %A, %B %d, %Y at %H:%M') \033[0m"
|
||||||
|
|
||||||
|
# Print local weather
|
||||||
|
echo -en $COLOR_S
|
||||||
|
curl -s -m $timeout "wttr.in?format=%cWeather:+%C+%t,+%p+%w"
|
||||||
|
echo -e "\033[0m"
|
||||||
|
|
||||||
|
# Print IP address
|
||||||
|
ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
|
||||||
|
ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
|
||||||
|
echo -en "$COLOR_S🌐 IP: "
|
||||||
|
curl -s -m $timeout "https://ipinfo.io/ip"
|
||||||
|
echo -en " (${ip_address} on ${ip_interface})\033[0m\n"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# Determine if file is being run directly or sourced
|
||||||
|
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] ||
|
||||||
|
[[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" &&
|
||||||
|
printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] ||
|
||||||
|
[[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)) && sourced=1 || sourced=0
|
||||||
|
|
||||||
|
# If script being called directly run immediatley
|
||||||
|
if [ $sourced -eq 0 ]; then
|
||||||
|
welcome $@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
COLOR_P="\033[1;36m"
|
|
||||||
COLOR_S="\033[0;36m"
|
|
||||||
|
|
||||||
# Format user's name
|
|
||||||
name=$(echo "$USER" | sed 's/.*/\u&/')
|
|
||||||
|
|
||||||
# Make welcome message
|
|
||||||
WELCOME_MSG="$greeting $name!"
|
|
||||||
|
|
||||||
# Print welcome message, using figlet & lolcat if availible
|
|
||||||
if hash lolcat 2>/dev/null && hash figlet 2>/dev/null; then
|
|
||||||
echo "${WELCOME_MSG}" | figlet | lolcat
|
|
||||||
else
|
|
||||||
echo -e "$COLOR_P${WELCOME_MSG}\033[0m\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Print system information with neofetch, if it's installed
|
|
||||||
if hash neofetch 2>/dev/null; then
|
|
||||||
neofetch --shell_version off \
|
|
||||||
--disable shell resolution de wm wm_theme theme icons terminal \
|
|
||||||
--backend off \
|
|
||||||
--colors 4 8 4 4 8 6 \
|
|
||||||
--color_blocks off \
|
|
||||||
--memory_display info
|
|
||||||
fi
|
|
||||||
|
|
||||||
timeout=0.5
|
|
||||||
|
|
||||||
echo -e "\033[1;34mToday\n------"
|
|
||||||
|
|
||||||
# Print date time
|
|
||||||
echo -e "$COLOR_S$(date '+🗓️ Date: %A, %B %d, %Y at %H:%M') \033[0m"
|
|
||||||
|
|
||||||
# Print local weather
|
|
||||||
echo -en $COLOR_S
|
|
||||||
curl -s -m $timeout "wttr.in?format=%cWeather:+%C+%t,+%p+%w"
|
|
||||||
echo -e "\033[0m"
|
|
||||||
|
|
||||||
# Print IP address
|
|
||||||
ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
|
|
||||||
ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
|
|
||||||
echo -en "$COLOR_S🌐 IP: "
|
|
||||||
curl -s -m $timeout "https://ipinfo.io/ip"
|
|
||||||
echo -en " (${ip_address} on ${ip_interface})\033[0m\n"
|
|
||||||
|
|
||||||
# EOF
|
# EOF
|
||||||
|
@ -13,6 +13,7 @@ if !filereadable(expand(vim_plug_location))
|
|||||||
echom "Vim Plug not found, downloading to '" . vim_plug_location . "'"
|
echom "Vim Plug not found, downloading to '" . vim_plug_location . "'"
|
||||||
execute '!curl -o ' . vim_plug_location . ' --create-dirs' .
|
execute '!curl -o ' . vim_plug_location . ' --create-dirs' .
|
||||||
\ ' https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
\ ' https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
|
echom "Next, run :PlugInstall to install all plugins"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" If Plugins directory not yet exist, create it
|
" If Plugins directory not yet exist, create it
|
||||||
|
Loading…
Reference in New Issue
Block a user