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= youtube_search: https://www.youtube.com/results?search_query=
``` ```
Info: file paths are relative to your home directory.
## 🧑‍💻 Usage ## 🧑‍💻 Usage
- 💬 **Regular Commands:** Type any shell command and hit Enter to execute it. - 💬 **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 if [ ! -f "$CONFIG_FILE" ]; then
cat > "$CONFIG_FILE" << EOF cat > "$CONFIG_FILE" << EOF
# Quick Launcher Configuration # Quick Launcher Configuration
log_file: /.logs/shrtrun.log log_file: /logs/shrtrun.log
search_engine: https://duckduckgo.com/?q= search_engine: https://duckduckgo.com/?q=
youtube_search: https://www.youtube.com/results?search_query= youtube_search: https://www.youtube.com/results?search_query=
EOF EOF
@ -30,14 +30,6 @@ get_config_value() {
fi 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 # Get configuration values
SEARCH_ENGINE=$(get_config_value "search_engine" "https://duckduckgo.com/?q=") 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=") 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" 2>/dev/null
source "$HOME/.bashrc_aliases" 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 # Check for command
if [[ "$USER_INPUT" == \!* ]]; then if [[ "$USER_INPUT" == \!* ]]; then
@ -95,7 +94,7 @@ if [[ "$USER_INPUT" == \!* ]]; then
xdg-open "$SEARCH_URL" &> /dev/null & xdg-open "$SEARCH_URL" &> /dev/null &
disown disown
# Append to history # Append to history
save_to_history "$USER_INPUT" echo "$USER_INPUT" >> "$HISTORY_FILE"
;; ;;
y) y)
# YouTube search # YouTube search
@ -104,7 +103,7 @@ if [[ "$USER_INPUT" == \!* ]]; then
xdg-open "$YOUTUBE_URL" &>/dev/null & xdg-open "$YOUTUBE_URL" &>/dev/null &
disown disown
# Append to history # Append to history
save_to_history "$USER_INPUT" echo "$USER_INPUT" >> "$HISTORY_FILE"
;; ;;
*) *)
show_notification "Unknown Command" "The command '$CMD_TYPE' is not recognized" show_notification "Unknown Command" "The command '$CMD_TYPE' is not recognized"
@ -117,7 +116,7 @@ else
# Execute in background and disown # Execute in background and disown
if eval "$USER_INPUT" &>/dev/null & then if eval "$USER_INPUT" &>/dev/null & then
disown disown
save_to_history "$USER_INPUT" echo "$USER_INPUT" >> "$HISTORY_FILE"
else else
show_notification "Command Failed" "'$USER_INPUT' could not be executed." show_notification "Command Failed" "'$USER_INPUT' could not be executed."
fi fi