Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add possibility to display rofi menus as normal windows #1481

Merged
merged 8 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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