diff options
Diffstat (limited to 'config/hypr/scripts')
| -rwxr-xr-x | config/hypr/scripts/DarkLight.sh | 13 | ||||
| -rwxr-xr-x | config/hypr/scripts/PywalDunst.sh | 24 | ||||
| -rwxr-xr-x | config/hypr/scripts/PywalSwww.sh | 4 | ||||
| -rwxr-xr-x | config/hypr/scripts/Refresh.sh | 6 | ||||
| -rwxr-xr-x | config/hypr/scripts/Wallpaper.sh | 12 | ||||
| -rwxr-xr-x | config/hypr/scripts/WallpaperRandom.sh | 7 | ||||
| -rwxr-xr-x | config/hypr/scripts/WallpaperSelect.sh | 20 | ||||
| -rwxr-xr-x | config/hypr/scripts/WaybarLayout.sh | 45 | ||||
| -rwxr-xr-x | config/hypr/scripts/WaybarStyles.sh | 44 |
9 files changed, 116 insertions, 59 deletions
diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index 53e1c7d5..b734abc3 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -4,12 +4,11 @@ set -x wallpaper_path="$HOME/Pictures/wallpapers/Dynamic-Wallpapers" hypr_config_path="$HOME/.config/hypr" waybar_config="$HOME/.config/waybar" -dunst_config="$HOME/.config/dunst" +SCRIPTSDIR="$HOME/.config/hypr/scripts" dark_rofi_pywal="$HOME/.cache/wal/colors-rofi-dark.rasi" light_rofi_pywal="$HOME/.cache/wal/colors-rofi-light.rasi" - # Tokyo Night light_gtk_theme="Tokyonight-Light-B" dark_gtk_theme="Tokyonight-Dark-B" @@ -23,7 +22,7 @@ swww query || swww init # Set swww options swww="swww img" -effect="--transition-bezier .43,1.19,1,.4 --transition-fps 60 --transition-type grow --transition-pos 0.925,0.977 --transition-duration 2" +effect="--transition-bezier .43,1.19,1,.4 --transition-fps 30 --transition-type random --transition-pos 0.925,0.977 --transition-duration 2" # Define functions for notifying user and updating symlinks notify_user() { @@ -41,8 +40,6 @@ fi path_param=$(echo $next_mode | sed 's/.*/\u&/') notify_user "$next_mode" -#ln -sf "${waybar_config}/style/style-pywal.css" "${waybar_config}/style.css" -ln -sf "${dunst_config}/styles/dunstrc-${next_mode}" "${dunst_config}/dunstrc" # Symlink for rofi theme if [ "$next_mode" = "dark" ]; then @@ -71,6 +68,8 @@ $swww "${next_wallpaper}" $effect echo "$next_mode" > ~/.cache/.wallpaper_mode echo "$next_wallpaper" > ~/.cache/.current_wallpaper -exec ~/.config/hypr/scripts/PywalSwww.sh & +${SCRIPTSDIR}/PywalSwww.sh & sleep 2 -exec ~/.config/hypr/scripts/Refresh.sh &
\ No newline at end of file +${SCRIPTSDIR}/Refresh.sh & +sleep 1 +${SCRIPTSDIR}/PywalDunst.sh
\ No newline at end of file diff --git a/config/hypr/scripts/PywalDunst.sh b/config/hypr/scripts/PywalDunst.sh new file mode 100755 index 00000000..410c55b8 --- /dev/null +++ b/config/hypr/scripts/PywalDunst.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# -lf/nf/cf color +# Defines the foreground color for low, normal and critical notifications respectively. +# +# -lb/nb/cb color +# Defines the background color for low, normal and critical notifications respectively. +# +# -lfr/nfr/cfr color +# Defines the frame color for low, normal and critical notifications respectively. + +[ -f "$HOME/.cache/wal/colors.sh" ] && . "$HOME/.cache/wal/colors.sh" + +pidof dunst && pkill dunst + +DUNST_FILE=$HOME/.config/dunst/dunstrc + +# update dunst based on pywal colors. +sed -i '/background = /s/.*/ background = "'$color0'"/' $DUNST_FILE +sed -i '/foreground = /s/.*/ foreground = "'$color7'"/' $DUNST_FILE +sed -i '/frame_color = /s/.*/ frame_color = "'$color2'"/' $DUNST_FILE + + +dunst -conf $HOME/.config/dunst/dunstrc > /dev/null 2>&1 &
\ No newline at end of file diff --git a/config/hypr/scripts/PywalSwww.sh b/config/hypr/scripts/PywalSwww.sh index 2a18122e..db4d706a 100755 --- a/config/hypr/scripts/PywalSwww.sh +++ b/config/hypr/scripts/PywalSwww.sh @@ -28,6 +28,6 @@ done wal -i $wallpaper_path # execute pywal skipping tty and terminal -#wal -i $wallpaper_path -s -t +#wal -i $wallpaper_path -s -t & -# more info regarding Pywal https://github.com/dylanaraps/pywal/wiki/Getting-Started
\ No newline at end of file +# more info regarding Pywal https://github.com/dylanaraps/pywal/wiki/Getting-Started diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 3037458b..d1b8592e 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -3,16 +3,16 @@ SCRIPTSDIR=$HOME/.config/hypr/scripts # Kill already running processes -_ps=(waybar dunst rofi) +_ps=(waybar rofi) for _prs in "${_ps[@]}"; do if pidof "${_prs}" >/dev/null; then pkill "${_prs}" fi done -# relaunch apps -dunst & +# Relaunch waybar waybar & +## trying to figure out how to restart Rainbow borders #sleep 1 #${SCRIPTSDIR}/RainbowBorders.sh &
\ No newline at end of file diff --git a/config/hypr/scripts/Wallpaper.sh b/config/hypr/scripts/Wallpaper.sh index d5ea4645..52502642 100755 --- a/config/hypr/scripts/Wallpaper.sh +++ b/config/hypr/scripts/Wallpaper.sh @@ -1,12 +1,18 @@ #!/bin/bash -DIR=$HOME/Pictures/wallpapers/ +DIR="$HOME/Pictures/wallpapers/" +SCRIPTSDIR="$HOME/.config/hypr/scripts" + PICS=($(find ${DIR} -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \))) RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]} swww query || swww init swww img ${RANDOMPICS} --transition-fps 30 --transition-type any --transition-duration 3 -exec $HOME/.config/hypr/scripts/PywalSwww.sh & + + +${SCRIPTSDIR}/PywalSwww.sh & +sleep 1 +${SCRIPTSDIR}/Refresh.sh & sleep 1 -exec $HOME/.config/hypr/scripts/Refresh.sh
\ No newline at end of file +${SCRIPTSDIR}/PywalDunst.sh
\ No newline at end of file diff --git a/config/hypr/scripts/WallpaperRandom.sh b/config/hypr/scripts/WallpaperRandom.sh index 13bc5033..35bfcf8a 100755 --- a/config/hypr/scripts/WallpaperRandom.sh +++ b/config/hypr/scripts/WallpaperRandom.sh @@ -2,9 +2,12 @@ # 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 pywal_script=$HOME/.config/hypr/scripts/PywalSwww.sh pywal_refresh=$HOME/.config/hypr/scripts/Refresh.sh +pywal_dunst=$HOME/.config/hypr/scripts/PywalDunst.sh if [[ $# -lt 1 ]] || [[ ! -d $1 ]]; then echo "Usage: @@ -18,7 +21,7 @@ export SWWW_TRANSITION_STEP=2 export SWWW_TRANSITION_TYPE=random # This controls (in seconds) when to switch to the next image -INTERVAL=300 +INTERVAL=600 while true; do find "$1" \ @@ -27,7 +30,7 @@ while true; do done \ | sort -n | cut -d':' -f2- \ | while read -r img; do - swww img "$img" && $pywal_script && $pywal_refresh + swww img "$img" && $pywal_script && $pywal_refresh && $pywal_dunst sleep $INTERVAL done diff --git a/config/hypr/scripts/WallpaperSelect.sh b/config/hypr/scripts/WallpaperSelect.sh index d748318a..0d899a10 100755 --- a/config/hypr/scripts/WallpaperSelect.sh +++ b/config/hypr/scripts/WallpaperSelect.sh @@ -1,6 +1,9 @@ #!/bin/bash + +SCRIPTSDIR="$HOME/.config/hypr/scripts" + # WALLPAPERS PATH -DIR=$HOME/Pictures/wallpapers +DIR="$HOME/Pictures/wallpapers/" # Transition config FPS=30 @@ -25,13 +28,14 @@ menu() { for i in "${!PICS[@]}"; do # Displaying .gif to indicate animated images if [[ -z $(echo "${PICS[$i]}" | grep .gif$) ]]; then - printf "$i. $(echo "${PICS[$i]}" | cut -d. -f1)\n" + filename=$(basename "${PICS[$i]}" | sed 's/\.[^.]*$//') # Remove file extension + printf "%s\n" "${filename//[[:digit:]]/}" # Remove leading numbers else - printf "$i. ${PICS[$i]}\n" + printf "%s\n" "${PICS[$i]}" fi done - printf "$RANDOM_PIC_NAME" + printf "%s\n" "$RANDOM_PIC_NAME" } swww query || swww init @@ -50,7 +54,7 @@ main() { exit 0 fi - pic_index=$(echo "$choice" | cut -d. -f1) + pic_index=$(printf '%s\n' "${!PICS[@]}" | grep -E "\b${choice}\b") # Get index based on choice swww img "${DIR}/${PICS[$pic_index]}" $SWWW_PARAMS } @@ -62,5 +66,7 @@ fi main -$HOME/.config/hypr/scripts/PywalSwww.sh & -$HOME/.config/hypr/scripts/Refresh.sh +${SCRIPTSDIR}/PywalSwww.sh & +${SCRIPTSDIR}/Refresh.sh & +sleep 1 +${SCRIPTSDIR}/PywalDunst.sh diff --git a/config/hypr/scripts/WaybarLayout.sh b/config/hypr/scripts/WaybarLayout.sh index dd5fc387..dbe0ee7f 100755 --- a/config/hypr/scripts/WaybarLayout.sh +++ b/config/hypr/scripts/WaybarLayout.sh @@ -1,26 +1,42 @@ #!/bin/bash -CONFIG="$HOME/.config/waybar/configs" -WCONFIG="$HOME/.config/waybar/config" +set -euo pipefail +IFS=$'\n\t' +# Define directories +config_dir="$HOME/.config/waybar/configs" +waybar_config="$HOME/.config/waybar/config" +scripts_dir="$HOME/.config/hypr/scripts" +rofi_config="$HOME/.config/rofi/config-waybar-layout.rasi" + +# Function to display menu options menu() { - # List only files (excluding directories) in the directory and sort alphabetically options=() while IFS= read -r file; do - if [ -f "$CONFIG/$file" ]; then - options+=("$file") - fi - done < <(find "$CONFIG" -maxdepth 1 -type f -exec basename {} \; | sort) - + options+=("$(basename "$file")") + done < <(find "$config_dir" -maxdepth 1 -type f -exec basename {} \; | sort) + printf '%s\n' "${options[@]}" } +# Apply selected configuration apply_config() { - ln -sf "$CONFIG/$1" "$WCONFIG" + ln -sf "$config_dir/$1" "$waybar_config" + restart_waybar_if_needed +} + +# Restart Waybar +restart_waybar_if_needed() { + if pgrep -x "waybar" >/dev/null; then + pkill waybar + sleep 0.1 # Delay for Waybar to completely terminate + fi + "${scripts_dir}/Refresh.sh" & } +# Main function main() { - choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-waybar-layout.rasi) + choice=$(menu | rofi -dmenu -config "$rofi_config") if [[ -z "$choice" ]]; then echo "No option selected. Exiting." @@ -29,10 +45,7 @@ main() { case $choice in "no panel") - if pgrep -x "waybar" >/dev/null; then - pkill waybar - fi - exit 0 + pgrep -x "waybar" && pkill waybar || true ;; *) apply_config "$choice" @@ -40,12 +53,10 @@ main() { esac } -# Check if rofi is already running +# Kill Rofi if already running before execution if pgrep -x "rofi" >/dev/null; then pkill rofi exit 0 fi main - -~/.config/hypr/scripts/Refresh.sh & diff --git a/config/hypr/scripts/WaybarStyles.sh b/config/hypr/scripts/WaybarStyles.sh index 8a420f55..9395c528 100755 --- a/config/hypr/scripts/WaybarStyles.sh +++ b/config/hypr/scripts/WaybarStyles.sh @@ -1,26 +1,44 @@ #!/bin/bash -CONFIG="$HOME/.config/waybar/style" -WCONFIG="$HOME/.config/waybar/style.css" +set -euo pipefail +IFS=$'\n\t' +# Define directories +config_dir="$HOME/.config/waybar/style" +waybar_config="$HOME/.config/waybar/style.css" +scripts_dir="$HOME/.config/hypr/scripts" +rofi_config="$HOME/.config/rofi/config-waybar-style.rasi" + +# Function to display menu options menu() { - # List only files (excluding directories) in the directory and sort alphabetically options=() while IFS= read -r file; do - if [ -f "$CONFIG/$file" ]; then + if [ -f "$config_dir/$file" ]; then options+=("$(basename "$file" .css)") fi - done < <(find "$CONFIG" -maxdepth 1 -type f -name '*.css' -exec basename {} \; | sort) + done < <(find "$config_dir" -maxdepth 1 -type f -name '*.css' -exec basename {} \; | sort) printf '%s\n' "${options[@]}" } +# Apply selected style apply_style() { - ln -sf "$CONFIG/$1.css" "$WCONFIG" + ln -sf "$config_dir/$1.css" "$waybar_config" + restart_waybar_if_needed +} + +# Restart Waybar if it's running +restart_waybar_if_needed() { + if pgrep -x "waybar" >/dev/null; then + pkill waybar + sleep 0.1 # Delay for Waybar to completely terminate + fi + "${scripts_dir}/Refresh.sh" & } +# Main function main() { - choice=$(menu | rofi -dmenu -config ~/.config/rofi/config-waybar-style.rasi) + choice=$(menu | rofi -dmenu -config "$rofi_config") if [[ -z "$choice" ]]; then echo "No option selected. Exiting." @@ -28,19 +46,9 @@ main() { fi apply_style "$choice" - - # Restart relevant processes - for process in waybar dunst; do - if pgrep -x "$process" >/dev/null; then - pkill "$process" - fi - done - - # Launch Refresh.sh in the background - ~/.config/hypr/scripts/Refresh.sh & } -# Check if rofi is already running +# Kill Rofi if already running before execution if pgrep -x "rofi" >/dev/null; then pkill rofi exit 0 |
