Moves from i3 to hypr
This commit is contained in:
parent
6f069d32e1
commit
a186edca69
380 changed files with 23450 additions and 27796 deletions
5
.config/hypr/UserScripts/00-Readme
Executable file
5
.config/hypr/UserScripts/00-Readme
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ #
|
||||
|
||||
# Place your new scripts here.
|
||||
# If you need to edit a script from main script (~/.config/hypr/scripts), copy it on this folder, and edit.
|
||||
# Make sure to update as well the keybinds in ~/.config/hypr/UserConfigs folder if any script is linked to it
|
||||
59
.config/hypr/UserScripts/QuickEdit.sh
Executable file
59
.config/hypr/UserScripts/QuickEdit.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/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"
|
||||
|
||||
# Function to display the menu options
|
||||
menu() {
|
||||
cat <<EOF
|
||||
1. View / Edit Env-variables
|
||||
2. View / Edit Window-Rules
|
||||
3. View / Edit Startup_Apps
|
||||
4. View / Edit User-Keybinds
|
||||
5. View / Edit Monitors
|
||||
6. View / Edit Laptop-Keybinds
|
||||
7. View / Edit User-Settings
|
||||
8. View / Edit Decorations & Animations
|
||||
9. View / Edit Workspace-Rules
|
||||
10. View / Edit Default-Settings
|
||||
11. View / Edit Default-Keybinds
|
||||
EOF
|
||||
}
|
||||
|
||||
# Main function to handle menu selection
|
||||
main() {
|
||||
choice=$(menu | rofi -i -dmenu -config ~/.config/rofi/config-compact.rasi | cut -d. -f1)
|
||||
|
||||
# Map choices to corresponding files
|
||||
case $choice in
|
||||
1) file="$UserConfigs/ENVariables.conf" ;;
|
||||
2) file="$UserConfigs/WindowRules.conf" ;;
|
||||
3) file="$UserConfigs/Startup_Apps.conf" ;;
|
||||
4) file="$UserConfigs/UserKeybinds.conf" ;;
|
||||
5) file="$UserConfigs/Monitors.conf" ;;
|
||||
6) file="$UserConfigs/Laptops.conf" ;;
|
||||
7) file="$UserConfigs/UserSettings.conf" ;;
|
||||
8) file="$UserConfigs/UserDecorAnimations.conf" ;;
|
||||
9) file="$UserConfigs/WorkspaceRules.conf" ;;
|
||||
10) file="$configs/Settings.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
|
||||
14
.config/hypr/UserScripts/RainbowBorders.sh
Executable file
14
.config/hypr/UserScripts/RainbowBorders.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
|
||||
# for rainbow borders animation
|
||||
|
||||
function random_hex() {
|
||||
random_hex=("0xff$(openssl rand -hex 3)")
|
||||
echo $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
|
||||
|
||||
# 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
|
||||
120
.config/hypr/UserScripts/RofiBeats.sh
Executable file
120
.config/hypr/UserScripts/RofiBeats.sh
Executable file
|
|
@ -0,0 +1,120 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
|
||||
# For Rofi Beats to play online Music or Locally save media files
|
||||
|
||||
# Directory local music folder
|
||||
mDIR="$HOME/Music/"
|
||||
|
||||
# Directory for icons
|
||||
iDIR="$HOME/.config/swaync/icons"
|
||||
|
||||
# Online Stations. Edit as required
|
||||
declare -A online_music=(
|
||||
["Radio - Lofi Girl 🎧🎶"]="https://play.streamafrica.net/lofiradio"
|
||||
["Radio - Chillhop 🎧🎶"]="http://stream.zeno.fm/fyn8eh3h5f8uv"
|
||||
["FM - Easy Rock 96.3 📻🎶"]="https://radio-stations-philippines.com/easy-rock"
|
||||
["FM - Easy Rock - Baguio 91.9 📻🎶"]="https://radio-stations-philippines.com/easy-rock-baguio"
|
||||
["FM - Love Radio 90.7 📻🎶"]="https://radio-stations-philippines.com/love"
|
||||
["FM - WRock - CEBU 96.3 📻🎶"]="https://onlineradio.ph/126-96-3-wrock.html"
|
||||
["FM - Fresh Philippines 📻🎶"]="https://onlineradio.ph/553-fresh-fm.html"
|
||||
["YT - Wish 107.5 YT Pinoy HipHop 📻🎶"]="https://youtube.com/playlist?list=PLkrzfEDjeYJnmgMYwCKid4XIFqUKBVWEs&si=vahW_noh4UDJ5d37"
|
||||
["YT - Top Youtube Music 2023 📹🎶"]="https://youtube.com/playlist?list=PLDIoUOhQQPlXr63I_vwF9GD8sAKh77dWU&si=y7qNeEVFNgA-XxKy"
|
||||
["YT - Wish 107.5 YT Wishclusives 📹🎶"]="https://youtube.com/playlist?list=PLkrzfEDjeYJn5B22H9HOWP3Kxxs-DkPSM&si=d_Ld2OKhGvpH48WO"
|
||||
["YT - Relaxing Music 📹🎶"]="https://youtube.com/playlist?list=PLMIbmfP_9vb8BCxRoraJpoo4q1yMFg4CE"
|
||||
["YT - Youtube Remix 📹🎶"]="https://youtube.com/playlist?list=PLeqTkIUlrZXlSNn3tcXAa-zbo95j0iN-0"
|
||||
["YT - Korean Drama OST 📹🎶"]="https://youtube.com/playlist?list=PLUge_o9AIFp4HuA-A3e3ZqENh63LuRRlQ"
|
||||
["YT - AfroBeatz 2024 📹🎶"]="https://www.youtube.com/watch?v=7uB-Eh9XVZQ"
|
||||
["YT - Relaxing Piano Jazz Music 🎹🎶"]="https://youtu.be/85UEqRat6E4?si=jXQL1Yp2VP_G6NSn"
|
||||
)
|
||||
|
||||
# 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" -o -iname "*.mp4" \))
|
||||
}
|
||||
|
||||
# Function for displaying notifications
|
||||
notification() {
|
||||
notify-send -u normal -i "$iDIR/music.png" " Now Playing:" " $@"
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
# Find the corresponding file path based on user's choice and set that to play the song then continue on the list
|
||||
for (( i=0; i<"${#filenames[@]}"; ++i )); do
|
||||
if [ "${filenames[$i]}" = "$choice" ]; then
|
||||
|
||||
notification "$choice"
|
||||
|
||||
# Play the selected local music file using mpv
|
||||
mpv --playlist-start="$i" --loop-playlist --vid=no "${local_music[@]}"
|
||||
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Main function for shuffling local music
|
||||
shuffle_local_music() {
|
||||
notification "Shuffle Play local music"
|
||||
|
||||
# Play music in $mDIR on shuffle
|
||||
mpv --shuffle --loop-playlist --vid=no "$mDIR"
|
||||
}
|
||||
|
||||
# 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" "Music stopped" || {
|
||||
|
||||
# Check if rofi is already running
|
||||
if pidof rofi > /dev/null; then
|
||||
pkill rofi
|
||||
fi
|
||||
|
||||
|
||||
# Prompt the user to choose between local and online music
|
||||
user_choice=$(printf "Play from Online Stations\nPlay from Music Folder\nShuffle Play from Music Folder" | 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
|
||||
;;
|
||||
"Shuffle Play from Music Folder")
|
||||
shuffle_local_music
|
||||
;;
|
||||
*)
|
||||
echo "Invalid choice"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
30
.config/hypr/UserScripts/RofiCalc.sh
Executable file
30
.config/hypr/UserScripts/RofiCalc.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */
|
||||
# /* Calculator (using qalculate) and rofi */
|
||||
# /* Submitted by: https://github.com/JosephArmas */
|
||||
|
||||
rofi_config="$HOME/.config/rofi/config-calc.rasi"
|
||||
|
||||
# Kill Rofi if already running before execution
|
||||
if pgrep -x "rofi" >/dev/null; then
|
||||
pkill rofi
|
||||
fi
|
||||
|
||||
# main function
|
||||
|
||||
while true; do
|
||||
result=$(
|
||||
rofi -i -dmenu \
|
||||
-config "$rofi_config" \
|
||||
-mesg "$result = $calc_result"
|
||||
)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ -n "$result" ]; then
|
||||
calc_result=$(qalc -t "$result")
|
||||
echo "$calc_result" | wl-copy
|
||||
fi
|
||||
done
|
||||
39
.config/hypr/UserScripts/WallpaperAutoChange.sh
Executable file
39
.config/hypr/UserScripts/WallpaperAutoChange.sh
Executable file
|
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
|
||||
# source https://wiki.archlinux.org/title/Hyprland#Using_a_script_to_change_wallpaper_every_X_minutes
|
||||
|
||||
# This script will randomly go through the files of a directory, setting it
|
||||
# up as the wallpaper at regular intervals
|
||||
#
|
||||
# NOTE: this script uses bash (not POSIX shell) for the RANDOM variable
|
||||
|
||||
wallust_refresh=$HOME/.config/hypr/scripts/RefreshNoWaybar.sh
|
||||
|
||||
focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
|
||||
|
||||
if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then
|
||||
echo "Usage:
|
||||
$0 <dir containing images>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Edit below to control the images transition
|
||||
export SWWW_TRANSITION_FPS=60
|
||||
export SWWW_TRANSITION_TYPE=simple
|
||||
|
||||
# This controls (in seconds) when to switch to the next image
|
||||
INTERVAL=1800
|
||||
|
||||
while true; do
|
||||
find "$1" \
|
||||
| while read -r img; do
|
||||
echo "$((RANDOM % 1000)):$img"
|
||||
done \
|
||||
| sort -n | cut -d':' -f2- \
|
||||
| while read -r img; do
|
||||
swww img -o $focused_monitor "$img"
|
||||
$wallust_refresh
|
||||
sleep $INTERVAL
|
||||
|
||||
done
|
||||
done
|
||||
100
.config/hypr/UserScripts/WallpaperEffects.sh
Executable file
100
.config/hypr/UserScripts/WallpaperEffects.sh
Executable file
|
|
@ -0,0 +1,100 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ #
|
||||
# Wallpaper Effects using ImageMagick (SUPER SHIFT W)
|
||||
|
||||
# Variables
|
||||
current_wallpaper="$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 | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
|
||||
|
||||
# Directory for swaync
|
||||
iDIR="$HOME/.config/swaync/images"
|
||||
|
||||
# swww transition config
|
||||
FPS=60
|
||||
TYPE="wipe"
|
||||
DURATION=2
|
||||
BEZIER=".43,1.19,1,.4"
|
||||
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION"
|
||||
|
||||
# Define ImageMagick effects
|
||||
declare -A effects=(
|
||||
["No Effects"]="no-effects"
|
||||
["Black & White"]="magick $current_wallpaper -colorspace gray -sigmoidal-contrast 10,40% $wallpaper_output"
|
||||
["Blurred"]="magick $current_wallpaper -blur 0x10 $wallpaper_output"
|
||||
["Charcoal"]="magick $current_wallpaper -charcoal 0x5 $wallpaper_output"
|
||||
["Edge Detect"]="magick $current_wallpaper -edge 1 $wallpaper_output"
|
||||
["Emboss"]="magick $current_wallpaper -emboss 0x5 $wallpaper_output"
|
||||
["Negate"]="magick $current_wallpaper -negate $wallpaper_output"
|
||||
["Oil Paint"]="magick $current_wallpaper -paint 4 $wallpaper_output"
|
||||
["Posterize"]="magick $current_wallpaper -posterize 4 $wallpaper_output"
|
||||
["Polaroid"]="magick $current_wallpaper -polaroid 0 $wallpaper_output"
|
||||
["Sepia Tone"]="magick $current_wallpaper -sepia-tone 65% $wallpaper_output"
|
||||
["Solarize"]="magick $current_wallpaper -solarize 80% $wallpaper_output"
|
||||
["Sharpen"]="magick $current_wallpaper -sharpen 0x5 $wallpaper_output"
|
||||
["Vignette"]="magick $current_wallpaper -vignette 0x5 $wallpaper_output"
|
||||
["Zoomed"]="magick $current_wallpaper -gravity Center -extent 1:1 $wallpaper_output"
|
||||
)
|
||||
|
||||
# Function to apply no effects
|
||||
no-effects() {
|
||||
swww img -o "$focused_monitor" "$current_wallpaper" $SWWW_PARAMS &&
|
||||
# Wait for swww command to complete
|
||||
wait $!
|
||||
# Run other commands after swww
|
||||
wallust run "$current_wallpaper" -s &&
|
||||
wait $!
|
||||
# Refresh rofi, waybar, wallust palettes
|
||||
sleep 2
|
||||
"$SCRIPTSDIR/Refresh.sh"
|
||||
|
||||
notify-send -u low -i "$iDIR/bell.png" "No wallpaper" "effects applied"
|
||||
# copying wallpaper for rofi menu
|
||||
cp "$current_wallpaper" "$wallpaper_output"
|
||||
}
|
||||
|
||||
# Function to run rofi menu
|
||||
main() {
|
||||
# Populate rofi menu options
|
||||
options=("No Effects")
|
||||
for effect in "${!effects[@]}"; do
|
||||
[[ "$effect" != "No Effects" ]] && options+=("$effect")
|
||||
done
|
||||
|
||||
# Show rofi menu and handle user choice
|
||||
choice=$(printf "%s\n" "${options[@]}" | LC_COLLATE=C sort | rofi -dmenu -p "Choose effect" -i -config ~/.config/rofi/config-wallpaper-effect.rasi)
|
||||
|
||||
# Process user choice
|
||||
if [[ -n "$choice" ]]; then
|
||||
if [[ "$choice" == "No Effects" ]]; then
|
||||
no-effects
|
||||
elif [[ "${effects[$choice]+exists}" ]]; then
|
||||
# Apply selected effect
|
||||
notify-send -u normal -i "$iDIR/bell.png" "Applying:" "$choice effects"
|
||||
eval "${effects[$choice]}"
|
||||
# Wait for effects to be applied
|
||||
sleep 1
|
||||
# Execute swww command after image conversion
|
||||
swww img -o "$focused_monitor" "$wallpaper_output" $SWWW_PARAMS &
|
||||
# Wait for swww command to complete
|
||||
sleep 2
|
||||
# Wait for other commands to finish
|
||||
wallust run "$wallpaper_output" -s &
|
||||
# Wait for other commands to finish
|
||||
sleep 0.5
|
||||
# Refresh rofi, waybar, wallust palettes
|
||||
"${SCRIPTSDIR}/Refresh.sh"
|
||||
notify-send -u low -i "$iDIR/bell.png" "$choice" "effects applied"
|
||||
else
|
||||
echo "Effect '$choice' not recognized."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if rofi is already running and kill it
|
||||
if pidof rofi > /dev/null; then
|
||||
pkill rofi
|
||||
fi
|
||||
|
||||
main
|
||||
30
.config/hypr/UserScripts/WallpaperRandom.sh
Executable file
30
.config/hypr/UserScripts/WallpaperRandom.sh
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
|
||||
# Script for Random Wallpaper ( CTRL ALT W)
|
||||
|
||||
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[@]} ]}
|
||||
|
||||
|
||||
# Transition config
|
||||
FPS=30
|
||||
TYPE="random"
|
||||
DURATION=1
|
||||
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 -o $focused_monitor ${RANDOMPICS} $SWWW_PARAMS
|
||||
|
||||
wait $!
|
||||
"$SCRIPTSDIR/WallustSwww.sh" &&
|
||||
|
||||
wait $!
|
||||
sleep 2
|
||||
"$SCRIPTSDIR/Refresh.sh"
|
||||
|
||||
110
.config/hypr/UserScripts/WallpaperSelect.sh
Executable file
110
.config/hypr/UserScripts/WallpaperSelect.sh
Executable file
|
|
@ -0,0 +1,110 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */
|
||||
# This script for selecting wallpapers (SUPER W)
|
||||
|
||||
# WALLPAPERS PATH
|
||||
wallDIR="$HOME/Pictures/wallpapers"
|
||||
SCRIPTSDIR="$HOME/.config/hypr/scripts"
|
||||
|
||||
# variables
|
||||
focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
|
||||
# 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"
|
||||
|
||||
# Check if swaybg is running
|
||||
if pidof swaybg > /dev/null; then
|
||||
pkill swaybg
|
||||
fi
|
||||
|
||||
# Retrieve image files using null delimiter to handle spaces in filenames
|
||||
mapfile -d '' PICS < <(find "${wallDIR}" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" \) -print0)
|
||||
|
||||
RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}"
|
||||
RANDOM_PIC_NAME=". random"
|
||||
|
||||
# Rofi command
|
||||
rofi_command="rofi -i -show -dmenu -config ~/.config/rofi/config-wallpaper.rasi"
|
||||
|
||||
# Sorting Wallpapers
|
||||
menu() {
|
||||
# Sort the PICS array
|
||||
IFS=$'\n' sorted_options=($(sort <<<"${PICS[*]}"))
|
||||
|
||||
# Place ". random" at the beginning with the random picture as an icon
|
||||
printf "%s\x00icon\x1f%s\n" "$RANDOM_PIC_NAME" "$RANDOM_PIC"
|
||||
|
||||
for pic_path in "${sorted_options[@]}"; do
|
||||
pic_name=$(basename "$pic_path")
|
||||
|
||||
# Displaying .gif to indicate animated images
|
||||
if [[ ! "$pic_name" =~ \.gif$ ]]; then
|
||||
printf "%s\x00icon\x1f%s\n" "$(echo "$pic_name" | cut -d. -f1)" "$pic_path"
|
||||
else
|
||||
printf "%s\n" "$pic_name"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# initiate swww if not running
|
||||
swww query || swww-daemon --format xrgb
|
||||
|
||||
# Choice of wallpapers
|
||||
main() {
|
||||
choice=$(menu | $rofi_command)
|
||||
|
||||
# Trim any potential whitespace or hidden characters
|
||||
choice=$(echo "$choice" | xargs)
|
||||
RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs)
|
||||
|
||||
# No choice case
|
||||
if [[ -z "$choice" ]]; then
|
||||
echo "No choice selected. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Random choice case
|
||||
if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then
|
||||
swww img -o "$focused_monitor" "$RANDOM_PIC" $SWWW_PARAMS;
|
||||
sleep 2
|
||||
"$SCRIPTSDIR/WallustSwww.sh"
|
||||
sleep 0.5
|
||||
"$SCRIPTSDIR/Refresh.sh"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Find the index of the selected file
|
||||
pic_index=-1
|
||||
for i in "${!PICS[@]}"; do
|
||||
filename=$(basename "${PICS[$i]}")
|
||||
if [[ "$filename" == "$choice"* ]]; then
|
||||
pic_index=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $pic_index -ne -1 ]]; then
|
||||
swww img -o "$focused_monitor" "${PICS[$pic_index]}" $SWWW_PARAMS
|
||||
else
|
||||
echo "Image not found."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if rofi is already running
|
||||
if pidof rofi > /dev/null; then
|
||||
pkill rofi
|
||||
fi
|
||||
|
||||
main
|
||||
|
||||
wait $!
|
||||
"$SCRIPTSDIR/WallustSwww.sh" &&
|
||||
|
||||
wait $!
|
||||
sleep 2
|
||||
"$SCRIPTSDIR/Refresh.sh"
|
||||
|
||||
138
.config/hypr/UserScripts/Weather.py
Executable file
138
.config/hypr/UserScripts/Weather.py
Executable file
|
|
@ -0,0 +1,138 @@
|
|||
#!/usr/bin/env python3
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ #
|
||||
# weather using python
|
||||
|
||||
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']"
|
||||
).text()
|
||||
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(1)
|
||||
.text()
|
||||
)
|
||||
temp_max = (
|
||||
html_data("div[data-testid='wxData'] > span[data-testid='TemperatureValue']")
|
||||
.eq(0)
|
||||
.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'<span size="xx-large">{temp}</span>',
|
||||
f"<big> {icon}</big>",
|
||||
f"<b>{status}</b>",
|
||||
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"<i> {prediction}</i>",
|
||||
)
|
||||
|
||||
# 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
|
||||
87
.config/hypr/UserScripts/Weather.sh
Executable file
87
.config/hypr/UserScripts/Weather.sh
Executable file
|
|
@ -0,0 +1,87 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
|
||||
# weather info from wttr. https://github.com/chubin/wttr.in
|
||||
# Remember to add city
|
||||
|
||||
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]}"\"}"
|
||||
|
||||
cached_weather=" $temperature \n$condition ${weather[1]}"
|
||||
|
||||
echo -e $cached_weather > ~/.cache/.weather_cache
|
||||
63
.config/hypr/UserScripts/ZshChangeTheme.sh
Executable file
63
.config/hypr/UserScripts/ZshChangeTheme.sh
Executable file
|
|
@ -0,0 +1,63 @@
|
|||
#!/bin/bash
|
||||
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
|
||||
# Script for Oh my ZSH theme ( CTRL SHIFT O)
|
||||
|
||||
# preview of theme can be view here: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
|
||||
# after choosing theme, TTY need to be closed and re-open
|
||||
|
||||
themes_dir="$HOME/.oh-my-zsh/themes"
|
||||
file_extension=".zsh-theme"
|
||||
|
||||
# Directory for swaync
|
||||
iDIR="$HOME/.config/swaync/images"
|
||||
|
||||
themes_array=($(find "$themes_dir" -type f -name "*$file_extension" -exec basename {} \; | sed -e "s/$file_extension//"))
|
||||
|
||||
# Add "Random" option to the beginning of the array
|
||||
themes_array=("Random" "${themes_array[@]}")
|
||||
|
||||
rofi_command="rofi -i -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 won't change anything
|
||||
if [ -z "$choice" ]; then
|
||||
notify-send -u low -i "$iDIR/bell.png" "No theme selected." "No changes made!"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
zsh_path="$HOME/.zshrc"
|
||||
var_name="ZSH_THEME"
|
||||
|
||||
if [[ "$choice" == "Random" ]]; then
|
||||
# Pick a random theme from the original themes_array (excluding "Random")
|
||||
random_theme=${themes_array[$((RANDOM % (${#themes_array[@]} - 1) + 1))]}
|
||||
theme_to_set="$random_theme"
|
||||
notify-send -i "$iDIR/bell.png" "Random theme:" "selected: $random_theme"
|
||||
else
|
||||
# Set theme to the selected choice
|
||||
theme_to_set="$choice"
|
||||
notify-send -i "$iDIR/bell.png" "Theme selected:" "$choice"
|
||||
fi
|
||||
|
||||
if [ -f "$zsh_path" ]; then
|
||||
sed -i "s/^$var_name=.*/$var_name=\"$theme_to_set\"/" "$zsh_path"
|
||||
notify-send -i "$iDIR/bell.png" "OMZ theme" "applied. restart your terminal"
|
||||
else
|
||||
notify-send "Error:" "~.zshrc file not found!"
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if rofi is already running
|
||||
if pidof rofi > /dev/null; then
|
||||
pkill rofi
|
||||
fi
|
||||
|
||||
main
|
||||
Loading…
Add table
Add a link
Reference in a new issue