Compare commits

...

2 Commits

Author SHA1 Message Date
ksyasuda
1461c3bc62 change -only-match to -no-custom to allow ESC to quit rofi menus 2022-02-15 02:22:59 -08:00
ksyasuda
4c2d7ae27e window titles for rofi 2022-02-15 02:20:10 -08:00
2 changed files with 19 additions and 18 deletions

16
ani-cli
View File

@ -394,9 +394,9 @@ find_media() {
fi
get_directory_data "$inp"
selection="$(rofi -dpi "$DPI" -dmenu -only-match -async-pre-read 33 -config "$ROFI_CFG" \
selection="$(rofi -dpi "$DPI" -dmenu -no-custom -async-pre-read 33 -config "$ROFI_CFG" \
-l 15 -i -sep '|' -mesg "$(generate_span "Current directory: $inp")" -a "$watched" \
-p "Enter selection" <<< "$inputlist")"
-p "Enter selection" -window-title 'aniwrapper' <<< "$inputlist")"
lg "SELECTION: $selection" 1> /dev/stderr
case "$selection" in
Back | ../)
@ -439,7 +439,7 @@ get_search_query() {
msg="Choose from list of searched anime below, or enter a unique name of an anime to search for"
query=$(rofi -dpi "$DPI" -dmenu -l 15 -p "Search Anime:" \
-mesg "$(generate_span "$msg")" \
-config "$ROFI_CFG" < <(run_stmt "$stmt"))
-config "$ROFI_CFG" -window-title 'aniwrapper' < <(run_stmt "$stmt"))
query="${query//[1-9]*\. /}"
elif [ "$IS_ROFI" -eq 0 ]; then
prompt "Search Anime"
@ -496,9 +496,9 @@ anime_selection() {
# get the anime from indexed list
msg="$(generate_span "Query: $query")"
selection="$(rofi -dpi "$DPI" -dmenu -only-match \
selection="$(rofi -dpi "$DPI" -dmenu -no-custom \
-async-pre-read 33 -config "$ROFI_CFG" -l 15 -i -sep '|' \
-mesg "$msg" -a "$searched" -p "Enter selection" <<< "$menu")"
-mesg "$msg" -a "$searched" -p "Enter selection" -window-title 'aniwrapper' <<< "$menu")"
choice="${selection%%.*}" # remmove everything from . to end
lg "CHOICE: $choice"
if ((choice == cnt)); then
@ -559,7 +559,7 @@ episode_selection() {
-theme-str 'window {width: 45%;}' \
-a "$watch_history" \
-p "Select Episode [$first_ep_number, $last_ep_number]:" \
-mesg "$msg" \
-mesg "$msg" -window-title 'aniwrapper' \
-config "$ROFI_CFG"
)
ep_choice_start=$(printf '%s\n' "${choice}" | awk '{print $1}')
@ -908,8 +908,8 @@ main() {
done <<< "$qualities"
choice=$(rofi -dmenu -dpi "$DPI" -config "$ROFI_CFG" \
-theme-str 'listview {columns: 1;} window {width: 25%;}' \
-i -l 6 -only-match -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \
-p "Choose quality:" -selected-row "$cur_quality" <<< "$qualities")
-i -l 6 -no-custom -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \
-p "Choose quality:" -window-title 'aniwrapper' -selected-row "$cur_quality" <<< "$qualities")
quality=$(awk '{ print $2 }' <<< "$choice")
else
qualities="best|1080p|720p|480p|360p|worst"

View File

