window titles for rofi

This commit is contained in:
ksyasuda 2022-02-15 02:20:10 -08:00
parent d2611e6e33
commit 4c2d7ae27e
2 changed files with 13 additions and 12 deletions

10
ani-cli
View File

@ -396,7 +396,7 @@ find_media() {
get_directory_data "$inp" get_directory_data "$inp"
selection="$(rofi -dpi "$DPI" -dmenu -only-match -async-pre-read 33 -config "$ROFI_CFG" \ selection="$(rofi -dpi "$DPI" -dmenu -only-match -async-pre-read 33 -config "$ROFI_CFG" \
-l 15 -i -sep '|' -mesg "$(generate_span "Current directory: $inp")" -a "$watched" \ -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 lg "SELECTION: $selection" 1> /dev/stderr
case "$selection" in case "$selection" in
Back | ../) 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" 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:" \ query=$(rofi -dpi "$DPI" -dmenu -l 15 -p "Search Anime:" \
-mesg "$(generate_span "$msg")" \ -mesg "$(generate_span "$msg")" \
-config "$ROFI_CFG" < <(run_stmt "$stmt")) -config "$ROFI_CFG" -window-title 'aniwrapper' < <(run_stmt "$stmt"))
query="${query//[1-9]*\. /}" query="${query//[1-9]*\. /}"
elif [ "$IS_ROFI" -eq 0 ]; then elif [ "$IS_ROFI" -eq 0 ]; then
prompt "Search Anime" prompt "Search Anime"
@ -498,7 +498,7 @@ anime_selection() {
msg="$(generate_span "Query: $query")" msg="$(generate_span "Query: $query")"
selection="$(rofi -dpi "$DPI" -dmenu -only-match \ selection="$(rofi -dpi "$DPI" -dmenu -only-match \
-async-pre-read 33 -config "$ROFI_CFG" -l 15 -i -sep '|' \ -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 choice="${selection%%.*}" # remmove everything from . to end
lg "CHOICE: $choice" lg "CHOICE: $choice"
if ((choice == cnt)); then if ((choice == cnt)); then
@ -559,7 +559,7 @@ episode_selection() {
-theme-str 'window {width: 45%;}' \ -theme-str 'window {width: 45%;}' \
-a "$watch_history" \ -a "$watch_history" \
-p "Select Episode [$first_ep_number, $last_ep_number]:" \ -p "Select Episode [$first_ep_number, $last_ep_number]:" \
-mesg "$msg" \ -mesg "$msg" -window-title 'aniwrapper' \
-config "$ROFI_CFG" -config "$ROFI_CFG"
) )
ep_choice_start=$(printf '%s\n' "${choice}" | awk '{print $1}') ep_choice_start=$(printf '%s\n' "${choice}" | awk '{print $1}')
@ -909,7 +909,7 @@ main() {
choice=$(rofi -dmenu -dpi "$DPI" -config "$ROFI_CFG" \ choice=$(rofi -dmenu -dpi "$DPI" -config "$ROFI_CFG" \
-theme-str 'listview {columns: 1;} window {width: 25%;}' \ -theme-str 'listview {columns: 1;} window {width: 25%;}' \
-i -l 6 -only-match -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \ -i -l 6 -only-match -sep '|' -a "$cur_quality" -mesg "$(generate_span "Current quality: $quality")" \
-p "Choose quality:" -selected-row "$cur_quality" <<< "$qualities") -p "Choose quality:" -window-title 'aniwrapper' -selected-row "$cur_quality" <<< "$qualities")
quality=$(awk '{ print $2 }' <<< "$choice") quality=$(awk '{ print $2 }' <<< "$choice")
else else
qualities="best|1080p|720p|480p|360p|worst" qualities="best|1080p|720p|480p|360p|worst"

View File

@ -113,7 +113,7 @@ run() {
get_quality() { get_quality() {
if ((IS_ROFI == 1)); then if ((IS_ROFI == 1)); then
selection=$(rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \ 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%;}' \ -theme-str 'listview {columns: 1;} window {width: 25%;}' \
-p "Choose video quality:" \ -p "Choose video quality:" \
-sep '|' -only-match <<< "$QUALITIES") -sep '|' -only-match <<< "$QUALITIES")
@ -241,7 +241,7 @@ get_player() {
PLAYER_FN=$( PLAYER_FN=$(
awk '{print $NF}' < <(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \ awk '{print $NF}' < <(rofi -dmenu -config "$CFG_FILE" -DPI "$DPI" \
-l 4 -theme-str 'listview {columns: 1;} window {width: 40%;}' \ -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")")" \ -mesg "$(printf "%s\n%s\n" "$(generate_span "$msg1")" "$(generate_span "$msg2")")" \
-a 0 -sep '|' <<< "$SUPPORTED_PLAYERS") -a 0 -sep '|' <<< "$SUPPORTED_PLAYERS")
) )
@ -299,7 +299,7 @@ get_dl_dir() {
rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \ rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
-theme-str 'listview {columns: 1;} window {width: 45%;}' \ -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/")" \ -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 # if dl_dir is none set to current directory
[ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD" [ "$dl_dir" == "" ] && dl_dir="$DEFAULT_DOWNLOAD"
@ -316,7 +316,7 @@ main() {
((SILENT != 1)) && lg "ROFI CFG: $CFG_FILE" ((SILENT != 1)) && lg "ROFI CFG: $CFG_FILE"
choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -only-match -sep '|' \ choice=$(echo "${options[@]}" | rofi -dpi "$DPI" -dmenu -only-match -sep '|' \
-theme-str 'listview {columns: 1;} window {width: 45%;}' \ -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 [ "$choice" == "$quit" ] && quit
@ -351,11 +351,12 @@ main() {
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
lg "Play from file selected" lg "Play from file selected"
IS_PLAY_FROM_FILE=1 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=$( play_dir=$(
rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \ rofi -dpi "$DPI" -dmenu -config "$CFG_FILE" \
-l 12 -mesg "$span" -p "Enter path to starting directory:" \ -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 # trim trailing whitespace
play_dir="${play_dir%% }" play_dir="${play_dir%% }"
@ -393,7 +394,7 @@ main() {
# ----------------------------------------------------------------- # -----------------------------------------------------------------
[ -z "$THEMES" ] && seppuku "No themes provided... exiting" [ -z "$THEMES" ] && seppuku "No themes provided... exiting"
theme_idx="$(get_theme_idx)" 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%;}' \ -theme-str 'listview {columns: 1;} window {width: 45%;}' \
-only-match -l 4 -i -p "Choose theme: " -sep '|' \ -only-match -l 4 -i -p "Choose theme: " -sep '|' \
-theme-str 'listview { columns: 2; }' \ -theme-str 'listview { columns: 2; }' \