mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-13 20:40:00 -05:00
wallpaper: use test
Use test instead of [ ]
This commit is contained in:
+6
-6
@@ -50,9 +50,9 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Set last wallpaper if not same as given
|
# Set last wallpaper if not same as given
|
||||||
if [ -f "$last_wallpaper_path" ]
|
if test -f "$last_wallpaper_path"
|
||||||
set last_wallpaper (cat $last_wallpaper_path)
|
set last_wallpaper (cat $last_wallpaper_path)
|
||||||
[ -z "$last_wallpaper" -o "$last_wallpaper" = "$chosen_wallpaper" ] && set -e last_wallpaper
|
test -z "$last_wallpaper" -o "$last_wallpaper" = "$chosen_wallpaper" && set -e last_wallpaper
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
# The path to the directory containing the selection of wallpapers
|
# The path to the directory containing the selection of wallpapers
|
||||||
@@ -64,9 +64,9 @@ else
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Get all files in $wallpapers_dir and exclude the last wallpaper (if it exists)
|
# Get all files in $wallpapers_dir and exclude the last wallpaper (if it exists)
|
||||||
if [ -f "$last_wallpaper_path" ]
|
if test -f "$last_wallpaper_path"
|
||||||
set last_wallpaper (cat $last_wallpaper_path)
|
set last_wallpaper (cat $last_wallpaper_path)
|
||||||
[ -n "$last_wallpaper" ] && set unfiltered_wallpapers (get-valid-wallpapers | grep -v $last_wallpaper)
|
test -n "$last_wallpaper" && set unfiltered_wallpapers (get-valid-wallpapers | grep -v $last_wallpaper)
|
||||||
end
|
end
|
||||||
set -q unfiltered_wallpapers || set unfiltered_wallpapers (get-valid-wallpapers)
|
set -q unfiltered_wallpapers || set unfiltered_wallpapers (get-valid-wallpapers)
|
||||||
|
|
||||||
@@ -85,14 +85,14 @@ else
|
|||||||
# Add wallpapers that are larger than the screen size * threshold to list to choose from ($wallpapers)
|
# Add wallpapers that are larger than the screen size * threshold to list to choose from ($wallpapers)
|
||||||
for i in (seq 1 (count $wall_sizes))
|
for i in (seq 1 (count $wall_sizes))
|
||||||
set -l wall_size (string split ' ' $wall_sizes[$i])
|
set -l wall_size (string split ' ' $wall_sizes[$i])
|
||||||
if [ $wall_size[1] -ge $screen_size[1] -a $wall_size[2] -ge $screen_size[2] ]
|
if test $wall_size[1] -ge $screen_size[1] -a $wall_size[2] -ge $screen_size[2]
|
||||||
set -a wallpapers $unfiltered_wallpapers[$i]
|
set -a wallpapers $unfiltered_wallpapers[$i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check if the $wallpapers list is unset or empty
|
# Check if the $wallpapers list is unset or empty
|
||||||
if ! set -q wallpapers || [ -z "$wallpapers" ]
|
if ! set -q wallpapers || test -z "$wallpapers"
|
||||||
error "No valid images found in $wallpapers_dir"
|
error "No valid images found in $wallpapers_dir"
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user