From d7ff1c1dea16619a38f35536a5c00685d848abce Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Fri, 10 May 2024 02:03:31 +0900 Subject: Initial Push - Moving to Wallust from Pywal --- config/hypr/UserScripts/WallpaperAutoChange.sh | 4 ++-- config/hypr/UserScripts/WallpaperRandom.sh | 2 +- config/hypr/UserScripts/WallpaperSelect.sh | 2 +- config/hypr/UserScripts/Weather.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'config/hypr/UserScripts') 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..adaec3b5 100755 --- a/config/hypr/UserScripts/WallpaperRandom.sh +++ b/config/hypr/UserScripts/WallpaperRandom.sh @@ -20,7 +20,7 @@ SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration swww query || swww-daemon --format xrgb && swww img ${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..7b23d28d 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 @@ -86,7 +86,7 @@ humidity_text = f" {humidity}" # visibility visbility = html_data("span[data-testid='VisibilityValue']").text() -visbility_text = f" {visbility}" +visbility_text = f" {visbility}" # print(visbility_text) # air quality index @@ -127,7 +127,7 @@ 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"{visbility_text} AQI{air_quality_index}\n" try: with open(os.path.expanduser("~/.cache/.weather_cache"), "w") as file: -- cgit v1.2.3 From 56810d5996c38f12742c4c147f61efe056ac12bb Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Fri, 10 May 2024 20:30:39 +0900 Subject: weather.py alignment adjustment --- config/hypr/UserScripts/Weather.py | 135 +++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py index 7b23d28d..9f9c1440 100755 --- a/config/hypr/UserScripts/Weather.py +++ b/config/hypr/UserScripts/Weather.py @@ -53,6 +53,66 @@ icon = ( ) # print(icon) +# temperature feels like +temp_feel = html_data( + "div[data-testid='FeelsLikeSection'] > span > span[data-testid='TemperatureValue']" +).text() +temp_feel_text = f"Feels like {temp_feel}c" +# print(temp_feel_text)#!/usr/bin/env python3 + +import subprocess +from pyquery import PyQuery # install using `pip install pyquery` +import json +import os + +# original code https://gist.github.com/Surendrajat/ff3876fd2166dd86fb71180f4e9342d7 +# weather icons +weather_icons = { + "sunnyDay": "", + "clearNight": "", + "cloudyFoggyDay": "", + "cloudyFoggyNight": "", + "rainyDay": "", + "rainyNight": "", + "snowyIcyDay": "", + "snowyIcyNight": "", + "severe": "", + "default": "", +} + +# get location_id +# to get your own location_id, go to https://weather.com & search your location. +# once you choose your location, you can see the location_id in the URL(64 chars long hex string) +# like this: https://weather.com/en-PH/weather/today/l/bca47d1099e762a012b9a139c36f30a0b1e647f69c0c4ac28b537e7ae9c1c200 +location_id = "bca47d1099e762a012b9a139c36f30a0b1e647f69c0c4ac28b537e7ae9c1c200" # TODO + +# NOTE to change to deg F, change the URL to your preffered location after weather.com +# Default is English-Philippines with Busan, South Korea as location_id +# get html page +url = "https://weather.com/en-PH/weather/today/l/" + location_id +html_data = PyQuery(url=url) + +# current temperature +temp = html_data("span[data-testid='TemperatureValue']").eq(0).text() +# print(temp) + +# current status phrase +status = html_data("div[data-testid='wxPhrase']").text() +status = f"{status[:16]}.." if len(status) > 17 else status +# print(status) + +# status code +status_code = html_data("#regionHeader").attr("class").split(" ")[2].split("-")[2] +# print(status_code) + +# status icon +icon = ( + weather_icons[status_code] + if status_code in weather_icons + else weather_icons["default"] +) +# print(icon) + # temperature feels like temp_feel = html_data( "div[data-testid='FeelsLikeSection'] > span > span[data-testid='TemperatureValue']" @@ -60,6 +120,81 @@ temp_feel = html_data( temp_feel_text = f"Feels like {temp_feel}c" # print(temp_feel_text) +# min-max temperature +temp_min = ( + html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']") + .eq(0) + .text() +) +temp_max = ( + html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']") + .eq(1) + .text() +) +temp_min_max = f" {temp_min}\t\t {temp_max}" +# print(temp_min_max) + +# wind speed +wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[1] +wind_text = f" {wind_speed}" +# print(wind_text) + +# humidity +humidity = html_data("span[data-testid='PercentageValue']").text() +humidity_text = f" {humidity}" +# print(humidity_text) + +# visibility +visbility = html_data("span[data-testid='VisibilityValue']").text() +visbility_text = f" {visbility}" +# print(visbility_text) + +# air quality index +air_quality_index = html_data("text[data-testid='DonutChartValue']").text() +# print(air_quality_index) + +# hourly rain prediction +prediction = html_data("section[aria-label='Hourly Forecast']")( + "div[data-testid='SegmentPrecipPercentage'] > span" +).text() +prediction = prediction.replace("Chance of Rain", "") +prediction = f"\n\n (hourly) {prediction}" if len(prediction) > 0 else prediction +# print(prediction) + +# tooltip text +tooltip_text = str.format( + "\t\t{}\t\t\n{}\n{}\n{}\n\n{}\n{}\n{}{}", + f'{temp}', + f" {icon}", + f"{status}", + f"{temp_feel_text}", + f"{temp_min_max}", + f"{wind_text}\t{humidity_text}", + f"{visbility_text}\tAQI {air_quality_index}", + f" {prediction}", +) + +# print waybar module data +out_data = { + "text": f"{icon} {temp}", + "alt": status, + "tooltip": tooltip_text, + "class": status_code, +} +print(json.dumps(out_data)) + +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" + +try: + with open(os.path.expanduser("~/.cache/.weather_cache"), "w") as file: + file.write(simple_weather) +except: + pass + # min-max temperature temp_min = ( html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']") -- cgit v1.2.3 From 5b85fd7415ad55b3323cd1caacf1ae86c4b3a6ea Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 12 May 2024 02:17:58 -0400 Subject: Weather.py clean up. Double codes --- config/hypr/UserScripts/Weather.py | 147 ++----------------------------------- 1 file changed, 6 insertions(+), 141 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py index 9f9c1440..5cd11a66 100755 --- a/config/hypr/UserScripts/Weather.py +++ b/config/hypr/UserScripts/Weather.py @@ -53,66 +53,6 @@ icon = ( ) # print(icon) -# temperature feels like -temp_feel = html_data( - "div[data-testid='FeelsLikeSection'] > span > span[data-testid='TemperatureValue']" -).text() -temp_feel_text = f"Feels like {temp_feel}c" -# print(temp_feel_text)#!/usr/bin/env python3 - -import subprocess -from pyquery import PyQuery # install using `pip install pyquery` -import json -import os - -# original code https://gist.github.com/Surendrajat/ff3876fd2166dd86fb71180f4e9342d7 -# weather icons -weather_icons = { - "sunnyDay": "", - "clearNight": "", - "cloudyFoggyDay": "", - "cloudyFoggyNight": "", - "rainyDay": "", - "rainyNight": "", - "snowyIcyDay": "", - "snowyIcyNight": "", - "severe": "", - "default": "", -} - -# get location_id -# to get your own location_id, go to https://weather.com & search your location. -# once you choose your location, you can see the location_id in the URL(64 chars long hex string) -# like this: https://weather.com/en-PH/weather/today/l/bca47d1099e762a012b9a139c36f30a0b1e647f69c0c4ac28b537e7ae9c1c200 -location_id = "bca47d1099e762a012b9a139c36f30a0b1e647f69c0c4ac28b537e7ae9c1c200" # TODO - -# NOTE to change to deg F, change the URL to your preffered location after weather.com -# Default is English-Philippines with Busan, South Korea as location_id -# get html page -url = "https://weather.com/en-PH/weather/today/l/" + location_id -html_data = PyQuery(url=url) - -# current temperature -temp = html_data("span[data-testid='TemperatureValue']").eq(0).text() -# print(temp) - -# current status phrase -status = html_data("div[data-testid='wxPhrase']").text() -status = f"{status[:16]}.." if len(status) > 17 else status -# print(status) - -# status code -status_code = html_data("#regionHeader").attr("class").split(" ")[2].split("-")[2] -# print(status_code) - -# status icon -icon = ( - weather_icons[status_code] - if status_code in weather_icons - else weather_icons["default"] -) -# print(icon) - # temperature feels like temp_feel = html_data( "div[data-testid='FeelsLikeSection'] > span > span[data-testid='TemperatureValue']" @@ -120,81 +60,6 @@ temp_feel = html_data( temp_feel_text = f"Feels like {temp_feel}c" # print(temp_feel_text) -# min-max temperature -temp_min = ( - html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']") - .eq(0) - .text() -) -temp_max = ( - html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']") - .eq(1) - .text() -) -temp_min_max = f" {temp_min}\t\t {temp_max}" -# print(temp_min_max) - -# wind speed -wind_speed = html_data("span[data-testid='Wind']").text().split("\n")[1] -wind_text = f" {wind_speed}" -# print(wind_text) - -# humidity -humidity = html_data("span[data-testid='PercentageValue']").text() -humidity_text = f" {humidity}" -# print(humidity_text) - -# visibility -visbility = html_data("span[data-testid='VisibilityValue']").text() -visbility_text = f" {visbility}" -# print(visbility_text) - -# air quality index -air_quality_index = html_data("text[data-testid='DonutChartValue']").text() -# print(air_quality_index) - -# hourly rain prediction -prediction = html_data("section[aria-label='Hourly Forecast']")( - "div[data-testid='SegmentPrecipPercentage'] > span" -).text() -prediction = prediction.replace("Chance of Rain", "") -prediction = f"\n\n (hourly) {prediction}" if len(prediction) > 0 else prediction -# print(prediction) - -# tooltip text -tooltip_text = str.format( - "\t\t{}\t\t\n{}\n{}\n{}\n\n{}\n{}\n{}{}", - f'{temp}', - f" {icon}", - f"{status}", - f"{temp_feel_text}", - f"{temp_min_max}", - f"{wind_text}\t{humidity_text}", - f"{visbility_text}\tAQI {air_quality_index}", - f" {prediction}", -) - -# print waybar module data -out_data = { - "text": f"{icon} {temp}", - "alt": status, - "tooltip": tooltip_text, - "class": status_code, -} -print(json.dumps(out_data)) - -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" - -try: - with open(os.path.expanduser("~/.cache/.weather_cache"), "w") as file: - file.write(simple_weather) -except: - pass - # min-max temperature temp_min = ( html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']") @@ -221,7 +86,7 @@ humidity_text = f" {humidity}" # visibility visbility = html_data("span[data-testid='VisibilityValue']").text() -visbility_text = f" {visbility}" +visbility_text = f" {visbility}" # print(visbility_text) # air quality index @@ -258,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 -- cgit v1.2.3 From 27285b10c8b9cd90a945ef7167d4c6d93daf5e3e Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Sun, 12 May 2024 19:38:06 +0900 Subject: wallpaperRamdom will only change focused monitor --- config/hypr/UserScripts/WallpaperRandom.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/WallpaperRandom.sh b/config/hypr/UserScripts/WallpaperRandom.sh index adaec3b5..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,7 +19,7 @@ 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}/WallustSwww.sh -- cgit v1.2.3 From ca3a8941e7b647ed40b60c247869a4de9cae26f5 Mon Sep 17 00:00:00 2001 From: Linxford Kwabena Date: Sun, 12 May 2024 11:06:50 +0000 Subject: Update RofiBeats.sh || Add support for local and online music playback This commit introduces enhancements to the music playback script. It now allows users to choose between local and online music options. Under each category, the available songs are displayed, and the selected song is played using `mpv`. Additionally, shuffle functionality has been added to provide a randomized listening experience. The code has been refactored to include separate functions for playing local and online music, improving code organization and readability. These changes aim to provide users with a more versatile and enjoyable music playback experience. --- config/hypr/UserScripts/RofiBeats.sh | 64 ++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 14 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index e3c79587..5620f666 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -3,11 +3,18 @@ # 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 associative arrays for local and online music +declare -A local_music -# Define menu options as an associative array -declare -A menu_options=( +# Populate the menu_options array with music files from the Music folder +for file in ~/Music/*.mp3; do + filename=$(basename "$file") + local_music["$filename"]="$file" +done + + +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" @@ -26,25 +33,54 @@ notification() { notify-send -u normal -i "$iDIR/music.png" "Playing now: $@" } -# 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() { + choice=$(printf "%s\n" "${!local_music[@]}" | rofi -i -dmenu -config ~/.config/rofi/config-rofi-Beats.rasi -p "Local Music") if [ -z "$choice" ]; then exit 1 fi - link="${menu_options[$choice]}" + file="${local_music[$choice]}" 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\nOnline Streaming" | rofi -dmenu -p "Select music source") + + case "$user_choice" in + "Play from Music Folder") + play_local_music + ;; + "Online Streaming") + play_online_music + ;; + *) + echo "Invalid choice" + ;; + esac +} + -- cgit v1.2.3 From f3b3f8ed2b122a84ff1f6cc772e244d318fbf9f6 Mon Sep 17 00:00:00 2001 From: Linxford Kwabena Date: Sun, 12 May 2024 12:38:07 +0000 Subject: Update RofiBeats.sh Added option to list all supported music formats (mp3, ogg, wav, flac, m4a, wma,mp4) for local files. --- config/hypr/UserScripts/RofiBeats.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index 5620f666..010d5f74 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -6,10 +6,12 @@ iDIR="$HOME/.config/swaync/icons" # Define menu options as associative arrays for local and online music declare -A local_music -# Populate the menu_options array with music files from the Music folder -for file in ~/Music/*.mp3; do - filename=$(basename "$file") - local_music["$filename"]="$file" +# Populate the menu_options array with music files from the Music folder with specified extensions +for file in ~/Music/*.{mp3,ogg,wav,flac,m4a,wma,mp4}; do + if [ -f "$file" ]; then + filename=$(basename "$file") + local_music["$filename"]="$file" + fi done @@ -67,7 +69,6 @@ play_online_music() { # 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" || { - # Prompt the user to choose between local and online music user_choice=$(printf "Play from Music Folder\nOnline Streaming" | rofi -dmenu -p "Select music source") @@ -83,4 +84,3 @@ pkill mpv && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || { ;; esac } - -- cgit v1.2.3 From 4929d1530275f3d492071dd8bb30394e02418dae Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" Date: Sun, 12 May 2024 21:41:09 +0900 Subject: Update RofiBeats.sh adjusted a bit... made another rofi-beats menu --- config/hypr/UserScripts/RofiBeats.sh | 38 ++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'config/hypr/UserScripts') diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index 010d5f74..c6fbb06d 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -3,18 +3,18 @@ # Directory for icons iDIR="$HOME/.config/swaync/icons" -# Define menu options as associative arrays for local and online music -declare -A local_music +# Directory music folder +mDIR="$HOME/Music/*" -# Populate the menu_options array with music files from the Music folder with specified extensions -for file in ~/Music/*.{mp3,ogg,wav,flac,m4a,wma,mp4}; do - if [ -f "$file" ]; then - filename=$(basename "$file") - local_music["$filename"]="$file" - fi +# Local Music +declare -A local_music +# Populate the menu_options array with music files from the Music folder +for file in $mDIR; do + filename=$(basename "$file") + local_music["$filename"]="$file" done - +# Online Stations declare -A online_music=( ["AfroBeatz 2024 🎧"]="https://www.youtube.com/watch?v=7uB-Eh9XVZQ" ["Lofi Girl ☕️🎶"]="https://play.streamafrica.net/lofiradio" @@ -32,11 +32,12 @@ declare -A online_music=( # 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 for playing local music play_local_music() { + # Prompt the user to select a song choice=$(printf "%s\n" "${!local_music[@]}" | rofi -i -dmenu -config ~/.config/rofi/config-rofi-Beats.rasi -p "Local Music") if [ -z "$choice" ]; then @@ -46,9 +47,14 @@ play_local_music() { file="${local_music[$choice]}" notification "$choice" - - # Play the selected local music file using mpv - mpv --shuffle --vid=no "$file" + + # Play the selected local music file using mpv and shuffle the rest + mpv --shuffle --vid=no "$file" && \ + for file in $mDIR; do + if [ "$file" != "${local_music[$choice]}" ]; then + mpv --shuffle --vid=no "$file" + fi + done } # Main function for playing online music @@ -69,14 +75,15 @@ play_online_music() { # 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" || { + # Prompt the user to choose between local and online music - user_choice=$(printf "Play from Music Folder\nOnline Streaming" | rofi -dmenu -p "Select music source") + 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 ;; - "Online Streaming") + "Play from Online Stations") play_online_music ;; *) @@ -84,3 +91,4 @@ pkill mpv && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || { ;; esac } + -- cgit v1.2.3 From 0a59d4b9fd14384c5f726504d363ccd2cb213d09 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Mon, 13 May 2024 01:25:37 +0900 Subject: updated rofi.beats. initial boot, wallpaper copy.sh in preparation for the upcomming release --- .editorconfig | 2 +- config/hypr/UserScripts/RofiBeats.sh | 52 +++++++++++++++++++---------------- config/hypr/initial-boot.sh | 8 +++--- copy.sh | 6 ++-- wallpapers/Anime-Landscape2.png | Bin 7704488 -> 0 bytes wallpapers/Fantasy-Waterfall.png | Bin 0 -> 12428942 bytes 6 files changed, 37 insertions(+), 31 deletions(-) delete mode 100644 wallpapers/Anime-Landscape2.png create mode 100644 wallpapers/Fantasy-Waterfall.png (limited to 'config/hypr/UserScripts') diff --git a/.editorconfig b/.editorconfig index f8e72805..5644fbb2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,5 @@ root = true [*] indent_style = space -indent_size = 4 +indent_size = 2 diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index c6fbb06d..76634a1a 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -1,18 +1,10 @@ #!/bin/bash -# Directory for icons -iDIR="$HOME/.config/swaync/icons" - # Directory music folder -mDIR="$HOME/Music/*" +mDIR="$HOME/Music/" -# Local Music -declare -A local_music -# Populate the menu_options array with music files from the Music folder -for file in $mDIR; do - filename=$(basename "$file") - local_music["$filename"]="$file" -done +# Directory for icons +iDIR="$HOME/.config/swaync/icons" # Online Stations declare -A online_music=( @@ -30,6 +22,17 @@ declare -A online_music=( ["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: $@" @@ -37,26 +40,30 @@ notification() { # Main function for playing local music play_local_music() { + populate_local_music + # Prompt the user to select a song - choice=$(printf "%s\n" "${!local_music[@]}" | rofi -i -dmenu -config ~/.config/rofi/config-rofi-Beats.rasi -p "Local Music") + 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 - file="${local_music[$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" - # Play the selected local music file using mpv and shuffle the rest - mpv --shuffle --vid=no "$file" && \ - for file in $mDIR; do - if [ "$file" != "${local_music[$choice]}" ]; then - mpv --shuffle --vid=no "$file" - fi - done + # 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") @@ -76,8 +83,8 @@ play_online_music() { # 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" || { - # 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") +# 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") @@ -91,4 +98,3 @@ pkill mpv && notify-send -u low -i "$iDIR/music.png" "Online Music stopped" || { ;; esac } - diff --git a/config/hypr/initial-boot.sh b/config/hypr/initial-boot.sh index 95b9e491..162ad65f 100755 --- a/config/hypr/initial-boot.sh +++ b/config/hypr/initial-boot.sh @@ -7,8 +7,8 @@ # Variables scriptsDir=$HOME/.config/hypr/scripts -wallpaper=$HOME/Pictures/wallpapers/Lofi-Urban-Nightscape.png -waybar_style="$HOME/.config/waybar/style/[Wallust] Chroma Tally.css" +wallpaper=$HOME/Pictures/wallpapers/Fantasy-Waterfall.png +waybar_style="$HOME/.config/waybar/style/[Dark] Latte-Wallust combined.css" kvantum_theme="Catppuccin-Mocha" swww="swww img" @@ -26,8 +26,8 @@ if [ ! -f ~/.config/hypr/.initial_startup_done ]; then # initiate GTK dark mode and apply icon and cursor theme gsettings set org.gnome.desktop.interface color-scheme prefer-dark > /dev/null 2>&1 & - gsettings set org.gnome.desktop.interface gtk-theme Tokyonight-Dark-BL-LB > /dev/null 2>&1 & - gsettings set org.gnome.desktop.interface icon-theme Tokyonight-Dark > /dev/null 2>&1 & + gsettings set org.gnome.desktop.interface gtk-theme Tokyonight-Dark-Moon-BL-LB > /dev/null 2>&1 & + gsettings set org.gnome.desktop.interface icon-theme Flat-Remix-Blue-Dark > /dev/null 2>&1 & gsettings set org.gnome.desktop.interface cursor-theme Bibata-Modern-Ice > /dev/null 2>&1 & gsettings set org.gnome.desktop.interface cursor-size 24 > /dev/null 2>&1 & diff --git a/copy.sh b/copy.sh index 9ab32b07..e1047f24 100755 --- a/copy.sh +++ b/copy.sh @@ -3,8 +3,8 @@ clear -wallpaper=$HOME/Pictures/wallpapers/Lofi-Urban-Nightscape.png -Waybar_Style="$HOME/.config/waybar/style/[Wallust] Chroma Tally.css" +wallpaper=$HOME/Pictures/wallpapers/Fantasy-Waterfall.png +waybar_style="$HOME/.config/waybar/style/[Dark] Latte-Wallust combined.css" # Check if running as root. If root, script will exit if [[ $EUID -eq 0 ]]; then @@ -295,7 +295,7 @@ while true; do done # symlinks for waybar style -ln -sf "$Waybar_Style" "$HOME/.config/waybar/style.css" && \ +ln -sf "$waybar_Style" "$HOME/.config/waybar/style.css" && \ # initialize wallust to avoid config error on hyprland wallust run -s $wallpaper 2>&1 | tee -a "$LOG" diff --git a/wallpapers/Anime-Landscape2.png b/wallpapers/Anime-Landscape2.png deleted file mode 100644 index c8681762..00000000 Binary files a/wallpapers/Anime-Landscape2.png and /dev/null differ diff --git a/wallpapers/Fantasy-Waterfall.png b/wallpapers/Fantasy-Waterfall.png new file mode 100644 index 00000000..91c58a47 Binary files /dev/null and b/wallpapers/Fantasy-Waterfall.png differ -- cgit v1.2.3