Skip to content

dvinay/custom_search_shortcuts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Custom Search Shortcuts

A Chrome extension that adds customizable search shortcuts to your right-click context menu. Quickly search selected text across multiple search engines and websites with support for environment variables and dynamic URL templates.

Chrome Extension Manifest V3 License

✨ Features

  • Custom Search Engines: Add unlimited custom search URLs to your context menu
  • Environment Variables: Define variables with different values for dev, test, and prod environments
  • Dynamic URL Templates: Use {{variable}} syntax to create flexible search URLs
  • Right-Click Integration: Seamlessly integrated into Chrome's context menu
  • Import/Export: Backup and share your search configurations
  • Easy Management: User-friendly options page for managing searches and environments
  • Manifest V3: Built with the latest Chrome extension standards

πŸš€ Installation

From Chrome Web Store

(Coming soon)

Manual Installation (Developer Mode)

  1. Download or clone this repository:

    git clone https://github.com/yourusername/custom-search-shortcuts.git
  2. Open Chrome and navigate to chrome://extensions/

  3. Enable Developer mode (toggle in top-right corner)

  4. Click Load unpacked

  5. Select the extension directory

  6. The extension icon should appear in your toolbar!

πŸ“– Usage Walkthrough (with screenshots)

  1. Open the extension popup

Open extension popup – Manage Custom Searches

  1. Options page (initial view) Options page – initial view

  2. Add a new search URL Add a new search URL

  3. Use the custom search from the page Use custom shortcut

  4. Add a variable (for environment-aware URLs) Add a new variable

  5. Create environments

    1. Add a new environment Add a new environment

    2. Add a environment with default value New environment with default value

    3. Add multiple environments Add multiple environments

  6. Create a URL that uses a variable Add URL with variable

  7. Final configuration Final configurations

  8. Use environment-specific search Use custom shortcut with environments and variables

Basic Search

  1. Add a Search Engine:

    • Click the extension icon or right-click and select "Manage Custom Searches"
    • Enter a name (e.g., "Google")
    • Enter a URL with %s as the search placeholder:
      https://www.google.com/search?q=%s
      
    • Click "Add URL"
  2. Use Your Search:

    • Select any text on a webpage
    • Right-click β†’ Custom Search β†’ Select your search engine
    • A new tab opens with your search results

Advanced: Environment Variables

Perfect for developers who need to search across different environments (dev, staging, production).

Example Use Case: API Documentation Search

  1. Define a Variable:

    • Go to Options β†’ Variables section
    • Variable name: api_host
    • Default value: api.example.com
    • Click "Add Variable"
  2. Create Environments:

    • Go to Options β†’ Environments section
    • Add environments:
      • Dev: api_host = dev-api.example.com
      • Test: api_host = test-api.example.com
      • Prod: api_host = api.example.com
  3. Create Search URL with Variable:

    • Name: "API Docs"
    • URL: https://{{api_host}}/docs/search?q=%s
    • Click "Add URL"
  4. Use Environment-Specific Search:

    • Select text on a webpage
    • Right-click β†’ Custom Search β†’ API Docs β†’ Choose environment (Dev/Test/Prod)
    • Opens the correct environment's documentation

πŸ› οΈ Development

Project Structure

custom-search-shortcuts/
β”œβ”€β”€ manifest.json          # Extension configuration
β”œβ”€β”€ background.js          # Service worker (context menu logic)
β”œβ”€β”€ popup.html            # Extension popup UI
β”œβ”€β”€ popup.js              # Popup functionality
β”œβ”€β”€ options.html          # Options page UI
β”œβ”€β”€ options.js            # Options page logic
β”œβ”€β”€ icons/                # Extension icons
β”‚   β”œβ”€β”€ icon16.png
β”‚   β”œβ”€β”€ icon48.png
β”‚   └── icon128.png
β”œβ”€β”€ LICENSE               # MIT License
└── README.md            # This file

