Skip to content

Commit 2fe11a7

Browse files
Doom-Gitport19x
andauthored
feat: added dmenu support (#1569)
Co-authored-by: port19 <port19@port19.xyz>
1 parent 4dbb799 commit 2fe11a7

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

ani-cli

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
#!/bin/sh
22

3-
version_number="4.10.4"
3+
version_number="4.10.5"
44

55
# UI
66

77
external_menu() {
8-
rofi "$1" -sort -dmenu -i -width 1500 -p "$2" "$3"
8+
[ "$use_external_menu" = "1" ] && rofi "$1" -sort -dmenu -i -width 1500 -p "$2" "$3"
9+
[ "$use_external_menu" = "2" ] && dmenu -l 20 -p "$1"
910
}
1011

1112
launcher() {
1213
[ "$use_external_menu" = "0" ] && [ -z "$1" ] && set -- "+m" "$2"
1314
[ "$use_external_menu" = "0" ] && fzf "$1" --reverse --cycle --prompt "$2"
1415
[ "$use_external_menu" = "1" ] && external_menu "$1" "$2" "$external_menu_args"
16+
[ "$use_external_menu" = "2" ] && external_menu "$1"
1517
}
1618

1719
nth() {
@@ -72,6 +74,8 @@ help_info() {
7274
Play dubbed version
7375
--rofi
7476
Use rofi instead of fzf for the interactive menu
77+
--dmenu
78+
Use dmenu instead of fzf for the interactive menu
7579
--skip
7680
Use ani-skip to skip the intro of the episode (mpv only)
7781
--no-detach
@@ -347,6 +351,7 @@ play_episode() {
347351
unset episode
348352
update_history
349353
[ "$use_external_menu" = "1" ] && wait
354+
[ "$use_external_menu" = "2" ] && wait
350355
}
351356

352357
play() {
@@ -401,7 +406,8 @@ external_menu_normal_window="${ANI_CLI_EXTERNAL_MENU_NORMAL_WINDOW:-0}"
401406
skip_intro="${ANI_CLI_SKIP_INTRO:-0}"
402407
# shellcheck disable=SC2154
403408
skip_title="$ANI_CLI_SKIP_TITLE"
404-
[ -t 0 ] || use_external_menu=1
409+
[ -t 0 ] || command -v dmenu && use_external_menu=2
410+
[ -t 0 ] || command -v rofi && use_external_menu=1
405411
hist_dir="${ANI_CLI_HIST_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}/ani-cli}"
406412
[ ! -d "$hist_dir" ] && mkdir -p "$hist_dir"
407413
histfile="$hist_dir/ani-hsts"
@@ -466,6 +472,7 @@ while [ $# -gt 0 ]; do
466472
--no-detach) no_detach=1 ;;
467473
--exit-after-play) exit_after_play=1 && no_detach=1 ;;
468474
--rofi) use_external_menu=1 ;;
475+
--dmenu) use_external_menu=2 ;;
469476
--skip) skip_intro=1 ;;
470477
--skip-title)
471478
[ $# -lt 2 ] && die "missing argument!"

0 commit comments

Comments
 (0)