diff options
Diffstat (limited to 'config/hypr/UserScripts')
| -rwxr-xr-x | config/hypr/UserScripts/Kool_Quick_Settings.sh | 84 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/QuickEdit.sh | 61 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/RainbowBorders.sh | 4 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/RofiBeats.sh | 9 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperEffects.sh | 4 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperSelect.sh | 34 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/Weather.py | 62 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/Weather.sh | 4 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/ZshChangeTheme.sh | 2 |
9 files changed, 146 insertions, 118 deletions
diff --git a/config/hypr/UserScripts/Kool_Quick_Settings.sh b/config/hypr/UserScripts/Kool_Quick_Settings.sh new file mode 100755 index 00000000..88e26089 --- /dev/null +++ b/config/hypr/UserScripts/Kool_Quick_Settings.sh @@ -0,0 +1,84 @@ +#!/bin/bash +# /* ---- š« https://github.com/JaKooLit š« ---- */ ## +# Rofi menu for Quick Edit/View of Settings (SUPER SHIFT E) + +# Define preferred text editor and terminal +edit=${EDITOR:-nano} +tty=kitty + +# variables +configs="$HOME/.config/hypr/configs" +UserConfigs="$HOME/.config/hypr/UserConfigs" +rofi_theme="$HOME/.config/rofi/config-edit.rasi" +msg=' āļø Choose what to do āļø' +iDIR="$HOME/.config/swaync/images" +scriptsDir="$HOME/.config/hypr/scripts" +UserScripts="$HOME/.config/hypr/UserScripts" + +# Function to display the menu options without numbers +menu() { + cat <<EOF +view/edit ENV variables +view/edit Window Rules +view/edit User Keybinds +view/edit User Settings +view/edit Startup Apps +view/edit Decorations +view/edit Animations +view/edit Laptop Keybinds +view/edit Default Keybinds +Configure Monitors (nwg-displays) +Configure Workspace Rules (nwg-displays) +Choose Hyprland Animations +Choose Monitor Profiles +Choose Rofi Themes +Search for Keybinds +EOF +} + +# Main function to handle menu selection +main() { + choice=$(menu | rofi -i -dmenu -config $rofi_theme -mesg "$msg") + + # Map choices to corresponding files + case "$choice" in + "view/edit ENV variables") file="$UserConfigs/ENVariables.conf" ;; + "view/edit Window Rules") file="$UserConfigs/WindowRules.conf" ;; + "view/edit User Keybinds") file="$UserConfigs/UserKeybinds.conf" ;; + "view/edit User Settings") file="$UserConfigs/UserSettings.conf" ;; + "view/edit Startup Apps") file="$UserConfigs/Startup_Apps.conf" ;; + "view/edit Decorations") file="$UserConfigs/UserDecorations.conf" ;; + "view/edit Animations") file="$UserConfigs/UserAnimations.conf" ;; + "view/edit Laptop Keybinds") file="$UserConfigs/Laptops.conf" ;; + "view/edit Default Keybinds") file="$configs/Keybinds.conf" ;; + "Configure Monitors (nwg-displays)") + if ! command -v nwg-displays &>/dev/null; then + notify-send -i "$iDIR/ja.png" "Missing nwg-displays" "Install nwg-displays first" + exit 1 + fi + nwg-displays ;; + "Configure Workspace Rules (nwg-displays)") + if ! command -v nwg-displays &>/dev/null; then + notify-send -i "$iDIR/ja.png" "Missing nwg-displays" "Install nwg-displays first" + exit 1 + fi + nwg-displays ;; + "Choose Hyprland Animations") $scriptsDir/Animations.sh ;; + "Choose Monitor Profiles") $scriptsDir/MonitorProfiles.sh ;; + "Choose Rofi Themes") $scriptsDir/RofiThemeSelector.sh ;; + "Search for Keybinds") $scriptsDir/KeyBinds.sh ;; + *) return ;; # Do nothing for invalid choices + esac + + # Open the selected file in the terminal with the text editor + if [ -n "$file" ]; then + $tty -e $edit "$file" + fi +} + +# Check if rofi is already running +if pidof rofi > /dev/null; then + pkill rofi +fi + +main diff --git a/config/hypr/UserScripts/QuickEdit.sh b/config/hypr/UserScripts/QuickEdit.sh deleted file mode 100755 index 09530881..00000000 --- a/config/hypr/UserScripts/QuickEdit.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash -# /* ---- š« https://github.com/JaKooLit š« ---- */ ## -# Rofi menu for Quick Edit/View of Settings (SUPER E) - -# Define preferred text editor and terminal -edit=${EDITOR:-nano} -tty=kitty - -# Paths to configuration directories -configs="$HOME/.config/hypr/configs" -UserConfigs="$HOME/.config/hypr/UserConfigs" -rofi_theme="~/.config/rofi/config-edit.rasi" -msg=' āļø Choose which config to View or Edit āļø' - -# Function to display the menu options -menu() { - cat <<EOF -1. ENV variables -2. Window Rules -3. Monitors -4. User Keybinds -5. User Settings -6. Startup Apps -7. Decorations -8. Animations -9. Workspace Rules -10. Laptop Keybinds -11. Default Keybinds -EOF -} - -# Main function to handle menu selection -main() { - choice=$(menu | rofi -i -dmenu -config $rofi_theme -mesg "$msg" | cut -d. -f1) - - # Map choices to corresponding files - case $choice in - 1) file="$UserConfigs/ENVariables.conf" ;; - 2) file="$UserConfigs/WindowRules.conf" ;; - 3) file="$UserConfigs/Monitors.conf" ;; - 4) file="$UserConfigs/UserKeybinds.conf" ;; - 5) file="$UserConfigs/UserSettings.conf" ;; - 6) file="$UserConfigs/Startup_Apps.conf" ;; - 7) file="$UserConfigs/UserDecorations.conf" ;; - 8) file="$UserConfigs/UserAnimations.conf" ;; - 9) file="$UserConfigs/WorkspaceRules.conf" ;; - 10) file="$UserConfigs/Laptops.conf" ;; - 11) file="$configs/Keybinds.conf" ;; - *) return ;; # Do nothing for invalid choices - esac - - # Open the selected file in the terminal with the text editor - $tty -e $edit "$file" -} - -# Check if rofi is already running -if pidof rofi > /dev/null; then - pkill rofi -fi - -main diff --git a/config/hypr/UserScripts/RainbowBorders.sh b/config/hypr/UserScripts/RainbowBorders.sh index cc1419fb..6690a5f8 100755 --- a/config/hypr/UserScripts/RainbowBorders.sh +++ b/config/hypr/UserScripts/RainbowBorders.sh @@ -8,7 +8,7 @@ function random_hex() { } # rainbow colors only for active window -hyprctl keyword general:col.active_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg +#hyprctl keyword general:col.active_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg # rainbow colors for inactive window (uncomment to take effect) -#hyprctl keyword general:col.inactive_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
\ No newline at end of file +hyprctl keyword general:col.inactive_border $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) $(random_hex) 270deg
\ No newline at end of file diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index 1f2f3e48..4587e720 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -5,8 +5,8 @@ # Variables mDIR="$HOME/Music/" iDIR="$HOME/.config/swaync/icons" -rofi_theme="~/.config/rofi/config-rofi-Beats.rasi" -rofi_theme_1="~/.config/rofi/config-rofi-Beats-menu.rasi" +rofi_theme="$HOME/.config/rofi/config-rofi-Beats.rasi" +rofi_theme_1="$HOME/.config/rofi/config-rofi-Beats-menu.rasi" # Online Stations. Edit as required declare -A online_music=( @@ -79,7 +79,9 @@ shuffle_local_music() { # Main function for playing online music play_online_music() { - choice=$(printf "%s\n" "${!online_music[@]}" | rofi -i -dmenu -config $rofi_theme) + choice=$(for online in "${!online_music[@]}"; do + echo "$online" + done | sort | rofi -i -dmenu -config "$rofi_theme") if [ -z "$choice" ]; then exit 1 @@ -93,6 +95,7 @@ play_online_music() { 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" "Music stopped" || { diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh index dea97921..948c637c 100755 --- a/config/hypr/UserScripts/WallpaperEffects.sh +++ b/config/hypr/UserScripts/WallpaperEffects.sh @@ -8,7 +8,7 @@ wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" wallpaper_output="$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified" SCRIPTSDIR="$HOME/.config/hypr/scripts" focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') -rofi_theme="~/.config/rofi/config-wallpaper-effect.rasi" +rofi_theme="$HOME/.config/rofi/config-wallpaper-effect.rasi" # Directory for swaync iDIR="$HOME/.config/swaync/images" @@ -19,7 +19,7 @@ FPS=60 TYPE="wipe" DURATION=2 BEZIER=".43,1.19,1,.4" -SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION" +SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER" # Define ImageMagick effects declare -A effects=( diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh index d75c2c15..78bf8d2f 100755 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ b/config/hypr/UserScripts/WallpaperSelect.sh @@ -15,23 +15,23 @@ iDIR="$HOME/.config/swaync/images" iDIRi="$HOME/.config/swaync/icons" # variables -rofi_theme="~/.config/rofi/config-wallpaper.rasi" +rofi_theme="$HOME/.config/rofi/config-wallpaper.rasi" focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') # Get monitor width and DPI monitor_width=$(hyprctl monitors -j | jq -r --arg mon "$focused_monitor" '.[] | select(.name == $mon) | .width') scale_factor=$(hyprctl monitors -j | jq -r --arg mon "$focused_monitor" '.[] | select(.name == $mon) | .scale') -# Calculate icon size for rofi -icon_size=$(echo "scale=1; ($monitor_width * 14) / ($scale_factor * 100)" | bc) -rofi_override="element-icon{size:${icon_size}px;}" +icon_size=$(echo "scale=1; ($monitor_width * 3) / ($scale_factor * 400)" | bc) + +rofi_override="element-icon{size:${icon_size}%;}" # swww transition config FPS=60 TYPE="any" DURATION=2 BEZIER=".43,1.19,1,.4" -SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION" +SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER" # Check if swaybg is running if pidof swaybg > /dev/null; then @@ -74,7 +74,6 @@ swww query || swww-daemon --format xrgb main() { choice=$(menu | $rofi_command) - # Trim any potential whitespace or hidden characters choice=$(echo "$choice" | xargs) RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs) @@ -94,7 +93,6 @@ main() { exit 0 fi - # Find the index of the selected file pic_index=-1 for i in "${!PICS[@]}"; do filename=$(basename "${PICS[$i]}") @@ -143,16 +141,16 @@ if [[ -n "$choice" ]]; then while read -r line; do if echo "$line" | grep -q "yes"; then - # Check if terminal exists - if ! command -v "$terminal" &>/dev/null; then - notify-send -i "$iDIR/ja.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" - exit 1 - fi + # Check if terminal exists + if ! command -v "$terminal" &>/dev/null; then + notify-send -i "$iDIR/ja.png" "Missing $terminal" "Install $terminal to enable setting of wallpaper background" + exit 1 + fi - $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ - sudo cp -r $wallpaper_current '$sddm_sequoia/backgrounds/default' && \ - notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" - break + $terminal -e bash -c "echo 'Enter your password to set wallpaper as SDDM Background'; \ + sudo cp -r $wallpaper_current '$sddm_sequoia/backgrounds/default' && \ + notify-send -i '$iDIR/ja.png' 'SDDM' 'Background SET'" + break elif echo "$line" | grep -q "no"; then echo "Wallpaper not set as SDDM background. Exiting." break @@ -160,6 +158,4 @@ if [[ -n "$choice" ]]; then done & fi -fi - - +fi
\ No newline at end of file diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py index e3a6c538..a2ad98b5 100755 --- a/config/hypr/UserScripts/Weather.py +++ b/config/hypr/UserScripts/Weather.py @@ -1,13 +1,13 @@ #!/usr/bin/env python3 # /* ---- š« https://github.com/JaKooLit š« ---- */ # +# original code https://gist.github.com/Surendrajat/ff3876fd2166dd86fb71180f4e9342d7 # weather using python -import subprocess -from pyquery import PyQuery # install using `pip install pyquery` +import requests import json import os +from pyquery import PyQuery # install using `pip install pyquery` -# original code https://gist.github.com/Surendrajat/ff3876fd2166dd86fb71180f4e9342d7 # weather icons weather_icons = { "sunnyDay": "ó°", @@ -22,30 +22,42 @@ weather_icons = { "default": "ī", } -# get location_id +# Get current location based on IP address +def get_location(): + response = requests.get("https://ipinfo.io") + data = response.json() + loc = data["loc"].split(",") + return float(loc[0]), float(loc[1]) + +# Get latitude and longitude +latitude, longitude = get_location() + +# Open-Meteo API endpoint +url = f"https://weather.com/en-PH/weather/today/l/{latitude},{longitude}" + +# manual location_id +# NOTE: if you want to add manually, make sure you disable def get_location above # 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 +#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 +#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 = ( @@ -53,14 +65,12 @@ icon = ( 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']" ).text() temp_feel_text = f"Feels like {temp_feel}c" -# print(temp_feel_text) # min-max temperature temp_min = ( @@ -74,26 +84,21 @@ temp_max = ( .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) +visibility = html_data("span[data-testid='VisibilityValue']").text() +visibility_text = f"ļ® {visibility}" # 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']")( @@ -101,7 +106,6 @@ prediction = html_data("section[aria-label='Hourly Forecast']")( ).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( @@ -112,7 +116,7 @@ tooltip_text = str.format( f"<small>{temp_feel_text}</small>", f"<b>{temp_min_max}</b>", f"{wind_text}\t{humidity_text}", - f"{visbility_text}\tAQI {air_quality_index}", + f"{visibility_text}\tAQI {air_quality_index}", f"<i> {prediction}</i>", ) @@ -125,14 +129,16 @@ out_data = { } 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" +simple_weather = ( + f"{icon} {status}\n" + + f"ļ {temp} ({temp_feel_text})\n" + + f"{wind_text} \n" + + f"{humidity_text} \n" + + f"{visibility_text} AQI{air_quality_index}\n" +) try: - with open(os.path.expanduser("~/.cache/.weather_cache"), "w") as file: + with open(os.path.expanduser("$HOME/.cache/.weather_cache"), "w") as file: file.write(simple_weather) -except: - pass +except Exception as e: + print(f"Error writing to cache: {e}") diff --git a/config/hypr/UserScripts/Weather.sh b/config/hypr/UserScripts/Weather.sh index 65613fca..9bdaff4a 100755 --- a/config/hypr/UserScripts/Weather.sh +++ b/config/hypr/UserScripts/Weather.sh @@ -4,7 +4,7 @@ # Remember to add city city= -cachedir=~/.cache/rbn +cachedir="$HOME/.cache/rbn" cachefile=${0##*/}-$1 if [ ! -d $cachedir ]; then @@ -84,4 +84,4 @@ echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \ cached_weather="ļ $temperature \n$condition ${weather[1]}" -echo -e $cached_weather > ~/.cache/.weather_cache
\ No newline at end of file +echo -e $cached_weather > "$HOME/.cache/.weather_cache"
\ No newline at end of file diff --git a/config/hypr/UserScripts/ZshChangeTheme.sh b/config/hypr/UserScripts/ZshChangeTheme.sh index 4ff43557..fafd7fb0 100755 --- a/config/hypr/UserScripts/ZshChangeTheme.sh +++ b/config/hypr/UserScripts/ZshChangeTheme.sh @@ -10,7 +10,7 @@ file_extension=".zsh-theme" # Variables iDIR="$HOME/.config/swaync/images" -rofi_theme="~/.config/rofi/config-zsh-theme.rasi" +rofi_theme="$HOME/.config/rofi/config-zsh-theme.rasi" themes_array=($(find -L "$themes_dir" -type f -name "*$file_extension" -exec basename {} \; | sed -e "s/$file_extension//")) |
