Compare commits
3 Commits
b2717d88e8
...
85a06ae0f8
| Author | SHA1 | Date | |
|---|---|---|---|
| 85a06ae0f8 | |||
| 1ee02f2a2f | |||
| bfa9ed67f7 |
@@ -0,0 +1,57 @@
|
||||
Name = "blobBackgroundSelector"
|
||||
NamePretty = "Blob's Background Selector"
|
||||
Cache = false
|
||||
HideFromProviderlist = true
|
||||
SearchName = true
|
||||
|
||||
local function ShellEscape(s)
|
||||
return "'" .. s:gsub("'", "'\\''") .. "'"
|
||||
end
|
||||
|
||||
function FormatName(filename)
|
||||
local name = filename:gsub("^%d+", ""):gsub("^%-", "")
|
||||
name = name:gsub("%.[^%.]+$", "")
|
||||
name = name:gsub("-", " ")
|
||||
name = name:gsub("%S+", function(word)
|
||||
return word:sub(1, 1):upper() .. word:sub(2):lower()
|
||||
end)
|
||||
return name
|
||||
end
|
||||
|
||||
function GetEntries()
|
||||
local entries = {}
|
||||
local home = os.getenv("HOME")
|
||||
|
||||
local dirs = {
|
||||
home .. "/wallpapers",
|
||||
}
|
||||
|
||||
local seen = {}
|
||||
|
||||
for _, wallpaper_dir in ipairs(dirs) do
|
||||
local handle = io.popen(
|
||||
"find " .. ShellEscape(wallpaper_dir)
|
||||
.. " -maxdepth 1 -type f \\( -name '*.jpg' -o -name '*.jpeg' -o -name '*.png' -o -name '*.gif' -o -name '*.bmp' -o -name '*.webp' \\) 2>/dev/null | sort"
|
||||
)
|
||||
if handle then
|
||||
for background in handle:lines() do
|
||||
local filename = background:match("([^/]+)$")
|
||||
if filename and not seen[filename] then
|
||||
seen[filename] = true
|
||||
table.insert(entries, {
|
||||
Text = FormatName(filename),
|
||||
Value = filename,
|
||||
Actions = {
|
||||
activate = "blob_wallpaper " .. ShellEscape(background),
|
||||
},
|
||||
Preview = background,
|
||||
PreviewType = "file",
|
||||
})
|
||||
end
|
||||
end
|
||||
handle:close()
|
||||
end
|
||||
end
|
||||
|
||||
return entries
|
||||
end
|
||||
@@ -104,6 +104,9 @@ install_dependencies() {
|
||||
if ! command -v magick &> /dev/null && ! command -v convert &> /dev/null; then
|
||||
deps_needed+=("imagemagick")
|
||||
fi
|
||||
if ! command -v awww &> /dev/null; then
|
||||
deps_needed+=("awww")
|
||||
fi
|
||||
|
||||
if [ ${#deps_needed[@]} -gt 0 ]; then
|
||||
echo "Installing missing dependencies: ${deps_needed[*]}"
|
||||
@@ -134,6 +137,7 @@ check_file "$SCRIPT_DIR/ags/app.ts" "$HOME_DIR/.config/ags/app.ts" "ags/app.ts"
|
||||
check_file "$SCRIPT_DIR/ags/style.css" "$HOME_DIR/.config/ags/style.css" "ags/style.css" || check_status=1
|
||||
check_file "$SCRIPT_DIR/ags/widget/Media.tsx" "$HOME_DIR/.config/ags/widget/Media.tsx" "ags/widget/Media.tsx" || check_status=1
|
||||
check_file "$SCRIPT_DIR/waybar/style.css" "$HOME_DIR/.config/waybar/style.css" "waybar/style.css" || check_status=1
|
||||
check_file "$SCRIPT_DIR/elephant/menus/blob_background_selector.lua" "$HOME_DIR/.config/elephant/menus/blob_background_selector.lua" "elephant/menus/blob_background_selector.lua" || check_status=1
|
||||
check_file "$SCRIPT_DIR/branding/about.txt" "$HOME_DIR/.config/omarchy/branding/about.txt" "branding/about.txt" || check_status=1
|
||||
check_file "$SCRIPT_DIR/branding/screensaver.txt" "$HOME_DIR/.config/omarchy/branding/screensaver.txt" "branding/screensaver.txt" || check_status=1
|
||||
|
||||
@@ -168,6 +172,7 @@ backup_and_copy "$SCRIPT_DIR/waybar" "$HOME_DIR/.config/waybar" "Waybar config"
|
||||
backup_and_copy "$SCRIPT_DIR/ags" "$HOME_DIR/.config/ags" "AGS config"
|
||||
backup_and_copy "$SCRIPT_DIR/hypr" "$HOME_DIR/.config/hypr" "Hyprland config"
|
||||
backup_and_copy "$SCRIPT_DIR/branding" "$HOME_DIR/.config/omarchy/branding" "Branding files"
|
||||
backup_and_copy "$SCRIPT_DIR/elephant" "$HOME_DIR/.config/elephant" "Elephant configs"
|
||||
backup_and_copy "$SCRIPT_DIR/omarchy/hooks" "$HOME_DIR/.config/omarchy/hooks" "Omarchy hooks"
|
||||
backup_and_copy "$SCRIPT_DIR/wallpapers" "$HOME_DIR/wallpapers" "Custom wallpapers"
|
||||
|
||||
|
||||
@@ -8,32 +8,9 @@ mkdir -p "$WALLPAPER_DIR"
|
||||
mkdir -p "$THEME_DIR/backgrounds"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Available wallpapers in $WALLPAPER_DIR:"
|
||||
|
||||
# Read files into an array
|
||||
mapfile -t files < <(ls -1 "$WALLPAPER_DIR" 2>/dev/null)
|
||||
|
||||
if [ ${#files[@]} -eq 0 ]; then
|
||||
echo "No wallpapers found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Print the menu
|
||||
for i in "${!files[@]}"; do
|
||||
printf "%3d. %s\n" "$((i+1))" "${files[$i]}"
|
||||
done
|
||||
|
||||
echo ""
|
||||
read -p "Select a wallpaper number (1-${#files[@]}): " selection
|
||||
|
||||
# Validate selection
|
||||
if ! [[ "$selection" =~ ^[0-9]+$ ]] || [ "$selection" -lt 1 ] || [ "$selection" -gt "${#files[@]}" ]; then
|
||||
echo "Invalid selection."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SELECTED_FILE="${files[$((selection-1))]}"
|
||||
IMAGE_PATH=$(realpath "$WALLPAPER_DIR/$SELECTED_FILE")
|
||||
# Use walker dmenu for GUI selection
|
||||
omarchy-launch-walker -m menus:blobBackgroundSelector --width 800 --minheight 400 -p "Select Wallpaper…"
|
||||
exit 0
|
||||
else
|
||||
# Check if the argument is a file in the wallpapers directory
|
||||
if [ -f "$WALLPAPER_DIR/$1" ]; then
|
||||
@@ -88,4 +65,23 @@ EOF
|
||||
# omarchy-theme-set manages the background and reloads waybar and AGS
|
||||
omarchy-theme-set "blob-dynamic"
|
||||
|
||||
# If it's a GIF, override swaybg with awww (swww replacement)
|
||||
if [[ "${IMAGE_PATH,,}" == *.gif ]]; then
|
||||
echo "GIF detected, switching to awww..."
|
||||
pkill -x swaybg
|
||||
|
||||
# Start awww daemon if not running
|
||||
if ! pgrep -x awww-daemon >/dev/null; then
|
||||
awww-daemon >/dev/null 2>&1 &
|
||||
sleep 1
|
||||
fi
|
||||
|
||||
awww img "$IMAGE_PATH"
|
||||
else
|
||||
# Ensure awww is stopped for static wallpapers so swaybg can render them
|
||||
if pgrep -x awww-daemon >/dev/null; then
|
||||
pkill -x awww-daemon
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Wallpaper and dynamic theme applied successfully: $IMAGE_PATH"
|
||||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 192 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 347 KiB |
|
After Width: | Height: | Size: 327 KiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 502 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 37 KiB |