Removed browser config, using default browser only with xdg-open

This commit is contained in:
Vico 2025-04-11 03:23:28 +02:00
parent 90c6a1bf38
commit 5884abce16
2 changed files with 3 additions and 26 deletions

View File

@ -44,7 +44,6 @@ On first run, the script creates a config file at:
```
log_file: /logs/shrtrun.log
browser: firefox
search_engine: https://duckduckgo.com/?q=
youtube_search: https://www.youtube.com/results?search_query=
```
@ -76,14 +75,8 @@ This lets you recall previous commands easily when relaunching shrtrun. Only suc
- 🐧 **Debian/Ubuntu:** `sudo apt install rofi xdg-utils libnotify-bin`
- 🐧 **Arch/Manjaro:** `sudo pacman -S rofi xdg-utils libnotify`
- 🐧 **Fedora:** `sudo dnf install rofi xdg-utils libnotify`
## 🎨 Customization Ideas
- Add new command prefixes (e.g., `!r` for Reddit)
- 🎨 Change styling in `rofi` config
- 🌐 Sync history across machines
- 🐧 **openSUSE:** `sudo zypper install rofi xdg-utils libnotify`
---
📝 **GPL License** This project is licensed under the GNU General Public License. See the LICENSE file for more details. 🧾
📝 **GPL License** This project is licensed under the GNU General Public License. See the LICENSE file for more details. 🧾

View File

@ -12,7 +12,6 @@ if [ ! -f "$CONFIG_FILE" ]; then
cat > "$CONFIG_FILE" << EOF
# Quick Launcher Configuration
log_file: /logs/shrtrun.log
browser: firefox
search_engine: https://duckduckgo.com/?q=
youtube_search: https://www.youtube.com/results?search_query=
EOF
@ -32,7 +31,6 @@ get_config_value() {
}
# Get configuration values
BROWSER=$(get_config_value "browser" "firefox")
SEARCH_ENGINE=$(get_config_value "search_engine" "https://duckduckgo.com/?q=")
YOUTUBE_SEARCH=$(get_config_value "youtube_search" "https://www.youtube.com/results?search_query=")
LOG_FILE=$(get_config_value "log_file" "/.logs/shrtrun.log")
@ -93,21 +91,7 @@ if [[ "$USER_INPUT" == \!* ]]; then
# Format the search URL
SEARCH_URL="${SEARCH_ENGINE}${QUERY// /+}"
echo "$(date): Opening search URL: $SEARCH_URL" >> "$LOG_FILE"
# Try multiple methods to open the browser
if command -v "$BROWSER" &> /dev/null; then
"$BROWSER" "$SEARCH_URL" &
elif command -v xdg-open &> /dev/null; then
xdg-open "$SEARCH_URL" &
else
# Try common browsers
for browser in firefox google-chrome chromium-browser brave-browser; do
if command -v "$browser" &> /dev/null; then
"$browser" "$SEARCH_URL" &
break
fi
done
fi
xdg-open "$SEARCH_URL" &> /dev/null &
disown
# Append to history
echo "$USER_INPUT" >> "$HISTORY_FILE"