diff options
Diffstat (limited to 'config/hypr/UserScripts')
| -rwxr-xr-x | config/hypr/UserScripts/00-Readme | 4 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/RainbowBorders-low-cpu.sh | 2 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/RainbowBorders.bak.sh | 2 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/RofiBeats.sh | 8 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/RofiCalc.sh | 2 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/Tak0-Autodispatch.sh | 68 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperAutoChange.sh | 51 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperEffects.sh | 124 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperRandom.sh | 47 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/WallpaperSelect.sh | 267 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/Weather.py | 2 | ||||
| -rwxr-xr-x | config/hypr/UserScripts/ZshChangeTheme.sh | 74 |
12 files changed, 10 insertions, 641 deletions
diff --git a/config/hypr/UserScripts/00-Readme b/config/hypr/UserScripts/00-Readme index 259fc9d9..2b72982e 100755 --- a/config/hypr/UserScripts/00-Readme +++ b/config/hypr/UserScripts/00-Readme @@ -6,5 +6,5 @@ # ================================================== # Place your new scripts here. -# If you need to edit a script from main script (~/.config/hypr/scripts), copy it on this directory, and edit. -# Make sure to update as well the keybinds in ~/.config/hypr/UserConfigs directory if any script is linked to it
\ No newline at end of file +# If you need to edit a script from main script (${XDG_CONFIG_HOME:-$HOME/.config}/hypr/scripts), copy it on this directory, and edit. +# Make sure to update as well the keybinds in ${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserConfigs directory if any script is linked to it
\ No newline at end of file diff --git a/config/hypr/UserScripts/RainbowBorders-low-cpu.sh b/config/hypr/UserScripts/RainbowBorders-low-cpu.sh index a8de4c89..af6e378a 100755 --- a/config/hypr/UserScripts/RainbowBorders-low-cpu.sh +++ b/config/hypr/UserScripts/RainbowBorders-low-cpu.sh @@ -38,7 +38,7 @@ # RB_ONCE 1 to apply once and exit (no animation; default: 0) # # Example (slower animation): -# RB_INTERVAL=1.5 RB_STEP_DEG=12 ~/.config/hypr/UserScripts/RainbowBorders-low-cpu.sh & +# RB_INTERVAL=1.5 RB_STEP_DEG=12 ${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserScripts/RainbowBorders-low-cpu.sh & # # Notes # - This focuses on the active border only. Animating inactive borders too diff --git a/config/hypr/UserScripts/RainbowBorders.bak.sh b/config/hypr/UserScripts/RainbowBorders.bak.sh index 87f13c34..7a9c7171 100755 --- a/config/hypr/UserScripts/RainbowBorders.bak.sh +++ b/config/hypr/UserScripts/RainbowBorders.bak.sh @@ -10,7 +10,7 @@ # Possible values: "wallust_random", "rainbow", "gradient_flow" EFFECT_TYPE="gradient_flow" -WALLUST_COLORS_SOURCE="$HOME/.config/hypr/wallust/wallust-hyprland.conf" +WALLUST_COLORS_SOURCE="${XDG_CONFIG_HOME:-$HOME/.config}/hypr/wallust/wallust-hyprland.conf" WALLUST_COLORS=() diff --git a/config/hypr/UserScripts/RofiBeats.sh b/config/hypr/UserScripts/RofiBeats.sh index 057d53b9..b2371859 100755 --- a/config/hypr/UserScripts/RofiBeats.sh +++ b/config/hypr/UserScripts/RofiBeats.sh @@ -8,10 +8,10 @@ # RofiBeats - unified, dynamic UI (add, remove, manage, play) mDIR="$HOME/Music/" -iDIR="$HOME/.config/swaync/icons" -rofi_theme="$HOME/.config/rofi/config-rofi-Beats.rasi" -rofi_theme_menu="$HOME/.config/rofi/config-rofi-Beats-menu.rasi" -music_list="$HOME/.config/rofi/online_music.list" +iDIR="${XDG_CONFIG_HOME:-$HOME/.config}/swaync/icons" +rofi_theme="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config-rofi-Beats.rasi" +rofi_theme_menu="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config-rofi-Beats-menu.rasi" +music_list="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/online_music.list" mkdir -p "$(dirname "$music_list")" [[ -f "$music_list" ]] || touch "$music_list" diff --git a/config/hypr/UserScripts/RofiCalc.sh b/config/hypr/UserScripts/RofiCalc.sh index 40a7ca3f..ccb18903 100755 --- a/config/hypr/UserScripts/RofiCalc.sh +++ b/config/hypr/UserScripts/RofiCalc.sh @@ -8,7 +8,7 @@ # /* Calculator (using qalculate) and rofi */ # /* Submitted by: https://github.com/JosephArmas */ -rofi_theme="$HOME/.config/rofi/config-calc.rasi" +rofi_theme="${XDG_CONFIG_HOME:-$HOME/.config}/rofi/config-calc.rasi" # Kill Rofi if already running before execution if pgrep -x "rofi" >/dev/null; then diff --git a/config/hypr/UserScripts/Tak0-Autodispatch.sh b/config/hypr/UserScripts/Tak0-Autodispatch.sh deleted file mode 100755 index b0607e13..00000000 --- a/config/hypr/UserScripts/Tak0-Autodispatch.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -# ================================================== -# KoolDots (2026) -# Project URL: https://github.com/LinuxBeginnings -# License: GNU GPLv3 -# SPDX-License-Identifier: GPL-3.0-or-later -# ================================================== -# USAGE: -# 1) Run from terminal: -# ./dispatch.sh <application_command> <target_workspace_number> -# Example: -# ./dispatch.sh discord 2 -# -# 2) Call from Hyprland config (in hyprland.conf file): -# exec-once = /path/to/dispatch.sh <application_command> <target_workspace_number> -# -# Logs are saved in dispatch.log file next to the script. -# If the window doesn't appear or is dispatched incorrectly — info will be there. -# -# Notes: -# - Script waits about ~9 seconds (30 iterations of 0.3 sec) for window to appear. -# - Uses hyprctl and jq, so these tools must be installed. - -LOGFILE="$(dirname "$0")/dispatch.log" -# Log file path located next to the script. - -APP=$1 -# The application command or window class to launch or match. - -TARGET_WORKSPACE=$2 -# The target workspace number where the window should be moved. - -# Check if required arguments are provided. -if [[ -z "$APP" || -z "$TARGET_WORKSPACE" ]]; then - echo "Usage: $0 <application_command> <target_workspace_number>" >>"$LOGFILE" 2>&1 - exit 1 -fi - -echo "Starting dispatch of '$APP' to workspace $TARGET_WORKSPACE at $(date)" >>"$LOGFILE" -# Starting the dispatch process and logging the event. -# Avoid early workspace focus issues by switching workspace first. -hyprctl dispatch workspace "$TARGET_WORKSPACE" >>"$LOGFILE" 2>&1 -sleep 0.4 - -# Launch the application in the background and disown it. -$APP & -disown -pid=$! - -echo "Launched '$APP' with PID $pid" >>"$LOGFILE" -# Log the launched process ID. -# Wait for the application window to appear (matching window class). -for i in {1..30}; do - win=$(hyprctl clients -j | jq -r --arg APP "$APP" ' - .[] | select(.class | test($APP;"i")) | .address' 2>>"$LOGFILE") - - if [[ -n "$win" ]]; then - echo "Found window $win for app '$APP', moving to workspace $TARGET_WORKSPACE" >>"$LOGFILE" - # Move the window to the target workspace. - hyprctl dispatch movetoworkspace "$TARGET_WORKSPACE,address:$win" >>"$LOGFILE" 2>&1 - exit 0 - fi - sleep 0.3 -done - -echo "ERROR: Window for '$APP' was NOT found or dispatched properly to workspace $TARGET_WORKSPACE at $(date)" >>"$LOGFILE" -# Log error if window was not found or dispatched correctly. -exit 1 diff --git a/config/hypr/UserScripts/WallpaperAutoChange.sh b/config/hypr/UserScripts/WallpaperAutoChange.sh deleted file mode 100755 index 5cee2a1e..00000000 --- a/config/hypr/UserScripts/WallpaperAutoChange.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash -# ================================================== -# KoolDots (2026) -# Project URL: https://github.com/LinuxBeginnings -# License: GNU GPLv3 -# SPDX-License-Identifier: GPL-3.0-or-later -# ================================================== -# 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 -SCRIPTSDIR="$HOME/.config/hypr/scripts" -# shellcheck source=/dev/null -. "$SCRIPTSDIR/WallpaperCmd.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 (swww/awww) -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 - resize_mode="$(wallpaper_resize_mode "$img" "$focused_monitor")" - "$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$img" - # Regenerate colors from the exact image path to avoid cache races - $HOME/.config/hypr/scripts/WallustSwww.sh "$img" - # Refresh UI components that depend on wallust output - $wallust_refresh - sleep $INTERVAL - - done -done diff --git a/config/hypr/UserScripts/WallpaperEffects.sh b/config/hypr/UserScripts/WallpaperEffects.sh deleted file mode 100755 index 297c77fa..00000000 --- a/config/hypr/UserScripts/WallpaperEffects.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env bash -# ================================================== -# KoolDots (2026) -# Project URL: https://github.com/LinuxBeginnings -# License: GNU GPLv3 -# SPDX-License-Identifier: GPL-3.0-or-later -# ================================================== -# Wallpaper Effects using ImageMagick (SUPER SHIFT W) - -# Variables -terminal=kitty -wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" -wallpaper_output="$HOME/.config/hypr/wallpaper_effects/.wallpaper_modified" -SCRIPTSDIR="$HOME/.config/hypr/scripts" -# shellcheck source=/dev/null -. "$SCRIPTSDIR/WallpaperCmd.sh" -focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') -rofi_theme="$HOME/.config/rofi/config-wallpaper-effect.rasi" - -# Directory for swaync -iDIR="$HOME/.config/swaync/images" -iDIRi="$HOME/.config/swaync/icons" - -# swww/awww transition config -FPS=60 -TYPE="wipe" -DURATION=2 -BEZIER=".43,1.19,1,.4" -if [[ "$WWW_CMD" == "swww" || "$WWW_CMD" == "awww" ]]; then - SWWW_PARAMS=(--transition-fps "$FPS" --transition-type "$TYPE" --transition-duration "$DURATION" --transition-bezier "$BEZIER") -else - SWWW_PARAMS=() -fi - -# Define ImageMagick effects -declare -A effects=( - ["No Effects"]="no-effects" - ["Black & White"]="magick $wallpaper_current -colorspace gray -sigmoidal-contrast 10,40% $wallpaper_output" - ["Blurred"]="magick $wallpaper_current -blur 0x10 $wallpaper_output" - ["Charcoal"]="magick $wallpaper_current -charcoal 0x5 $wallpaper_output" - ["Edge Detect"]="magick $wallpaper_current -edge 1 $wallpaper_output" - ["Emboss"]="magick $wallpaper_current -emboss 0x5 $wallpaper_output" - ["Frame Raised"]="magick $wallpaper_current +raise 150 $wallpaper_output" - ["Frame Sunk"]="magick $wallpaper_current -raise 150 $wallpaper_output" - ["Negate"]="magick $wallpaper_current -negate $wallpaper_output" - ["Oil Paint"]="magick $wallpaper_current -paint 4 $wallpaper_output" - ["Posterize"]="magick $wallpaper_current -posterize 4 $wallpaper_output" - ["Polaroid"]="magick $wallpaper_current -polaroid 0 $wallpaper_output" - ["Sepia Tone"]="magick $wallpaper_current -sepia-tone 65% $wallpaper_output" - ["Solarize"]="magick $wallpaper_current -solarize 80% $wallpaper_output" - ["Sharpen"]="magick $wallpaper_current -sharpen 0x5 $wallpaper_output" - ["Vignette"]="magick $wallpaper_current -vignette 0x3 $wallpaper_output" - ["Vignette-black"]="magick $wallpaper_current -background black -vignette 0x3 $wallpaper_output" - ["Zoomed"]="magick $wallpaper_current -gravity Center -extent 1:1 $wallpaper_output" -) - -# Function to apply no effects -no-effects() { - local resize_mode - resize_mode="$(wallpaper_resize_mode "$wallpaper_current" "$focused_monitor")" - "$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$wallpaper_current" "${SWWW_PARAMS[@]}" || return 1 - if ! "$SCRIPTSDIR/WallustSwww.sh" "$wallpaper_current"; then - notify-send -u critical -i "$iDIR/error.png" "Wallust failed" "Wallpaper theme not refreshed" - return 1 - fi - # Refresh rofi, waybar, wallust palettes - sleep 0.5 - "$SCRIPTSDIR/Refresh.sh" - - notify-send -u low -i "$iDIR/ja.png" "No wallpaper" "effects applied" - # copying wallpaper for rofi menu - cp "$wallpaper_current" "$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 - - choice=$(printf "%s\n" "${options[@]}" | LC_COLLATE=C sort | rofi -dmenu -i -config $rofi_theme) - - # 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/ja.png" "Applying:" "$choice effects" - eval "${effects[$choice]}" - - # intial kill process - for pid in swaybg mpvpaper; do - killall -SIGUSR1 "$pid" - done - - sleep 1 - local resize_mode - resize_mode="$(wallpaper_resize_mode "$wallpaper_output" "$focused_monitor")" - "$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$wallpaper_output" "${SWWW_PARAMS[@]}" - sleep 0.5 - if ! "$SCRIPTSDIR/WallustSwww.sh" "$wallpaper_output"; then - notify-send -u critical -i "$iDIR/error.png" "Wallust failed" "Wallpaper theme not refreshed" - return 1 - fi - # Refresh rofi, waybar, wallust palettes - "${SCRIPTSDIR}/Refresh.sh" - notify-send -u low -i "$iDIR/ja.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 - -sleep 1 diff --git a/config/hypr/UserScripts/WallpaperRandom.sh b/config/hypr/UserScripts/WallpaperRandom.sh deleted file mode 100755 index aae80426..00000000 --- a/config/hypr/UserScripts/WallpaperRandom.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env bash -# ================================================== -# KoolDots (2026) -# Project URL: https://github.com/LinuxBeginnings -# License: GNU GPLv3 -# SPDX-License-Identifier: GPL-3.0-or-later -# ================================================== -# Script for Random Wallpaper ( CTRL ALT W) - -PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" -wallDIR="$PICTURES_DIR/wallpapers" -SCRIPTSDIR="$HOME/.config/hypr/scripts" -# shellcheck source=/dev/null -. "$SCRIPTSDIR/WallpaperCmd.sh" - -focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') - -PICS=($(find -L "${wallDIR}" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.pnm" -o -name "*.tga" -o -name "*.tiff" -o -name "*.webp" -o -name "*.bmp" -o -name "*.farbfeld" -o -name "*.gif" \))) -RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]} - - -# Transition config (swww/awww) -FPS=30 -TYPE="random" -DURATION=1 -BEZIER=".43,1.19,1,.4" -if [[ "$WWW_CMD" == "swww" || "$WWW_CMD" == "awww" ]]; then - SWWW_PARAMS=(--transition-fps "$FPS" --transition-type "$TYPE" --transition-duration "$DURATION" --transition-bezier "$BEZIER") -else - SWWW_PARAMS=() -fi -if ! "$WWW_CMD" query >/dev/null 2>&1; then - "$WWW_DAEMON" "${WWW_DAEMON_ARGS[@]}" & -fi -resize_mode="$(wallpaper_resize_mode "$RANDOMPICS" "$focused_monitor")" -"$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$RANDOMPICS" "${SWWW_PARAMS[@]}" - -wait $! -if ! "$SCRIPTSDIR/WallustSwww.sh" "$RANDOMPICS"; then - notify-send -u critical "Wallust failed" "Wallpaper theme not refreshed" - exit 1 -fi - -wait $! -sleep 0.5 -"$SCRIPTSDIR/Refresh.sh" - diff --git a/config/hypr/UserScripts/WallpaperSelect.sh b/config/hypr/UserScripts/WallpaperSelect.sh deleted file mode 100755 index 2e5ecd86..00000000 --- a/config/hypr/UserScripts/WallpaperSelect.sh +++ /dev/null @@ -1,267 +0,0 @@ -#!/usr/bin/env bash -# ================================================== -# KoolDots (2026) -# Project URL: https://github.com/LinuxBeginnings -# License: GNU GPLv3 -# SPDX-License-Identifier: GPL-3.0-or-later -# ================================================== -# This script for selecting wallpapers (SUPER W) - -# WALLPAPERS PATH -terminal=kitty -PICTURES_DIR="$(xdg-user-dir PICTURES 2>/dev/null || echo "$HOME/Pictures")" -wallDIR="$PICTURES_DIR/wallpapers" -SCRIPTSDIR="$HOME/.config/hypr/scripts" -# shellcheck source=/dev/null -. "$SCRIPTSDIR/WallpaperCmd.sh" -wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current" -wallpaper_link="$HOME/.config/rofi/.current_wallpaper" - -# Directory for swaync -iDIR="$HOME/.config/swaync/images" -iDIRi="$HOME/.config/swaync/icons" - -# swww/awww transition config -FPS=60 -TYPE="any" -DURATION=2 -BEZIER=".43,1.19,1,.4" -if [[ "$WWW_CMD" == "swww" || "$WWW_CMD" == "awww" ]]; then - SWWW_PARAMS=(--transition-fps "$FPS" --transition-type "$TYPE" --transition-duration "$DURATION" --transition-bezier "$BEZIER") -else - SWWW_PARAMS=() -fi - - -# Check if package bc exists -if ! command -v bc &>/dev/null; then - notify-send -i "$iDIR/error.png" "bc missing" "Install package bc first" - exit 1 -fi - -# Variables -rofi_theme="$HOME/.config/rofi/config-wallpaper.rasi" -focused_monitor=$(hyprctl monitors -j | jq -r '.[] | select(.focused) | .name') - -per_monitor_wallpaper_current="$HOME/.config/hypr/wallpaper_effects/.wallpaper_current_${focused_monitor}" -per_monitor_wallpaper_link="$HOME/.config/rofi/.current_wallpaper_${focused_monitor}" - -# Ensure focused_monitor is detected -if [[ -z "$focused_monitor" ]]; then - notify-send -i "$iDIR/error.png" "E-R-R-O-R" "Could not detect focused monitor" - exit 1 -fi - -# Monitor details -scale_factor=$(hyprctl monitors -j | jq -r --arg mon "$focused_monitor" '.[] | select(.name == $mon) | .scale') -monitor_height=$(hyprctl monitors -j | jq -r --arg mon "$focused_monitor" '.[] | select(.name == $mon) | .height') - -icon_size=$(echo "scale=1; ($monitor_height * 3) / ($scale_factor * 150)" | bc) -adjusted_icon_size=$(echo "$icon_size" | awk '{if ($1 < 15) $1 = 20; if ($1 > 25) $1 = 25; print $1}') -rofi_override="element-icon{size:${adjusted_icon_size}%;}" - -# Kill existing wallpaper daemons for video -kill_wallpaper_for_video() { - "$WWW_CMD" kill 2>/dev/null - pkill mpvpaper 2>/dev/null - pkill swaybg 2>/dev/null - pkill hyprpaper 2>/dev/null -} - -# Kill existing wallpaper daemons for image -kill_wallpaper_for_image() { - pkill mpvpaper 2>/dev/null - pkill swaybg 2>/dev/null - pkill hyprpaper 2>/dev/null -} - -# Retrieve wallpapers (both images & videos) -mapfile -d '' PICS < <(find -L "${wallDIR}" -type f \( \ - -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o \ - -iname "*.bmp" -o -iname "*.tiff" -o -iname "*.webp" -o \ - -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.mov" -o -iname "*.webm" \) -print0) - -RANDOM_PIC="${PICS[$((RANDOM % ${#PICS[@]}))]}" -RANDOM_PIC_NAME="$(basename "$RANDOM_PIC")" - -CURRENT_MON_PIC_PATH=$("$WWW_CMD" query 2>/dev/null | grep "$focused_monitor" | awk '{print $NF}') -if [[ -z "$CURRENT_MON_PIC_PATH" ]]; then - if [[ -L "$wallpaper_link" ]]; then - CURRENT_MON_PIC_PATH="$(readlink -f "$wallpaper_link")" - elif [[ -f "$wallpaper_link" ]]; then - CURRENT_MON_PIC_PATH="$wallpaper_link" - elif [[ -f "$wallpaper_current" ]]; then - CURRENT_MON_PIC_PATH="$wallpaper_current" - fi -fi -CURRENT_MON_PIC_NAME=$(basename "$CURRENT_MON_PIC_PATH") - -# Rofi command -rofi_command="rofi -i -show -dmenu -config $rofi_theme -theme-str $rofi_override" - -# Sorting Wallpapers -menu() { - IFS=$'\n' sorted_options=($(sort <<<"${PICS[*]}")) - - printf "%s\x00icon\x1f%s\n" "Random: $RANDOM_PIC_NAME" "$RANDOM_PIC" - if [[ -n "$CURRENT_MON_PIC_PATH" ]]; then - printf "%s\x00icon\x1f%s\n" "Current: $CURRENT_MON_PIC_NAME" "$CURRENT_MON_PIC_PATH" - fi - - for pic_path in "${sorted_options[@]}"; do - pic_name=$(basename "$pic_path") - if [[ "$pic_name" =~ \.gif$ ]]; then - cache_gif_image="$HOME/.cache/gif_preview/${pic_name}.png" - if [[ ! -f "$cache_gif_image" ]]; then - mkdir -p "$HOME/.cache/gif_preview" - magick "$pic_path[0]" -resize 1920x1080 "$cache_gif_image" - fi - printf "%s\x00icon\x1f%s\n" "$pic_name" "$cache_gif_image" - elif [[ "$pic_name" =~ \.(mp4|mkv|mov|webm|MP4|MKV|MOV|WEBM)$ ]]; then - cache_preview_image="$HOME/.cache/video_preview/${pic_name}.png" - if [[ ! -f "$cache_preview_image" ]]; then - mkdir -p "$HOME/.cache/video_preview" - ffmpeg -v error -y -i "$pic_path" -ss 00:00:01.000 -vframes 1 "$cache_preview_image" - fi - printf "%s\x00icon\x1f%s\n" "$pic_name" "$cache_preview_image" - else - printf "%s\x00icon\x1f%s\n" "$pic_name" "$pic_path" - fi - done -} - - -modify_startup_config() { - local selected_file="$1" - local startup_config="$HOME/.config/hypr/UserConfigs/Startup_Apps.conf" - - # Check if it's a live wallpaper (video) - if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm)$ ]]; then - # For video wallpapers: - sed -i '/^\s*exec-once\s*=\s*\$scriptsDir\/WallpaperDaemon\.sh\s*$/s/^/\#/' "$startup_config" - sed -i '/^\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb\s*$/s/^/\#/' "$startup_config" - sed -i '/^\s*#\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^#\s*//;' "$startup_config" - - # Update the livewallpaper variable with the selected video path (using $HOME) - selected_file="${selected_file/#$HOME/\$HOME}" # Replace /home/user with $HOME - sed -i "s|^\$livewallpaper=.*|\$livewallpaper=\"$selected_file\"|" "$startup_config" - - echo "Configured for live wallpaper (video)." - else - # For image wallpapers: - sed -i '/^\s*#\s*exec-once\s*=\s*\$scriptsDir\/WallpaperDaemon\.sh\s*$/s/^\s*#\s*//;' "$startup_config" - sed -i '/^\s*#\s*exec-once\s*=\s*swww-daemon\s*--format\s*xrgb\s*$/s/^\s*#\s*//;' "$startup_config" - - sed -i '/^\s*exec-once\s*=\s*mpvpaper\s*.*$/s/^/\#/' "$startup_config" - - echo "Configured for static wallpaper (image)." - fi -} - -# Apply Image Wallpaper -apply_image_wallpaper() { - local image_path="$1" - - kill_wallpaper_for_image - - if ! pgrep -x "$WWW_DAEMON" >/dev/null; then - echo "Starting $WWW_DAEMON..." - "$WWW_DAEMON" "${WWW_DAEMON_ARGS[@]}" & - fi - # Wait for daemon to be ready before applying - for _ in {1..20}; do - "$WWW_CMD" query >/dev/null 2>&1 && break - sleep 0.1 - done - local resize_mode - resize_mode="$(wallpaper_resize_mode "$image_path" "$focused_monitor")" - "$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$image_path" "${SWWW_PARAMS[@]}" || { - sleep 0.2 - "$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$image_path" "${SWWW_PARAMS[@]}" - } - "$WWW_CMD" img -o "$focused_monitor" --resize "$resize_mode" "$image_path" "${SWWW_PARAMS[@]}" - - # Persist per-monitor wallpaper selection - mkdir -p "$(dirname "$per_monitor_wallpaper_current")" "$(dirname "$per_monitor_wallpaper_link")" - ln -sf "$image_path" "$per_monitor_wallpaper_link" || true - cp -f "$image_path" "$per_monitor_wallpaper_current" || true - - # Run additional scripts (pass the image path to avoid cache race conditions) - if ! "$SCRIPTSDIR/WallustSwww.sh" "$image_path"; then - notify-send -i "$iDIR/error.png" "Wallust failed" "Wallpaper theme not refreshed" - return 1 - fi - sleep 0.5 - "$SCRIPTSDIR/Refresh.sh" - sleep 0.3 - -} - -apply_video_wallpaper() { - local video_path="$1" - - # Check if mpvpaper is installed - if ! command -v mpvpaper &>/dev/null; then - notify-send -i "$iDIR/error.png" "E-R-R-O-R" "mpvpaper not found" - return 1 - fi - kill_wallpaper_for_video - - # Apply video wallpaper using mpvpaper - mpvpaper '*' -o "load-scripts=no no-audio --loop" "$video_path" & -} - -# Main function -main() { - choice=$(menu | $rofi_command) - choice=$(echo "$choice" | xargs) - RANDOM_PIC_NAME=$(echo "$RANDOM_PIC_NAME" | xargs) - raw_choice="$choice" - choice="${choice#Random: }" - choice="${choice#Current: }" - - if [[ -z "$choice" ]]; then - echo "No choice selected. Exiting." - exit 0 - fi - - # Resolve selection directly when using Random/Current entries - if [[ "$raw_choice" == Random:\ * ]]; then - selected_file="$RANDOM_PIC" - elif [[ "$raw_choice" == Current:\ * && -n "$CURRENT_MON_PIC_PATH" ]]; then - selected_file="$CURRENT_MON_PIC_PATH" - elif [[ -f "$choice" ]]; then - selected_file="$choice" - else - # Handle random selection by name when needed - if [[ "$choice" == "$RANDOM_PIC_NAME" ]]; then - choice=$(basename "$RANDOM_PIC") - fi - choice_basename=$(basename "$choice" | sed 's/\(.*\)\.[^.]*$/\1/') - - # Search for the selected file in the wallpapers directory, including subdirectories - selected_file=$(find "$wallDIR" -iname "$choice_basename.*" -print -quit) - fi - - if [[ -z "$selected_file" ]]; then - echo "File not found. Selected choice: $choice" - exit 1 - fi - - # Modify the Startup_Apps.conf file based on wallpaper type - modify_startup_config "$selected_file" - - # **CHECK FIRST** if it's a video or an image **before calling any function** - if [[ "$selected_file" =~ \.(mp4|mkv|mov|webm|MP4|MKV|MOV|WEBM)$ ]]; then - apply_video_wallpaper "$selected_file" - else - apply_image_wallpaper "$selected_file" - fi -} - -# Check if rofi is already running -if pidof rofi >/dev/null; then - pkill rofi -fi - -main
\ No newline at end of file diff --git a/config/hypr/UserScripts/Weather.py b/config/hypr/UserScripts/Weather.py index 6905e0e1..cf50076f 100755 --- a/config/hypr/UserScripts/Weather.py +++ b/config/hypr/UserScripts/Weather.py @@ -49,7 +49,7 @@ class WeatherData: # Examples (zsh): # # One-off run # # WEATHER_UNITS can be "metric" or "imperial" -# WEATHER_UNITS=imperial WEATHER_PLACE="Concord, NH" python3 ~/.config/hypr/UserScripts/Weather.py +# WEATHER_UNITS=imperial WEATHER_PLACE="Concord, NH" python3 ${XDG_CONFIG_HOME:-$HOME/.config}/hypr/UserScripts/Weather.py # # # Persist in current shell session # export WEATHER_UNITS=imperial diff --git a/config/hypr/UserScripts/ZshChangeTheme.sh b/config/hypr/UserScripts/ZshChangeTheme.sh deleted file mode 100755 index 94c1b448..00000000 --- a/config/hypr/UserScripts/ZshChangeTheme.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env bash -# ================================================== -# KoolDots (2026) -# Project URL: https://github.com/LinuxBeginnings -# License: GNU GPLv3 -# SPDX-License-Identifier: GPL-3.0-or-later -# ================================================== -# 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 - -# Variables -iDIR="$HOME/.config/swaync/images" -rofi_theme="$HOME/.config/rofi/config-zsh-theme.rasi" - -if [ -n "$(grep -i nixos < /etc/os-release)" ]; then - notify-send -i "$iDIR/note.png" "NOT Supported" "Sorry NixOS does not support this KooL feature" - exit 1 -fi - -themes_dir="$HOME/.oh-my-zsh/themes" -file_extension=".zsh-theme" - - -themes_array=($(find -L "$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 $rofi_theme" - -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 - 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/ja.png" "Random theme:" "selected: $random_theme" - else - # Set theme to the selected choice - theme_to_set="$choice" - notify-send -i "$iDIR/ja.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/ja.png" "OMZ theme" "applied. restart your terminal" - else - notify-send -i "$iDIR/error.png" "E-R-R-O-R" "~.zshrc file not found!" - fi -} - -# Check if rofi is already running -if pidof rofi > /dev/null; then - pkill rofi -fi - -main |
