Skip to content

Commit

Permalink
feat: add possibility to display rofi menus as normal windows (#1481)
Browse files Browse the repository at this point in the history
Co-authored-by: port19 <[email protected]>
  • Loading branch information
m0squdev and port19x authored Feb 27, 2025
1 parent e48843b commit df3e0a9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ani-cli
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/sh

version_number="4.9.8"
version_number="4.9.9"

# UI

external_menu() {
rofi "$1" -sort -dmenu -i -width 1500 -p "$2"
rofi "$1" -sort -dmenu -i -width 1500 -p "$2" "$3"
}

launcher() {
[ "$use_external_menu" = "0" ] && [ -z "$1" ] && set -- "+m" "$2"
[ "$use_external_menu" = "0" ] && fzf "$1" --reverse --cycle --prompt "$2"
[ "$use_external_menu" = "1" ] && external_menu "$1" "$2"
[ "$use_external_menu" = "1" ] && external_menu "$1" "$2" "$external_menu_args"
}

nth() {
Expand Down Expand Up @@ -365,6 +365,7 @@ esac
no_detach="${ANI_CLI_NO_DETACH:-0}"
exit_after_play="${ANI_CLI_EXIT_AFTER_PLAY:-0}"
use_external_menu="${ANI_CLI_EXTERNAL_MENU:-0}"
external_menu_normal_window="${ANI_CLI_EXTERNAL_MENU_NORMAL_WINDOW:-0}"
skip_intro="${ANI_CLI_SKIP_INTRO:-0}"
# shellcheck disable=SC2154
skip_title="$ANI_CLI_SKIP_TITLE"
Expand Down Expand Up @@ -445,6 +446,7 @@ while [ $# -gt 0 ]; do
done
[ "$use_external_menu" = "0" ] && multi_selection_flag="${ANI_CLI_MULTI_SELECTION:-"-m"}"
[ "$use_external_menu" = "1" ] && multi_selection_flag="${ANI_CLI_MULTI_SELECTION:-"-multi-select"}"
[ "$external_menu_normal_window" = "1" ] && external_menu_args="-normal-window"
printf "\33[2K\r\033[1;34mChecking dependencies...\033[0m\n"
dep_ch "curl" "sed" "grep" || true
[ "$skip_intro" = 1 ] && (dep_ch "ani-skip" || true)
Expand Down Expand Up @@ -479,7 +481,7 @@ case "$search" in
printf "\33[2K\r\033[1;36mSearch anime: \033[0m" && read -r query
done
else
[ -z "$query" ] && query=$(printf "" | external_menu "" "Search anime: ")
[ -z "$query" ] && query=$(printf "" | external_menu "" "Search anime: " "$external_menu_args")
[ -z "$query" ] && exit 1
fi
# for checking new releases by specifying anime name
Expand Down
3 changes: 3 additions & 0 deletions ani-cli.1
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Sets the player ani-cli uses. Can be debug (print links), download (equivalent t
\fBANI_CLI_EXTERNAL_MENU\fR
Controls the frontend of ani-cli. Can be 0 (uses fzf) or 1 (uses rofi dmenu). Default is 0.
.TP
\fBANI_CLI_EXTERNAL_MENU_NORMAL_WINDOW\fR
Controls the way rofi displays the window. Can be 0 (no additional arguments passed to rofi) or 1 (the menu is displayed as a normal window, -normal-window argument is passed to rofi). Default is 0.
.TP
\fBANI_CLI_LOG_EPISODE\fR
Controls the logging feature for playback. Can be 1(logs) or 0(doesn't log). Default is 1.
.TP
Expand Down

0 comments on commit df3e0a9

Please sign in to comment.