Key Files

  • manifest.json: Extension metadata and permissions
  • background.js: Handles context menu creation and click events
  • options.js: Manages URL, variable, and environment configuration
  • popup.js: Simple popup with link to options page

Permissions

  • contextMenus: Create right-click menu items
  • storage: Save user configurations (synced across devices)

Building & Testing

  1. Make your changes to the code

  2. Update version in manifest.json:

    "version": "1.0.1"
  3. Test locally:

    • Go to chrome://extensions/
    • Click the refresh icon on your extension
    • Test on various websites
  4. Create test URLs using the examples in the Testing Guide

Testing

Test your extension with various scenarios:

Basic Text Selection:

  • Simple ASCII text
  • Unicode characters (cafΓ©, εŒ—δΊ¬, πŸ˜€)
  • Special characters (&, ?, #, %)

Different Page Types:

  • Static HTML pages
  • Single-page applications (SPAs)
  • Content-editable areas

Environment Variables:

  • URLs with single variable
  • URLs with multiple variables
  • Missing variable definitions
  • Empty environment values

Test URLs:

Dev:     http://localhost:3000/test.html
Test:    https://staging.yourdomain.com/
Prod:    https://yourdomain.com/

πŸ“¦ Export/Import Configuration

Export

  1. Go to Options page
  2. Click Export Configuration
  3. Save the JSON file

Import

  1. Go to Options page
  2. Click Import Configuration
  3. Select your JSON file
  4. Your searches, variables, and environments are restored

Configuration Format

{
  "urls": [
    {
      "id": "custom-search-1234567890",
      "name": "Google",
      "url": "https://www.google.com/search?q=%s"
    }
  ],
  "variables": [
    {
      "name": "api_host",
      "defaultValue": "api.example.com"
    }
  ],
  "environments": [
    {
      "id": "env-1234567890",
      "name": "Dev",
      "values": [
        {
          "key": "api_host",
          "value": "dev-api.example.com"
        }
      ]
    }
  ]
}

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
  3. Commit your changes:
    git commit -m 'Add amazing feature'
  4. Push to the branch:
    git push origin feature/amazing-feature
  5. Open a Pull Request

Contribution Guidelines

  • Follow existing code style
  • Test thoroughly before submitting
  • Update documentation for new features
  • Keep commits focused and descriptive
  • Add comments for complex logic

πŸ› Bug Reports & Feature Requests

Found a bug or have an idea? Please open an issue on GitHub:

  1. Check if the issue already exists
  2. Provide detailed description
  3. Include steps to reproduce (for bugs)
  4. Add screenshots if applicable
  5. Specify Chrome version and OS

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2025 Vinay Chowdary Duvvada

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Disclaimer

This extension is provided β€œas is” without warranty of any kind, express or implied. Use at your own risk. The authors are not responsible for any data loss, security issues, policy violations, or damages arising from the use of this software.

Third‑party websites and services referenced by your custom search URLs are owned and operated by their respective providers. This project is not affiliated with, endorsed by, or sponsored by any third parties (including Google, Amazon, GitHub, etc.). Always review and comply with the terms of service and robots/usage policies of the websites you query. Be careful when creating URLs that include sensitive information (such as tokens, secrets, or personal data). Do not store or share sensitive data in plain text. If you distribute this extension, you are responsible for ensuring compliance with the Chrome Web Store policies and all applicable laws and regulations in your jurisdiction.

πŸ™ Acknowledgments

  • Built with Chrome Extension Manifest V3
  • Icons designed for clarity and simplicity
  • Inspired by the need for quick, customizable web searches

πŸ“ž Support

πŸ“Š Version History

v1.0.0 (Upcoming)

  • Initial public release
  • Custom search URLs
  • Environment variables support
  • Import/Export functionality
  • Context menu integration

Made with ❀️ by Vinay Duvvada

⭐ Star this repo if you find it useful!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published