diff options
| author | Ja.KooLit <jimmielovejay@gmail.com> | 2023-11-27 13:53:48 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-27 13:53:48 +0900 |
| commit | 8eeed24b9579cf4cc76cc67dc4b5c73b2ef34573 (patch) | |
| tree | 2115df3ef73ea54d71ba9ff84364c690b591af44 /config/hypr | |
| parent | 4502d47a44dd46306e0803ec0b27a0db48b2819c (diff) | |
| parent | f981d4fbbfb5f853b491a062e6e9017669102115 (diff) | |
Merge pull request #37 from JaKooLit/v2.1.10
V2.1.10
Diffstat (limited to 'config/hypr')
| -rw-r--r-- | config/hypr/configs/Execs.conf | 2 | ||||
| -rwxr-xr-x | config/hypr/scripts/Brightness.sh | 2 | ||||
| -rwxr-xr-x | config/hypr/scripts/DarkLight.sh | 17 | ||||
| -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/Volume.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 |
12 files changed, 123 insertions, 66 deletions
diff --git a/config/hypr/configs/Execs.conf b/config/hypr/configs/Execs.conf index 2cf5946b..478eac27 100644 --- a/config/hypr/configs/Execs.conf +++ b/config/hypr/configs/Execs.conf @@ -10,7 +10,7 @@ exec-once = $HOME/.config/hypr/initial-boot.sh # wallpaper stuff exec-once = swww query || swww init -exec-once = $SwwwRandom $WallpaperPath # random wallpaper switcher every 5 minutes +exec-once = $SwwwRandom $WallpaperPath # random wallpaper switcher every 15 minutes #exec-once = swww query || swww init && swww img $HOME/Pictures/wallpapers/mecha-nostalgia.png # persistent wallpaper # Startup diff --git a/config/hypr/scripts/Brightness.sh b/config/hypr/scripts/Brightness.sh index 72cff898..c5c0b80f 100755 --- a/config/hypr/scripts/Brightness.sh +++ b/config/hypr/scripts/Brightness.sh @@ -26,7 +26,7 @@ get_icon() { # Notify notify_user() { - notify-send -h string:x-dunst-stack-tag:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness : $current%" + dunstify -h string:x-dunst-stack-tag:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness : $current%" } # Change brightness diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index 53e1c7d5..3c32778d 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -4,12 +4,13 @@ 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" +dunst_notif="$HOME/.config/dunst/images/bell.png" + 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" @@ -25,9 +26,9 @@ swww query || swww init 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" -# Define functions for notifying user and updating symlinks + notify_user() { - notify-send -h string:x-canonical-private-synchronous:sys-notify -u normal "Switching to $1 mode" + dunstify -u normal -i "$dunst_notif" "Switching to $1 mode" } # Determine the current wallpaper mode by checking a configuration file @@ -41,8 +42,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 +70,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/Volume.sh b/config/hypr/scripts/Volume.sh index c5eab801..a51999df 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -24,8 +24,7 @@ get_icon() { # Notify notify_user() { -# notify-send -h string:x-canonical-private-synchronous:sys-notify -u normal -i "$(get_icon)" "Volume : $(get_volume) %" - notify-send -h int:value:$(get_volume) -h "string:x-dunst-stack-tag:volume_notif" -u low -i "$(get_icon)" "Volume : $(get_volume) %" + dunstify -h int:value:$(get_volume) -h "string:x-dunst-stack-tag:volume_notif" -u low -i "$(get_icon)" "Volume : $(get_volume) %" } @@ -71,8 +70,7 @@ get_mic_icon() { } # Notify notify_mic_user() { -# notify-send -h string:x-canonical-private-synchronous:sys-notify -u low -i "$(get_mic_icon)" "Mic-Level : $(pamixer --default-source --get-volume) %" - notify-send -h int:value:$(pamixer --default-source --get-volume) -h "string:x-dunst-stack-tag:volume_notif" -u low -i "$(get_mic_icon)" "Mic-Level : $(pamixer --default-source --get-volume) %" + dunstify -h int:value:$(pamixer --default-source --get-volume) -h "string:x-dunst-stack-tag:volume_notif" -u low -i "$(get_mic_icon)" "Mic-Level : $(pamixer --default-source --get-volume) %" } # Increase MIC Volume 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..910093ad 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=900 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 |
