diff options
| -rwxr-xr-x | config/hypr/scripts/Hypridle.sh | 3 | ||||
| -rwxr-xr-x | config/hypr/scripts/RofiSearch.sh | 15 | ||||
| -rwxr-xr-x | config/hypr/scripts/Sounds.sh | 17 |
3 files changed, 30 insertions, 5 deletions
diff --git a/config/hypr/scripts/Hypridle.sh b/config/hypr/scripts/Hypridle.sh index 6acff434..a9bb90d7 100755 --- a/config/hypr/scripts/Hypridle.sh +++ b/config/hypr/scripts/Hypridle.sh @@ -15,7 +15,8 @@ elif [[ "$1" == "toggle" ]]; then if pgrep -x "$PROCESS" >/dev/null; then pkill "$PROCESS" else - "$PROCESS" + "$PROCESS" >/dev/null 2>&1 & + disown fi else echo "Usage: $0 {status|toggle}" diff --git a/config/hypr/scripts/RofiSearch.sh b/config/hypr/scripts/RofiSearch.sh index 8ef12c46..dfeb19ac 100755 --- a/config/hypr/scripts/RofiSearch.sh +++ b/config/hypr/scripts/RofiSearch.sh @@ -4,6 +4,10 @@ # Define the path to the config file config_file=$HOME/.config/hypr/UserConfigs/01-UserDefaults.conf +if ! command -v jq >/dev/null 2>&1; then + notify-send -u low "Rofi Search" "jq is required for URL encoding. Please install jq." + exit 1 +fi # Check if the config file exists if [[ ! -f "$config_file" ]]; then @@ -32,5 +36,12 @@ if pgrep -x "rofi" >/dev/null; then pkill rofi fi -# Open Rofi and pass the selected query to xdg-open for Google search -echo "" | rofi -dmenu -config "$rofi_theme" -mesg "$msg" | xargs -I{} xdg-open $Search_Engine
\ No newline at end of file +# Open Rofi and pass the selected query to xdg-open for the configured search engine +query=$(printf '' | rofi -dmenu -config "$rofi_theme" -mesg "$msg") + +if [[ -z "$query" ]]; then + exit 0 +fi + +encoded_query=$(printf '%s' "$query" | jq -sRr @uri) +xdg-open "${Search_Engine}${encoded_query}" >/dev/null 2>&1 & diff --git a/config/hypr/scripts/Sounds.sh b/config/hypr/scripts/Sounds.sh index b372d714..e92248da 100755 --- a/config/hypr/scripts/Sounds.sh +++ b/config/hypr/scripts/Sounds.sh @@ -73,5 +73,18 @@ if ! test -f "$sound_file"; then fi fi -# pipewire priority, fallback pulseaudio -pw-play "$sound_file" || pa-play "$sound_file"
\ No newline at end of file +# Play the sound: prefer PipeWire, then PulseAudio, then ALSA +if command -v pw-play >/dev/null 2>&1; then + pw-play "$sound_file" && exit 0 +fi + +if command -v paplay >/dev/null 2>&1; then + paplay "$sound_file" && exit 0 +fi + +if command -v aplay >/dev/null 2>&1; then + aplay "$sound_file" && exit 0 +fi + +echo "Error: No suitable audio player (pw-play/paplay/aplay) found." +exit 1 |
