mirror of
https://github.com/ksyasuda/aniwrapper.git
synced 2024-11-22 03:19:53 -08:00
add option to switch themes from the main menu
This commit is contained in:
parent
7ae041e95a
commit
a1576f1549
91
aniwrapper
91
aniwrapper
@ -22,8 +22,8 @@ IS_ROFI=1
|
||||
VERBOSE=0
|
||||
SILENT=0
|
||||
|
||||
quit="6. Quit"
|
||||
options="1. Stream|2. Download|3. Continue|4. Play from File|5. Sync History|$quit"
|
||||
quit="7. Quit"
|
||||
options="1. Stream|2. Download|3. Continue|4. Play from File|5. Sync History|6. Choose Theme|$quit"
|
||||
theme=default
|
||||
|
||||
#############
|
||||
@ -123,38 +123,10 @@ generate_span() {
|
||||
printf "%s\n" "$span"
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while getopts 'vhqcdf:-:t:T:CQ:D:S' OPT; do
|
||||
case "$OPT" in
|
||||
h)
|
||||
help_text
|
||||
exit 0
|
||||
;;
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
q)
|
||||
GET_QUALITY=1
|
||||
lg "Quality prompt enabled"
|
||||
;;
|
||||
c)
|
||||
IS_ROFI=0
|
||||
lg "Command-line (ani-cli) mode set"
|
||||
;;
|
||||
d)
|
||||
IS_DOWNLOAD=1
|
||||
lg "Download flag set..."
|
||||
;;
|
||||
f)
|
||||
IS_PLAY_FROM_FILE=1
|
||||
play_path="$OPTARG"
|
||||
lg "Play from file flag set... skipping main menu"
|
||||
lg "PLAY_PATH: $play_path"
|
||||
;;
|
||||
t)
|
||||
theme="$OPTARG"
|
||||
lg "custom theme provided: $theme"
|
||||
case "$theme" in
|
||||
set_theme() {
|
||||
new_theme="$1"
|
||||
lg "theme: $new_theme"
|
||||
case "$new_theme" in
|
||||
aniwrapper)
|
||||
lg "Default theme chosen... doing nothing"
|
||||
theme=default
|
||||
@ -185,6 +157,39 @@ parse_args() {
|
||||
;;
|
||||
esac
|
||||
CFG_FILE="$CFG_DIR/themes/$ROFI_THEME"
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
while getopts 'vhqcdf:-:t:T:CQ:D:S' OPT; do
|
||||
case "$OPT" in
|
||||
h)
|
||||
help_text
|
||||
exit 0
|
||||
;;
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
q)
|
||||
GET_QUALITY=1
|
||||
lg "Quality prompt enabled"
|
||||
;;
|
||||
c)
|
||||
IS_ROFI=0
|
||||
lg "Command-line (ani-cli) mode set"
|
||||
;;
|
||||
d)
|
||||
IS_DOWNLOAD=1
|
||||
lg "Download flag set..."
|
||||
;;
|
||||
f)
|
||||
IS_PLAY_FROM_FILE=1
|
||||
play_path="$OPTARG"
|
||||
lg "Play from file flag set... skipping main menu"
|
||||
lg "PLAY_PATH: $play_path"
|
||||
;;
|
||||
t)
|
||||
theme="$OPTARG"
|
||||
set_theme "$theme"
|
||||
;;
|
||||
C)
|
||||
lg "Connecting to history database -> $CFG_DIR/history.sqlite3"
|
||||
@ -248,7 +253,7 @@ check_flags() {
|
||||
########
|
||||
main() {
|
||||
choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -only-match -sep '|' \
|
||||
-config "$CFG_FILE" -l 6 -i -p "Aniwrapper")
|
||||
-config "$CFG_FILE" -l 7 -i -p "Aniwrapper")
|
||||
|
||||
[ "$choice" == "$quit" ] && quit
|
||||
|
||||
@ -320,9 +325,21 @@ main() {
|
||||
fi
|
||||
;;
|
||||
6.)
|
||||
# ---------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------
|
||||
# choose theme
|
||||
# -----------------------------------------------------------------
|
||||
[ -z "$THEMES" ] && seppuku "No themes provided... exiting"
|
||||
choice=$(rofi -dmenu -config "$CFG_FILE" -dpi "$DPI" \
|
||||
-only-match -l 4 -i -p "Choose theme: " -sep '|' \
|
||||
-theme-str 'listview { columns: 2; }' <<< "$THEMES")
|
||||
theme=$(awk '{ print $1 }' <<< "$choice")
|
||||
set_theme "$theme"
|
||||
main
|
||||
;;
|
||||
7.)
|
||||
# -----------------------------------------------------------------
|
||||
# get out
|
||||
# ---------------------------------------------------------------------------
|
||||
# -----------------------------------------------------------------
|
||||
quit
|
||||
;;
|
||||
*)
|
||||
|
Loading…
Reference in New Issue
Block a user