diff options
| author | Ja.KooLit <ejhay.games@gmail.com> | 2023-12-29 00:41:08 +0900 |
|---|---|---|
| committer | Ja.KooLit <ejhay.games@gmail.com> | 2023-12-29 00:41:08 +0900 |
| commit | f0771edf369d3ea51e3322acb9a5baa456f732b1 (patch) | |
| tree | 96a01b7586d716c03f73380ac22e46a241eb8266 /config/hypr/scripts | |
| parent | 9bf8a87dfa62865111c94e97a9abafcb529e52ed (diff) | |
Re-Structured Hypr Folder in preparation for Updates Scripts
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/QuickEdit.sh | 33 | ||||
| -rwxr-xr-x | config/hypr/scripts/RainbowBorders.sh | 10 | ||||
| -rwxr-xr-x | config/hypr/scripts/Refresh.sh | 20 | ||||
| -rwxr-xr-x | config/hypr/scripts/RefreshNoWaybar.sh | 21 | ||||
| -rwxr-xr-x | config/hypr/scripts/Weather.py | 122 | ||||
| -rwxr-xr-x | config/hypr/scripts/Weather.sh | 80 | ||||
| -rwxr-xr-x | config/hypr/scripts/ZshChangeTheme.sh | 38 |
7 files changed, 55 insertions, 269 deletions
diff --git a/config/hypr/scripts/QuickEdit.sh b/config/hypr/scripts/QuickEdit.sh index 7e9d67fc..9c7cdffc 100755 --- a/config/hypr/scripts/QuickEdit.sh +++ b/config/hypr/scripts/QuickEdit.sh @@ -1,40 +1,49 @@ #!/bin/bash -hyprDir="$HOME/.config/hypr/configs" +defaultDir="$HOME/.config/hypr/configs" +userDir="$HOME/.config/hypr/UserConfigs" menu(){ printf "1. view Env-variables\n" - printf "2. view Rules\n" - printf "3. view Execs (startup)\n" - printf "4. view KeyBinds\n" + printf "2. view Window-Rules\n" + printf "3. view Startup_Apps\n" + printf "4. view User-Keybinds\n" printf "5. view Monitors\n" printf "6. view Laptop-Keybinds\n" - printf "7. view Hyprland-Settings\n" + printf "7. view User-Settings\n" + printf "8. view Default-Settings\n" + printf "9. view Default-Keybinds\n" } main() { choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-compact.rasi | cut -d. -f1) case $choice in 1) - kitty -e nano "$hyprDir/ENVariables.conf" + kitty -e nano "$userDir/ENVariables.conf" ;; 2) - kitty -e nano "$hyprDir/WindowRules.conf" + kitty -e nano "$userDir/WindowRules.conf" ;; 3) - kitty -e nano "$hyprDir/Execs.conf" + kitty -e nano "$userDir/Startup_Apps.conf" ;; 4) - kitty -e nano "$hyprDir/Keybinds.conf" + kitty -e nano "$userDir/UserKeybinds.conf" ;; 5) - kitty -e nano "$hyprDir/Monitors.conf" + kitty -e nano "$userDir/Monitors.conf" ;; 6) - kitty -e nano "$hyprDir/Laptops.conf" + kitty -e nano "$userDir/Laptops.conf" ;; 7) - kitty -e nano "$hyprDir/Settings.conf" + kitty -e nano "$userDir/UserSettings.conf" + ;; + 8) + kitty -e nano "$defaultDir/Settings.conf" + ;; + 9) + kitty -e nano "$defaultDir/Keybinds.conf" ;; *) ;; diff --git a/config/hypr/scripts/RainbowBorders.sh b/config/hypr/scripts/RainbowBorders.sh deleted file mode 100755 index 1f5e6cdb..00000000 --- a/config/hypr/scripts/RainbowBorders.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -function random_hex() { - random_hex=("0xff$(openssl rand -hex 3)") - echo $random_hex -} - -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.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/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 52f7e642..b5e0f556 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -1,6 +1,16 @@ #!/usr/bin/env bash SCRIPTSDIR=$HOME/.config/hypr/scripts +UserSCRIPTSDIR=$HOME/.config/hypr/UserScripts + +# Define file_exists function +file_exists() { + if [ -e "$1" ]; then + return 0 # File exists + else + return 1 # File does not exist + fi +} # Kill already running processes _ps=(waybar rofi swaync) @@ -18,9 +28,13 @@ waybar & sleep 0.5 swaync > /dev/null 2>&1 & -# Relaunching rainbow borders +# Relaunching rainbow borders if the script exists sleep 1 -${SCRIPTSDIR}/RainbowBorders.sh & +if file_exists "${UserSCRIPTSDIR}/RainbowBorders.sh"; then + ${UserSCRIPTSDIR}/RainbowBorders.sh & +fi # for cava-pywal (note, need to manually restart cava once wallpaper changes) -ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true
\ No newline at end of file +ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true + +exit 0
\ No newline at end of file diff --git a/config/hypr/scripts/RefreshNoWaybar.sh b/config/hypr/scripts/RefreshNoWaybar.sh index dc99b623..be06167c 100755 --- a/config/hypr/scripts/RefreshNoWaybar.sh +++ b/config/hypr/scripts/RefreshNoWaybar.sh @@ -5,6 +5,16 @@ # Modified inorder to refresh rofi background, Pywal SCRIPTSDIR=$HOME/.config/hypr/scripts +UserSCRIPTSDIR=$HOME/.config/hypr/UserScripts + +# Define file_exists function +file_exists() { + if [ -e "$1" ]; then + return 0 # File exists + else + return 1 # File does not exist + fi +} # Kill already running processes _ps=(rofi) @@ -17,10 +27,13 @@ done # Pywal refresh ${SCRIPTSDIR}/PywalSwww.sh & - -# Relaunching rainbow borders +# Relaunching rainbow borders if the script exists sleep 1 -${SCRIPTSDIR}/RainbowBorders.sh & +if file_exists "${UserSCRIPTSDIR}/RainbowBorders.sh"; then + ${UserSCRIPTSDIR}/RainbowBorders.sh & +fi # for cava-pywal (note, need to manually restart cava once wallpaper changes) -ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true
\ No newline at end of file +ln -sf "$HOME/.cache/wal/cava-colors" "$HOME/.config/cava/config" || true + +exit 0
\ No newline at end of file diff --git a/config/hypr/scripts/Weather.py b/config/hypr/scripts/Weather.py deleted file mode 100755 index 154c1589..00000000 --- a/config/hypr/scripts/Weather.py +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env python3 -# From https://raw.githubusercontent.com/rxyhn/dotfiles/main/home/rxyhn/modules/desktop/waybar/scripts/waybar-wttr.py - -## ensure to insert city inside "" -city = "" -import json -import requests -from datetime import datetime - -WEATHER_CODES = { - '113': '', - '116': '', - '119': '', - '122': '', - '143': '', - '176': '', - '179': '', - '182': '', - '185': '', - '200': '⛈️', - '227': '🌨️', - '230': '🌨️', - '248': '☁️ ', - '260': '☁️', - '263': '🌧️', - '266': '🌧️', - '281': '🌧️', - '284': '🌧️', - '293': '🌧️', - '296': '🌧️', - '299': '🌧️', - '302': '🌧️', - '305': '🌧️', - '308': '🌧️', - '311': '🌧️', - '314': '🌧️', - '317': '🌧️', - '320': '🌨️', - '323': '🌨️', - '326': '🌨️', - '329': '❄️', - '332': '❄️', - '335': '❄️', - '338': '❄️', - '350': '🌧️', - '353': '🌧️', - '356': '🌧️', - '359': '🌧️', - '362': '🌧️', - '365': '🌧️', - '368': '🌧️', - '371': '❄️', - '374': '🌨️', - '377': '🌨️', - '386': '🌨️', - '389': '🌨️', - '392': '🌧️', - '395': '❄️' -} - -data = {} - - -weather = requests.get(f"https://wttr.in/{city}?format=j1").json() - - -def format_time(time): - return time.replace("00", "").zfill(2) - - -def format_temp(temp): - return (hour['FeelsLikeC']+"°").ljust(3) - - -def format_chances(hour): - chances = { - "chanceoffog": "Fog", - "chanceoffrost": "Frost", - "chanceofovercast": "Overcast", - "chanceofrain": "Rain", - "chanceofsnow": "Snow", - "chanceofsunshine": "Sunshine", - "chanceofthunder": "Thunder", - "chanceofwindy": "Wind" - } - - conditions = [] - for event in chances.keys(): - if int(hour[event]) > 0: - conditions.append(chances[event]+" "+hour[event]+"%") - return ", ".join(conditions) - -tempint = int(weather['current_condition'][0]['FeelsLikeC']) -extrachar = '' -if tempint > 0 and tempint < 10: - extrachar = '+' - - -data['text'] = ' '+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \ - " "+extrachar+weather['current_condition'][0]['FeelsLikeC']+"°" - -data['tooltip'] = f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°</b>\n" -data['tooltip'] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\n" -data['tooltip'] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n" -data['tooltip'] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n" -for i, day in enumerate(weather['weather']): - data['tooltip'] += f"\n<b>" - if i == 0: - data['tooltip'] += "Today, " - if i == 1: - data['tooltip'] += "Tomorrow, " - data['tooltip'] += f"{day['date']}</b>\n" - data['tooltip'] += f"⬆️{day['maxtempC']}° ⬇️{day['mintempC']}° " - data['tooltip'] += f"🌅{day['astronomy'][0]['sunrise']} 🌇{day['astronomy'][0]['sunset']}\n" - for hour in day['hourly']: - if i == 0: - if int(format_time(hour['time'])) < datetime.now().hour-2: - continue - data['tooltip'] += f"{format_time(hour['time'])} {WEATHER_CODES[hour['weatherCode']]} {format_temp(hour['FeelsLikeC'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n" - - -print(json.dumps(data)) diff --git a/config/hypr/scripts/Weather.sh b/config/hypr/scripts/Weather.sh deleted file mode 100755 index 40048710..00000000 --- a/config/hypr/scripts/Weather.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -city= -cachedir=~/.cache/rbn -cachefile=${0##*/}-$1 - -if [ ! -d $cachedir ]; then - mkdir -p $cachedir -fi - -if [ ! -f $cachedir/$cachefile ]; then - touch $cachedir/$cachefile -fi - -# Save current IFS -SAVEIFS=$IFS -# Change IFS to new line. -IFS=$'\n' - -cacheage=$(($(date +%s) - $(stat -c '%Y' "$cachedir/$cachefile"))) -if [ $cacheage -gt 1740 ] || [ ! -s $cachedir/$cachefile ]; then - data=($(curl -s https://en.wttr.in/"$city"$1\?0qnT 2>&1)) - echo ${data[0]} | cut -f1 -d, > $cachedir/$cachefile - echo ${data[1]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile - echo ${data[2]} | sed -E 's/^.{15}//' >> $cachedir/$cachefile -fi - -weather=($(cat $cachedir/$cachefile)) - -# Restore IFSClear -IFS=$SAVEIFS - -temperature=$(echo ${weather[2]} | sed -E 's/([[:digit:]]+)\.\./\1 to /g') - -#echo ${weather[1]##*,} - -# https://fontawesome.com/icons?s=solid&c=weather -case $(echo ${weather[1]##*,} | tr '[:upper:]' '[:lower:]') in -"clear" | "sunny") - condition="" - ;; -"partly cloudy") - condition="" - ;; -"cloudy") - condition="" - ;; -"overcast") - condition="" - ;; -"fog" | "freezing fog") - condition="" - ;; -"patchy rain possible" | "patchy light drizzle" | "light drizzle" | "patchy light rain" | "light rain" | "light rain shower" | "mist" | "rain") - condition="" - ;; -"moderate rain at times" | "moderate rain" | "heavy rain at times" | "heavy rain" | "moderate or heavy rain shower" | "torrential rain shower" | "rain shower") - condition="" - ;; -"patchy snow possible" | "patchy sleet possible" | "patchy freezing drizzle possible" | "freezing drizzle" | "heavy freezing drizzle" | "light freezing rain" | "moderate or heavy freezing rain" | "light sleet" | "ice pellets" | "light sleet showers" | "moderate or heavy sleet showers") - condition="" - ;; -"blowing snow" | "moderate or heavy sleet" | "patchy light snow" | "light snow" | "light snow showers") - condition="" - ;; -"blizzard" | "patchy moderate snow" | "moderate snow" | "patchy heavy snow" | "heavy snow" | "moderate or heavy snow with thunder" | "moderate or heavy snow showers") - condition="" - ;; -"thundery outbreaks possible" | "patchy light rain with thunder" | "moderate or heavy rain with thunder" | "patchy light snow with thunder") - condition="" - ;; -*) - condition="" - echo -e "{\"text\":\""$condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" - ;; -esac - -#echo $temp $condition - -echo -e "{\"text\":\""$temperature $condition"\", \"alt\":\""${weather[0]}"\", \"tooltip\":\""${weather[0]}: $temperature ${weather[1]}"\"}" diff --git a/config/hypr/scripts/ZshChangeTheme.sh b/config/hypr/scripts/ZshChangeTheme.sh deleted file mode 100755 index 7057ed2e..00000000 --- a/config/hypr/scripts/ZshChangeTheme.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -themes_dir="$HOME/.oh-my-zsh/themes" -file_extension=".zsh-theme" - -themes_array=($(find "$themes_dir" -type f -name "*$file_extension" -exec basename {} \; | sed -e "s/$file_extension//")) - -rofi_command="rofi -dmenu -config ~/.config/rofi/config-zsh-theme.rasi" - -menu() { - for theme in "${themes_array[@]}"; do - echo "$theme" - done -} - -main() { - choice=$(menu | ${rofi_command}) - - # if nothing selected, script wont change anything - if [ -z "$choice" ]; then - exit 0 - fi - - zsh_path="$HOME/.zshrc" - var_name="ZSH_THEME" - for i in "${themes_array[@]}"; do - if [[ "$i" == "$choice"* ]]; then - if [ -f "$zsh_path" ]; then - sed -i "s/^$var_name=.*/$var_name=\"$i\"/" "$zsh_path" - else - echo "File not found" - fi - break - fi - done -} - -main |
