mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
less hardcoding in theme selection and row highlighting
This commit is contained in:
parent
e29d3f7db3
commit
90dec870e0
34
ani-cli
34
ani-cli
@ -4,7 +4,7 @@ CFG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aniwrapper"
|
|||||||
HISTORY_DB="$CFG_DIR/history.sqlite3"
|
HISTORY_DB="$CFG_DIR/history.sqlite3"
|
||||||
ROFI_CFG="$CFG_DIR/themes/aniwrapper.rasi"
|
ROFI_CFG="$CFG_DIR/themes/aniwrapper.rasi"
|
||||||
ROFI_THEME="aniwrapper.rasi"
|
ROFI_THEME="aniwrapper.rasi"
|
||||||
THEMES="aniwrapper (default)|dracula|doomone|fancy|material|nord|nord2|onedark"
|
THEMES="aniwrapper|dracula|doomone|fancy|material|nord|nord2|onedark"
|
||||||
ANIWRAPPER_ICON_PATH="$CFG_DIR/icons/icon-64.png"
|
ANIWRAPPER_ICON_PATH="$CFG_DIR/icons/icon-64.png"
|
||||||
MAISAN_ICON_PATH="$CFG_DIR/icons/MYsan.png"
|
MAISAN_ICON_PATH="$CFG_DIR/icons/MYsan.png"
|
||||||
DPI=96
|
DPI=96
|
||||||
@ -723,35 +723,15 @@ parse_args() {
|
|||||||
t)
|
t)
|
||||||
theme="$OPTARG"
|
theme="$OPTARG"
|
||||||
case "$theme" in
|
case "$theme" in
|
||||||
aniwrapper)
|
aniwrapper | default)
|
||||||
ROFI_THEME=aniwrapper.rasi
|
ROFI_THEME=aniwrapper.rasi
|
||||||
;;
|
;;
|
||||||
default)
|
|
||||||
ROFI_THEME=aniwrapper.rasi
|
|
||||||
;;
|
|
||||||
dracula)
|
|
||||||
ROFI_THEME=aniwrapper-dracula.rasi
|
|
||||||
;;
|
|
||||||
doomone | doom-one)
|
|
||||||
ROFI_THEME=aniwrapper-doomone.rasi
|
|
||||||
;;
|
|
||||||
fancy)
|
|
||||||
ROFI_THEME=aniwrapper-fancy.rasi
|
|
||||||
;;
|
|
||||||
material)
|
|
||||||
ROFI_THEME=aniwrapper-material.rasi
|
|
||||||
;;
|
|
||||||
nord)
|
|
||||||
ROFI_THEME=aniwrapper-nord.rasi
|
|
||||||
;;
|
|
||||||
nord2)
|
|
||||||
ROFI_THEME=aniwrapper-nord2.rasi
|
|
||||||
;;
|
|
||||||
onedark)
|
|
||||||
ROFI_THEME=aniwrapper-onedark.rasi
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
die "$theme not a valid theme file. Themes: [$THEMES]"
|
if [[ "$theme" =~ ($THEMES) ]]; then
|
||||||
|
ROFI_THEME="aniwrapper-$theme.rasi"
|
||||||
|
else
|
||||||
|
die "Invalid theme: $theme. Please choose from: $THEMES"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
lg "Setting theme for ani-cli -> $ROFI_THEME"
|
lg "Setting theme for ani-cli -> $ROFI_THEME"
|
||||||
|
65
aniwrapper
65
aniwrapper
@ -133,36 +133,18 @@ get_quality() {
|
|||||||
|
|
||||||
# return the index in $THEMES of $ROFI_THEME
|
# return the index in $THEMES of $ROFI_THEME
|
||||||
get_theme_idx() {
|
get_theme_idx() {
|
||||||
case "$ROFI_THEME" in
|
themeslist="aniwrapper.rasi|aniwrapper-dracula.rasi|aniwrapper-doomone.rasi|aniwrapper-fancy.rasi|aniwrapper-material.rasi|aniwrapper-nord.rasi|aniwrapper-nord2.rasi|aniwrapper-onedark.rasi"
|
||||||
aniwrapper.rasi)
|
idx=0
|
||||||
theme_idx=0
|
while IFS='|' read -ra themes; do
|
||||||
;;
|
for t in "${themes[@]}"; do
|
||||||
aniwrapper-dracula.rasi)
|
if [[ "$t" == "$ROFI_THEME" ]]; then
|
||||||
theme_idx=1
|
lg "theme -> $t | theme index -> $idx" > /dev/stderr
|
||||||
;;
|
printf "%s\n" "$idx"
|
||||||
aniwrapper-doomone.rasi)
|
break
|
||||||
theme_idx=2
|
fi
|
||||||
;;
|
((++idx))
|
||||||
aniwrapper-fancy.rasi)
|
done
|
||||||
theme_idx=3
|
done <<< "$themeslist"
|
||||||
;;
|
|
||||||
aniwrapper-material.rasi)
|
|
||||||
theme_idx=4
|
|
||||||
;;
|
|
||||||
aniwrapper-nord.rasi)
|
|
||||||
theme_idx=5
|
|
||||||
;;
|
|
||||||
aniwrapper-nord2.rasi)
|
|
||||||
theme_idx=6
|
|
||||||
;;
|
|
||||||
aniwrapper-onedark.rasi)
|
|
||||||
theme_idx=7
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
printf "%s" "$theme_idx"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# generates a span mesg for rofi given
|
# generates a span mesg for rofi given
|
||||||
@ -179,29 +161,8 @@ set_theme() {
|
|||||||
aniwrapper)
|
aniwrapper)
|
||||||
ROFI_THEME=aniwrapper.rasi
|
ROFI_THEME=aniwrapper.rasi
|
||||||
;;
|
;;
|
||||||
dracula)
|
|
||||||
ROFI_THEME=aniwrapper-dracula.rasi
|
|
||||||
;;
|
|
||||||
doomone | doom-one)
|
|
||||||
ROFI_THEME=aniwrapper-doomone.rasi
|
|
||||||
;;
|
|
||||||
fancy)
|
|
||||||
ROFI_THEME=aniwrapper-fancy.rasi
|
|
||||||
;;
|
|
||||||
material)
|
|
||||||
ROFI_THEME=aniwrapper-material.rasi
|
|
||||||
;;
|
|
||||||
nord)
|
|
||||||
ROFI_THEME=aniwrapper-nord.rasi
|
|
||||||
;;
|
|
||||||
nord2)
|
|
||||||
ROFI_THEME=aniwrapper-nord2.rasi
|
|
||||||
;;
|
|
||||||
onedark)
|
|
||||||
ROFI_THEME=aniwrapper-onedark.rasi
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
seppuku "$theme not a valid theme file. Themes: [$THEMES]"
|
ROFI_THEME="aniwrapper-$new_theme.rasi"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
lg "Chosen theme -> $ROFI_THEME"
|
lg "Chosen theme -> $ROFI_THEME"
|
||||||
|
Loading…
Reference in New Issue
Block a user