Skip to content

Instantly share code, notes, and snippets.

@christopheranderton
Last active May 3, 2017 13:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christopheranderton/f96197fad1c4a87ce2d78b8b9622cf86 to your computer and use it in GitHub Desktop.
Save christopheranderton/f96197fad1c4a87ce2d78b8b9622cf86 to your computer and use it in GitHub Desktop.
Launch and Search Functions using different macOS / OS X browsers using the Terminal + Search Google Images in your default browser using from the CLI.
# For use in your .bash_profile or .functions file
# -------------------------------------------------
# Search using single words
# Example: gchrome terminal
# Search using multiple words
# Example: gchrome "wopr terminal"
# Launch browser of choice
# Example: gchrome
# - Launch/Search in Google Chrome.app
gchrome () {
open -a "Google Chrome" "https://www.google.com/search?q=$1"
}
# - Launch/Search in Google Chrome Canary.app
gchromecanary () {
open -a "Google Chrome Canary" "https://www.google.com/search?q=$1"
}
# - Launch/Search in Opera.app
sopera () {
open -a "Opera" "https://www.google.com/search?q=$1"
}
# - Launch/Search in Opera Developer.app
soperadev () {
open -a "Opera Developer" "https://www.google.com/search?q=$1"
}
# - Launch/Search in Opera Beta.app
soperabeta () {
open -a "Opera Beta" "https://www.google.com/search?q=$1"
}
# - Launch/Search in Opera Neon.app
soperaneon () {
open -a "Opera Neon" "https://www.google.com/search?q=$1"
}
# - Launch/Search in Firefox.app
sfirefox () {
open -a "Firefox" "https://www.google.com/search?q=$1"
}
# - Launch/Search in FirefoxDeveloperEdition.app
sfirefoxdev () {
open -a "FirefoxDeveloperEdition" "https://www.google.com/search?q=$1"
}
# - Launch/Search in Safari.app
safari () {
open -a "Safari" "https://www.google.com/search?q=$1"
}
# - Launch/Search in WebKit.app
webkit () {
open -a "WebKit" "https://www.google.com/search?q=$1"
}
# - Search Google Images and display results in the default browser
gimage() {
/usr/bin/open "https://www.google.com/search?q=$1&hl=en&site=imghp&tbs=imgo:1&tbm=isch&tbas=0&source=lnt&sa=X&ved=0ahUKEwiyhoaO39PTAhVF8ywKHX-DAOYQpwUIHA&biw=1425&bih=787&dpr=3";
}
# - Search Google Images for Large Images and display results in the default browser
gimagelarge() {
/usr/bin/open "https://www.google.com/search?q=$1&hl=en&site=imghp&tbs=isz:l,imgo:1&tbm=isch&source=lnt&sa=X&ved=0ahUKEwjXq57k3tPTAhXCKCwKHazOACkQpwUIHA&biw=1425&bih=787&dpr=3";
}
# - Search Google Images for tranparent Large Images and display results in the default browser
gimagelargetrans() {
/usr/bin/open "https://www.google.com/search?q=$1&hl=en&site=imghp&tbs=isz:l,imgo:1,ic:trans&tbm=isch&source=lnt&sa=X&ved=0ahUKEwj3h7G54NPTAhUGBSwKHe0_BRMQpwUIHA&biw=1221&bih=674&dpr=3.5";
}
# - Search Google Images for 2MP Images and display results in the default browser
gimage2mp() {
/usr/bin/open "https://www.google.com/search?q=$1&hs=7mW&biw=1661&bih=828&tbs=isz:lt,islt:2mp,imgo:1&tbm=isch&source=lnt&sa=X&ved=0ahUKEwi498CwwaPSAhXJQJoKHSn8AM0QpwUIGg&dpr=3";
}
# - Search Google Images for tranparent 2MP Images and display results in the default browser
gimage2mptrans() {
/usr/bin/open "https://www.google.com/search?q=$1&biw=1661&bih=828&tbs=imgo:1,isz:lt,islt:2mp,ic:trans&tbm=isch&source=lnt&sa=X&ved=0ahUKEwim6Lm7w6PSAhXBK5oKHa7JDiEQpwUIGg&dpr=3";
}
# - Search Google Images for 4MP Images and display results in the default browser
gimage4mp() {
/usr/bin/open "https://www.google.com/search?q=$1&hs=7mW&biw=1661&bih=828&tbs=isz:lt,islt:4mp,imgo:1&tbm=isch&source=lnt&sa=X&ved=0ahUKEwi498CwwaPSAhXJQJoKHSn8AM0QpwUIGg&dpr=3";
}
# - Search Google Images for tranparent 4MP Images and display results in the default browser
gimage4mptrans() {
/usr/bin/open "https://www.google.com/search?q=$1&biw=1661&bih=828&tbs=imgo:1,isz:lt,islt:4mp,ic:trans&tbm=isch&source=lnt&sa=X&ved=0ahUKEwim6Lm7w6PSAhXBK5oKHa7JDiEQpwUIGg&dpr=3";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment