diff options
| author | Ja.KooLit <jimmielovejay@gmail.com> | 2024-05-13 02:36:43 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-13 02:36:43 +0900 |
| commit | 683e801de6ee2fe01513311e2bc13f695cd96486 (patch) | |
| tree | 64df94cb64f5ba161761bfd64ae93658ca163f9c /config/hypr/UserScripts | |
| parent | 35327b2814b228253464f0358f58c553ec98002b (diff) | |
| parent | ea93a71cf6ac92041f00168e040cdc22882047b7 (diff) | |
Merge branch 'development' into main
Diffstat (limited to 'config/hypr/UserScripts')
| -rwxr-xr-x | config/hypr/UserScripts/RofiBeats.sh | 84 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperAutoChange.sh | 4 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperRandom.sh | 6 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperSelect.sh | 2 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/Weather.py | 12 |
5 files changed, 80 insertions, 28 deletions
diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index e3c79587..76634a1a 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -1,13 +1,14 @@ #!/bin/bash +# Directory music folder +mDIR="$HOME/Music/" + # Directory for icons iDIR="$HOME/.config/swaync/icons" -# Note: You can add more options below with the following format: -# ["TITLE"]="link" - -# Define menu options as an associative array -declare -A menu_options=( +# Online Stations +declare -A online_music=( + ["AfroBeatz 2024 đ§"]="https://www.youtube.com/watch?v=7uB-Eh9XVZQ" ["Lofi Girl âī¸đļ"]="https://play.streamafrica.net/lofiradio" ["Easy Rock 96.3 FM đģđļ"]="https://radio-stations-philippines.com/easy-rock" ["Wish 107.5 FM đģđļ"]="https://radio-stations-philippines.com/dwnu-1075-wish" @@ -21,30 +22,79 @@ declare -A menu_options=( ["Korean Drama OST đģđļ"]="https://youtube.com/playlist?list=PLUge_o9AIFp4HuA-A3e3ZqENh63LuRRlQ" ) +# Local Music +# Populate local_music array with files from music directory and subdirectories +populate_local_music() { + local_music=() + filenames=() + while IFS= read -r file; do + local_music+=("$file") + filenames+=("$(basename "$file")") + done < <(find "$mDIR" -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.wav" -o -iname "*.ogg" \)) +} + # Function for displaying notifications notification() { - notify-send -u normal -i "$iDIR/music.png" "Playing now: $@" + notify-send -u normal -i "$iDIR/music.png" "Playing: $@" } -# Main function -main() { - choice=$(printf "%s\n" "${!menu_options[@]}" | rofi -i -dmenu -config ~/.config/rofi/config-rofi-Beats.rasi -p "") +# Main function for playing local music +play_local_music() { + populate_local_music + + # Prompt the user to select a song + choice=$(printf "%s\n" "${filenames[@]}" | rofi -i -dmenu -config ~/.config/rofi/config-rofi-Beats.rasi -p "Local Music") if [ -z "$choice" ]; then exit 1 fi - link="${menu_options[$choice]}" + # Find the corresponding file path based on user's choice + for (( i=0; i<"${#filenames[@]}"; i++ )); do + if [ "${filenames[$i]}" = "$choice" ]; then + file="${local_music[$i]}" + break + fi + done notification "$choice" - - # Check if the link is a playlist - if [[ $link == *playlist* ]]; then - mpv --shuffle --vid=no "$link" - else - mpv "$link" + + # Play the selected local music file using mpv + mpv --shuffle --vid=no "$file" +} + + +# Main function for playing online music +play_online_music() { + choice=$(printf "%s\n" "${!online_music[@]}" | rofi -i -dmenu -config ~/.config/rofi/config-rofi-Beats.rasi -p "Online Music") + + if [ -z "$choice" ]; then + exit 1 fi + + link="${online_music[$choice]}" + + notification "$choice" + + # Play the selected online music using mpv + mpv --shuffle --vid=no "$link" } # Check if an online music process is running and send a notification, otherwise run the main function -pkill mpv && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || main +pkill mpv && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || { + +# Prompt the user to choose between local and online music +user_choice=$(printf "Play from Music Folder\nPlay from Online Stations" | rofi -dmenu -config ~/.config/rofi/config-rofi-Beats-menu.rasi -p "Select music source") + + case "$user_choice" in + "Play from Music Folder") + play_local_music + ;; + "Play from Online Stations") + play_online_music + ;; + *) + echo "Invalid choice" + ;; + esac +} diff --git a/config/hypr/UserScripts/WallpaperAutoChange.sh b/config/hypr/UserScripts/WallpaperAutoChange.sh index 9e0e1cbe..f54620bb 100755 --- a/config/hypr/UserScripts/WallpaperAutoChange.sh +++ b/config/hypr/UserScripts/WallpaperAutoChange.sh @@ -7,7 +7,7 @@ # # NOTE: this script uses bash (not POSIX shell) for the RANDOM variable -pywal_refresh=$HOME/.config/hypr/scripts/RefreshNoWaybar.sh +wallust_refresh=$HOME/.config/hypr/scripts/RefreshNoWaybar.sh focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}') @@ -32,7 +32,7 @@ while true; do | sort -n | cut -d':' -f2- \ | while read -r img; do swww img -o $focused_monitor "$img" - $pywal_refresh + $wallust_refresh sleep $INTERVAL done diff --git a/config/hypr/UserScripts/WallpaperRandom.sh b/config/hypr/UserScripts/WallpaperRandom.sh index 52fc819d..050c10c3 100755 --- a/config/hypr/UserScripts/WallpaperRandom.sh +++ b/config/hypr/UserScripts/WallpaperRandom.sh @@ -5,6 +5,8 @@ wallDIR="$HOME/Pictures/wallpapers" scriptsDir="$HOME/.config/hypr/scripts" +focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}') + PICS=($(find ${wallDIR} -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \))) RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]} @@ -17,10 +19,10 @@ BEZIER=".43,1.19,1,.4" SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER" -swww query || swww-daemon --format xrgb && swww img ${RANDOMPICS} $SWWW_PARAMS +swww query || swww-daemon --format xrgb && swww img -o $focused_monitor ${RANDOMPICS} $SWWW_PARAMS -${scriptsDir}/PywalSwww.sh +${scriptsDir}/WallustSwww.sh sleep 1 ${scriptsDir}/Refresh.sh diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index 2616014d..9a087c7d 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -85,6 +85,6 @@ fi main sleep 0.5 -${SCRIPTSDIR}/PywalSwww.sh +${SCRIPTSDIR}/WallustSwww.sh sleep 0.2 ${SCRIPTSDIR}/Refresh.sh diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py index 046dbcd3..5cd11a66 100755 --- a/config/hypr/UserScripts/Weather.py +++ b/config/hypr/UserScripts/Weather.py @@ -76,7 +76,7 @@ temp_min_max = f"ī {temp_min}\t\tī {temp_max}" # wind speed wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[1] -wind_text = f"į
Ž {wind_speed}" +wind_text = f"îž {wind_speed}" # print(wind_text) # humidity @@ -123,14 +123,14 @@ out_data = { } print(json.dumps(out_data)) -simple_weather =f"{icon} {status}\n" + \ +simple_weather =f"{icon} {status}\n" + \ f"ī {temp} ({temp_feel_text})\n" + \ - f"{wind_text}\n" + \ - f"{humidity_text}\n" + \ - f"{visbility_text} AQI {air_quality_index}\n" + f"{wind_text} \n" + \ + f"{humidity_text} \n" + \ + f"{visbility_text} AQI{air_quality_index}\n" try: with open(os.path.expanduser("~/.cache/.weather_cache"), "w") as file: file.write(simple_weather) except: - pass
\ No newline at end of file + pass |
