Skip to content

Instantly share code, notes, and snippets.

@naranyala
Created November 20, 2023 09:46
Show Gist options
  • Save naranyala/bc496b23f2ed97685868eaa3a9f8869a to your computer and use it in GitHub Desktop.
Save naranyala/bc496b23f2ed97685868eaa3a9f8869a to your computer and use it in GitHub Desktop.
#!/bin/bash
declare -A websites
websites["google"]="https://www.google.com"
websites["twitter"]="https://twitter.com"
# Get website names as a list
website_names=$(printf "%s\n" "${!websites[@]}")
# Use Rofi to select a website
selected_website_name=$(echo "$website_names" | rofi -dmenu -p "Select a website:")
# Get the corresponding URL using the selected website name
selected_website_url="${websites[$selected_website_name]}"
# Open the selected website in the default web browser
if [[ -n $selected_website_url ]]; then
xdg-open "$selected_website_url"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment