diff --git a/bin/swaybg-next b/bin/swaybg-next new file mode 100755 index 0000000..5f6b87c --- /dev/null +++ b/bin/swaybg-next @@ -0,0 +1,22 @@ +#!/bin/bash + +# Cycles through the background images available + +BACKGROUNDS_DIR="$HOME/.local/share/backgrounds" +NEXT_BACKGROUND_FILE="$HOME/.cache/next_background_index" + +BACKGROUNDS=($(find "$BACKGROUNDS_DIR" -type f | sort)) +TOTAL=${#BACKGROUNDS[@]} + +if [[ ! -f "$NEXT_BACKGROUND_FILE" ]]; then + INDEX=0 +else + INDEX=$(<"$NEXT_BACKGROUND_FILE") +fi + +# Save next index (wrap around) +echo "$(( (INDEX + 1) % TOTAL ))" > "$NEXT_BACKGROUND_FILE" + +# Launch swaybg +pkill -x swaybg +setsid swaybg -i "${BACKGROUNDS[$INDEX]}" -m fill >/dev/null 2>&1 & diff --git a/config/hypr/hyprland.conf b/config/hypr/hyprland.conf index d582166..5b7fdb3 100644 --- a/config/hypr/hyprland.conf +++ b/config/hypr/hyprland.conf @@ -19,15 +19,14 @@ bind = SUPER, M, exec, spotify bind = SUPER, N, exec, alacritty -e nvim bind = SUPER, T, exec, alacritty -e btop bind = SUPER SHIFT, SPACE, exec, pkill -SIGUSR1 waybar +bind = SUPER CTRL, SPACE, exec, ~/.local/share/omarchy/bin/swaybg-next # See https://wiki.hyprland.org/Configuring/Environment-variables/ source = ~/.local/share/omarchy/default/hypr/envs.conf # Autostart necessary processes (like notifications daemons, status bars, etc.) exec-once = hypridle & swaync & waybar - -# Control backgrounds -source = ~/.local/share/omarchy/default/hypr/backgrounds.conf +exec-once = ~/.local/share/omarchy/bin/swaybg-next ##################### ### LOOK AND FEEL ### diff --git a/default/bash/shell b/default/bash/shell index 7fb450d..823129e 100644 --- a/default/bash/shell +++ b/default/bash/shell @@ -8,5 +8,5 @@ HISTFILESIZE="${HISTSIZE}" # source /usr/share/bash-completion/bash_completion # Set complete path -export PATH="./bin:$HOME/.local/bin:$PATH" +export PATH="./bin:$HOME/.local/bin:$HOME/.local/share/omarchy/bin:$PATH" set +h diff --git a/default/hypr/backgrounds.conf b/default/hypr/backgrounds.conf deleted file mode 100644 index 83745aa..0000000 --- a/default/hypr/backgrounds.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Set a random image from ~/.local/share/backgrounds as the background -# Picks another random background on SUPER + CTRL + SPACE -exec-once = swaybg -i $(find ~/.local/share/backgrounds/ -type f -print0 | shuf -zn1 | xargs -0 printf '%s\n') -bind = SUPER CTRL, SPACE, exec, pkill -x swaybg && setsid swaybg -i $(find ~/.local/share/backgrounds/ -type f -print0 | shuf -zn1 | xargs -0 printf '%s\n') diff --git a/install/backgrounds.sh b/install/backgrounds.sh new file mode 100644 index 0000000..3defc6e --- /dev/null +++ b/install/backgrounds.sh @@ -0,0 +1,2 @@ +gum spin --title "Downloading background image..." -- curl -sL -o ~/.local/share/backgrounds/Milad-Fakurian-Abstract-Purple-Blue.jpg https://images.unsplash.com/photo-1620207418302-439b387441b0 +gum spin --title "Downloading background image..." -- curl -sL -o ~/.local/share/backgrounds/Pawel-Czerwinski-Abstract-Purple-Blue.jpg https://images.unsplash.com/photo-1651870364199-fc5f9f46ac85 diff --git a/install/theme.sh b/install/theme.sh index 7666258..93c66d3 100644 --- a/install/theme.sh +++ b/install/theme.sh @@ -1,5 +1,2 @@ # Prefer dark mode everything gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' - -# Download first background -curl -sL -o ~/.local/share/backgrounds/Milad-Fakurian-Abstract-Purple-Blue.jpg https://unsplash.com/photos/u8Jn2rzYIps/download?ixid=M3wxMjA3fDB8MXxzZWFyY2h8Mnx8YWJzdHJhY3QlMjB3YWxscGFwZXJ8ZW58MHx8fHwxNzQ5Mjc5ODk1fDA