Improve handling

This commit is contained in:
Alexis Jhon Gaspar 2023-10-15 20:09:36 +08:00
parent 9a27acf74f
commit 81fc79056d

View file

@ -15,7 +15,7 @@ settheme() {
read -p "Where is the theme directory? " waldir read -p "Where is the theme directory? " waldir
if [ -z "$waldir" ]; then if [ -z "$waldir" ]; then
waldir=".config/wal/colorschemes/dark" waldir="$HOME/.config/wal/colorschemes/dark"
if [[ -z $(ls -A "$waldir") ]]; then if [[ -z $(ls -A "$waldir") ]]; then
echo "Oh no! No files here!" echo "Oh no! No files here!"
settheme settheme
@ -40,14 +40,18 @@ settheme() {
wal --theme "$waldir/$theme.json" wal --theme "$waldir/$theme.json"
if [ -z "$picwaldir" ]; then if [ -z "$picwaldir" ]; then
setwallq setwallq
unset theme
else else
unset theme
command command
fi fi
else else
wal --theme "$waldir/$theme" wal --theme "$waldir/$theme"
if [ -z "$picwaldir" ]; then if [ -z "$picwaldir" ]; then
setwallq setwallq
unset theme
else else
unset theme
command command
fi fi
fi fi
@ -66,7 +70,7 @@ setwall() {
read -p "Where is the wallpaper directory? " picwaldir read -p "Where is the wallpaper directory? " picwaldir
if [ -z "$picwaldir" ]; then if [ -z "$picwaldir" ]; then
picwaldir="Pictures/Wallpapers" picwaldir="$HOME/Pictures/Wallpapers"
if [[ -z $(ls -A "$picwaldir") ]]; then if [[ -z $(ls -A "$picwaldir") ]]; then
echo "Oh no! No files here!" echo "Oh no! No files here!"
setwall setwall
@ -88,16 +92,28 @@ setwall() {
setwall setwall
else else
wal -i "$picwaldir/$picwal" -qst wal -i "$picwaldir/$picwal" -qst
read -p "Do you want to set the colors as well? (default is Yes) " colors if [ -z "$theme" ]; then
case $colors in setcolor1
[yY][eE][sS] | [yY]) setcolor2;; unset picwaldir
[nN][oO] | [nN]) wal -R -st;; else
*) setcolor2;; unset picwaldir
esac command
exit fi
fi fi
} }
setcolor1() {
read -p "Do you want to set the colors as well? (default is Yes) " colors
case $colors in
[yY][eE][sS] | [yY]) setcolor2;;
[nN][oO] | [nN]) wal -R -st && command;;
*) setcolor2;;
esac
exit
}
setcolor2() { setcolor2() {
read -p "Do you want to set colors automatically? (default is Yes) " manualcolor read -p "Do you want to set colors automatically? (default is Yes) " manualcolor