Compare commits

..

No commits in common. "fa768380c4aeda7001b5a746ed54b7730e567ec6" and "5884abce16409da9adafbd39d889e7a638f66bac" have entirely different histories.

2 changed files with 11 additions and 14 deletions

View File

@ -48,8 +48,6 @@ search_engine: https://duckduckgo.com/?q=
youtube_search: https://www.youtube.com/results?search_query=
```
Info: file paths are relative to your home directory.
## 🧑‍💻 Usage
- 💬 **Regular Commands:** Type any shell command and hit Enter to execute it.

View File

@ -11,7 +11,7 @@ mkdir -p "$CONFIG_DIR"
if [ ! -f "$CONFIG_FILE" ]; then
cat > "$CONFIG_FILE" << EOF
# Quick Launcher Configuration
log_file: /.logs/shrtrun.log
log_file: /logs/shrtrun.log
search_engine: https://duckduckgo.com/?q=
youtube_search: https://www.youtube.com/results?search_query=
EOF
@ -30,14 +30,6 @@ get_config_value() {
fi
}
save_to_history() {
cmd="$1"
LAST_HISTORY=$(tail -n 1 "$HISTORY_FILE" 2>/dev/null)
if [ "$cmd" != "$LAST_HISTORY" ]; then
echo "$cmd" >> "$HISTORY_FILE"
fi
}
# Get configuration values
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=")
@ -80,6 +72,13 @@ source "$HOME/.profile" 2>/dev/null
source "$HOME/.bashrc" 2>/dev/null
source "$HOME/.bashrc_aliases" 2>/dev/null
# Avoid duplicate consecutive entries
if [ -n "$USER_INPUT" ]; then
LAST_HISTORY=$(tail -n 1 "$HISTORY_FILE")
if [ "$USER_INPUT" != "$LAST_HISTORY" ]; then
echo "$USER_INPUT" >> "$HISTORY_FILE"
fi
fi
# Check for command
if [[ "$USER_INPUT" == \!* ]]; then
@ -95,7 +94,7 @@ if [[ "$USER_INPUT" == \!* ]]; then
xdg-open "$SEARCH_URL" &> /dev/null &
disown
# Append to history
save_to_history "$USER_INPUT"
echo "$USER_INPUT" >> "$HISTORY_FILE"
;;
y)
# YouTube search
@ -104,7 +103,7 @@ if [[ "$USER_INPUT" == \!* ]]; then
xdg-open "$YOUTUBE_URL" &>/dev/null &
disown
# Append to history
save_to_history "$USER_INPUT"
echo "$USER_INPUT" >> "$HISTORY_FILE"
;;
*)
show_notification "Unknown Command" "The command '$CMD_TYPE' is not recognized"
@ -117,7 +116,7 @@ else
# Execute in background and disown
if eval "$USER_INPUT" &>/dev/null & then
disown
save_to_history "$USER_INPUT"
echo "$USER_INPUT" >> "$HISTORY_FILE"
else
show_notification "Command Failed" "'$USER_INPUT' could not be executed."
fi