@ -113,10 +113,10 @@ run() {
get_quality() {
if ((IS_ROFI == 1)); then
selection=$(rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
-l 6 -selected-row 0 -a 0 \
-l 6 -selected-row 0 -a 0 -window-title 'aniwrapper' \
-theme-str 'listview {columns: 1;} window {width: 25%;}' \
-p "Choose video quality:" \
-sep '|' -only-match <<< "$QUALITIES")
-sep '|' -no-custom <<< "$QUALITIES")
QUALITY=$(awk '{print $2}' <<< "$selection")
else
qualities="best|1080p|720p|480p|360p|worst"
@ -241,7 +241,7 @@ get_player() {
PLAYER_FN=$(
awk '{print $NF}' < <(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \
-l 4 -theme-str 'listview {columns: 1;} window {width: 40%;}' \
-p "Enter video player:" \
-p "Enter video player:" -window-title 'aniwrapper' \
-mesg "$(printf "%s\n%s\n" "$(generate_span "$msg1")" "$(generate_span "$msg2")")" \
-a 0 -sep '|' <<< "$SUPPORTED_PLAYERS")
)
@ -299,7 +299,7 @@ get_dl_dir() {
rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
-theme-str 'listview {columns: 1;} window {width: 45%;}' \
-mesg "$(generate_span "Enter the path to the download directory, or leave blank to go with the default: $HOME/Videos/sauce/")" \
-l 1 -p "Enter download dir:"
-l 1 -p "Enter download dir:" -window-title 'aniwrapper'
)
# if dl_dir is none set to current directory
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
@ -314,9 +314,9 @@ get_dl_dir() {
main() {
((SILENT != 1)) && lg "CONFIG DIR: $CFG_DIR"
((SILENT != 1)) && lg "ROFI CFG: $CFG_FILE"
choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -only-match -sep '|' \
choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -no-custom -sep '|' \
-theme-str 'listview {columns: 1;} window {width: 45%;}' \
-config "$CFG_FILE" -l 7 -i -p "Aniwrapper")
-config "$CFG_FILE" -l 7 -i -p "Aniwrapper" -window-title 'aniwrapper')
[ "$choice" == "$quit" ] && quit
@ -351,11 +351,12 @@ main() {
# ---------------------------------------------------------------------------
lg "Play from file selected"
IS_PLAY_FROM_FILE=1
span=$(printf '%s\n%s\n' "$(generate_span "Provide a valid path to a directory or leave blank to go with the default: $HOME/Videos/sauce/")" "$(generate_span "The program will begin searching for media files from the supplied directory")")
span=$(printf '%s\n%s\n' "$(generate_span "Provide a path to a valid directory, or choose from the list below")" "$(generate_span "The program will begin searching for media files from the supplied directory")")
play_dir=$(
rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
-l 12 -mesg "$span" -p "Enter path to starting directory:" \
-async-pre-read 24 < <(sqlite3 -noheader -list "$CFG_DIR/history.sqlite3" <<< "SELECT directory FROM file_history WHERE filename = 'DIRECTORY' ORDER BY WATCH_DATE DESC;")
-async-pre-read 24 -matching 'fuzzy' -window-title 'aniwrapper' \
< <(sqlite3 -noheader -list "$CFG_DIR/history.sqlite3" <<< "SELECT directory FROM file_history WHERE filename = 'DIRECTORY' ORDER BY WATCH_DATE DESC;")
)
# trim trailing whitespace
play_dir="${play_dir%% }"
@ -393,9 +394,9 @@ main() {
# -----------------------------------------------------------------
[ -z "$THEMES" ] && seppuku "No themes provided... exiting"
theme_idx="$(get_theme_idx)"
choice=$(rofi -dmenu -config "$CFG_FILE" -dpi "$DPI" \
choice=$(rofi -dmenu -config "$CFG_FILE" -dpi "$DPI" -window-title 'aniwrapper' \
-theme-str 'listview {columns: 1;} window {width: 45%;}' \
-only-match -l 4 -i -p "Choose theme: " -sep '|' \
-no-custom -l 4 -i -p "Choose theme: " -sep '|' \
-theme-str 'listview { columns: 2; }' \
-a "$theme_idx" -selected-row "$theme_idx" <<< "$THEMES")
theme=$(awk '{ print $1 }' <<< "$choice")