Skip to content

Commit

Permalink
wallpaper changes stablized (random+normal)
Browse files Browse the repository at this point in the history
  • Loading branch information
sandptel committed Dec 15, 2024
1 parent 7324d89 commit a0f7ead
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 37 deletions.
37 changes: 27 additions & 10 deletions config/hypr/UserScripts/WallpaperRandom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,43 @@
# /* ---- 👒 https://github.com/sandptel/nixos-config ---- */ ##
# Script for Random Wallpaper ( CTRL ALT W)

wallDIR="$HOME/Pictures/wallpapers"
wallDIR="$HOME/Pictures/wallpapers/Best"
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" \)))
# Find all images, excluding the previously used wallpaper
if [[ -f "$wallDIR/current_wallpaper.txt" ]]; then
last_wallpaper=$(cat "$wallDIR/current_wallpaper.txt")
PICS=($(find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \) ! -name "$last_wallpaper"))
# Remove all existing .txt files in the wallpaper directory
find "$wallDIR" -type f -name "*.txt" -exec rm {} \;
else
PICS=($(find "$wallDIR" -type f \( -name "*.jpg" -o -name "*.jpeg" -o -name "*.png" -o -name "*.gif" \)))
fi

# Select a random wallpaper from the filtered list
if [[ ${#PICS[@]} -eq 0 ]]; then
echo "No wallpapers left to choose from!"
exit 1
fi
RANDOMPICS=${PICS[ $RANDOM % ${#PICS[@]} ]}

# Save the current wallpaper name in a .txt file
basename "$(basename "$RANDOMPICS")" > "$wallDIR/current_wallpaper.txt"

# Transition config
FPS=120
TYPE="random"
DURATION=4
FPS=60
TYPE="any"
DURATION=1.5
BEZIER=".43,1.19,1,.4"
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION --transition-bezier $BEZIER"

# Set the wallpaper
swww query || swww-daemon --format xrgb && swww img -o $focused_monitor "${RANDOMPICS}" $SWWW_PARAMS

swww query || swww-daemon --format xrgb && swww img -o $focused_monitor ${RANDOMPICS} $SWWW_PARAMS
# Run additional scripts
"${scriptsDir}/WallustSwww.sh"
"${scriptsDir}/Refresh.sh"

# sleep 1
${scriptsDir}/WallustSwww.sh
sleep 0.5
${scriptsDir}/Refresh.sh
exit 0
4 changes: 2 additions & 2 deletions config/hypr/UserScripts/WallpaperSelect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ SCRIPTSDIR="$HOME/.config/hypr/scripts"
# variables
focused_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
# swww transition config
FPS=120
FPS=90
TYPE="any"
DURATION=4
DURATION=3
BEZIER=".43,1.19,1,.4"
SWWW_PARAMS="--transition-fps $FPS --transition-type $TYPE --transition-duration $DURATION"

Expand Down
6 changes: 3 additions & 3 deletions config/hypr/scripts/Refresh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ ${SCRIPTSDIR}/WallustSwww.sh

# Relaunching rainbow borders if the script exists
# sleep 1
if file_exists "${UserScripts}/RainbowBorders.sh"; then
${UserScripts}/RainbowBorders.sh &
fi
# if file_exists "${UserScripts}/RainbowBorders.sh"; then
# ${UserScripts}/RainbowBorders.sh &
# fi

exit 0
10 changes: 2 additions & 8 deletions config/hypr/scripts/WallustSwww.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ colorscheme="$HOME/.cache/wal/colors.json"

# Initialize a flag to determine if the ln command was executed
ln_success=false

# Get current focused monitor
current_monitor=$(hyprctl monitors | awk '/^Monitor/{name=$2} /focused: yes/{print name}')
echo $current_monitor
Expand Down Expand Up @@ -45,13 +44,8 @@ if [ "$ln_success" = true ]; then
# wallust cs ~/.cache/wal/colors.json -s &

echo 'about to wpgtk'
wpg --theme "$colorscheme"
wpg --theme "$colorscheme" -n
fi


# Check if the process is running
if pgrep .wallust-wrappe > /dev/null; then
# Kill the process if it's still running
notify-send "Wallust" "Wallust was still running. Killing it" -t 2000
killall .wallust-wrappe

exit 0
13 changes: 1 addition & 12 deletions config/waybar/ModulesCustom
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,8 @@
"exec": "swaync-client -swb",
"on-click": "sleep 0.1 && swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true,
},
// NOTE:! This is only for Arch and Arch Based Distros depend: pacman-contrib
"custom/updater": {
"format": " {}",
"exec": "checkupdates | wc -l",
"exec-if": "[[ $(checkupdates | wc -l) ]]",
"interval": 15,
"on-click": "if command -v paru &> /dev/null; then kitty -T update paru -Syu; else kitty -T update yay -Syu; fi && notify-send 'The system has been updated'",
"tooltip": true,
"tooltip-format": "Left Click: Update System\nArch Linux Only",
"escape": true
},
// Separators
"custom/separator#dot": {
"format": "",
"interval": "once",
Expand Down
10 changes: 8 additions & 2 deletions nixos-dots.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ with lib;

let
cfg = config.nixos-dots;
checkupdates= pkgs.writeShellScriptBin "checkupdates" ''
${pkgs.uutils-coreutils-noprefix}/bin/echo "This is a pseudo package to check for updates"
exit 0
'';
in
{
options.nixos-dots = {
Expand All @@ -15,6 +19,7 @@ in
programs.pywal16.enable=true;

home.packages = with pkgs;[
checkupdates
wpgtk
# airshipper
pywalfox-native
Expand Down Expand Up @@ -110,7 +115,7 @@ wayland.windowManager.hyprland = {
# /* ---- 👒 https://github.com/sandptel/nixos-config ---- */ #
# Sourcing external config files
exec-once = dconf write /org/gnome/desktop/interface/gtk-theme "'gruvbox-dark'"
exec-once = dconf write /org/gnome/desktop/interface/gtk-theme "'FlatColor'"
exec-once = dconf write /org/gnome/desktop/interface/icon-theme "'Flat-Remix-Blue-Dark'"
# Default Configs
Expand Down Expand Up @@ -160,7 +165,8 @@ programs.vscode.enable=true;

home.file.".config/ags".source = config.lib.file.mkOutOfStoreSymlink ./config/ags;
home.file.".config/btop".source = config.lib.file.mkOutOfStoreSymlink ./config/btop;
home.file.".config/cava".source = config.lib.file.mkOutOfStoreSymlink ./config/cava;
home.file.".config/cava/shaders".source = config.lib.file.mkOutOfStoreSymlink ./config/cava/shaders;
# home.file.".config/cava/config".source = config.lib.file.mkOutOfStoreSymlink ./config/cava/config;
home.file.".config/fastfetch".source = config.lib.file.mkOutOfStoreSymlink ./config/fastfetch;
# home.file.".config/hypr".source = config.lib.file.mkOutOfStoreSymlink ./config/hypr;
home.file.".config/kitty/kitty-colors.conf".source = config.lib.file.mkOutOfStoreSymlink ./config/kitty/kitty-colors.conf;
Expand Down

0 comments on commit a0f7ead

Please sign in to comment.