irongit
hygoland/scripts/WallustSwww.sh
39 lines1.4 KBBourne Again Shell (bash)
1#!/bin/bash
2# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
3# Wallust Colors for current wallpaper
4
5# Define the path to the swww cache directory
6cache_dir="$HOME/.cache/swww/"
7
8# Get a list of monitor outputs
9monitor_outputs=($(ls "$cache_dir"))
10
11# Initialize a flag to determine if the ln command was executed
12ln_success=false
13
14# Get current focused monitor
15current_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
16echo $current_monitor
17# Construct the full path to the cache file
18cache_file="$cache_dir$current_monitor"
19echo $cache_file
20# Check if the cache file exists for the current monitor output
21if [ -f "$cache_file" ]; then
22 # Get the wallpaper path from the cache file
23 wallpaper_path=$(grep -v 'Lanczos3' "$cache_file" | head -n 1)
24 echo $wallpaper_path
25 # symlink the wallpaper to the location Rofi can access
26 if ln -sf "$wallpaper_path" "$HOME/.config/rofi/.current_wallpaper"; then
27 ln_success=true # Set the flag to true upon successful execution
28 fi
29 # copy the wallpaper for wallpaper effects
30 cp -r "$wallpaper_path" "$HOME/.config/hypr/wallpaper_effects/.wallpaper_current"
31fi
32
33# Check the flag before executing further commands
34if [ "$ln_success" = true ]; then
35 # execute wallust
36 echo 'about to execute wallust'
37 # execute wallust skipping tty and terminal changes
38 wallust run "$wallpaper_path" -s &
39fi