From e734fb131ff64e182c4ad639100338a7966ff6ca Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Thu, 6 Jan 2022 16:03:31 -0800 Subject: [PATCH] add better dracula theme and fix some bugs --- ani-cli | 22 ++- themes/aniwrapper-dracula.rasi | 239 +++++++++++++-------------------- 2 files changed, 111 insertions(+), 150 deletions(-) diff --git a/ani-cli b/ani-cli index 5b60484..4289464 100755 --- a/ani-cli +++ b/ani-cli @@ -177,7 +177,11 @@ check_db() { # $1: anime name: str # $2: either 'search' or 'watch' for which db to query log "check_db $*" 1> /dev/stderr - if [[ "$1" == "file" ]]; then + if [[ "$1" == "directory" ]]; then + stmt="SELECT DISTINCT COUNT(*) \ + FROM file_history \ + WHERE directory = '$2';" + elif [[ "$1" == "file" ]]; then stmt="SELECT DISTINCT COUNT(*) \ FROM file_history \ WHERE directory = '$2' \ @@ -362,16 +366,25 @@ generate_inputlist() { get_file_history_as_string() { while read -r directory; do continue - done <<< $(run_stmt "SELECT DISTINCT DIRECTORY FROM FILE_HISTORY;") + done <<< "$(run_stmt 'SELECT DISTINCT DIRECTORY FROM FILE_HISTORY;')" } generate_file_watchedlist() { search_dir="$1" watched="" cnt=0 + while read -r directory; do + # sometimes direetory is empty string due to find parsing + [ -z "$directory" ] && continue + if ! check_db "directory" "$search_dir/$directory"; then + log "$search_dir/$directory opened before... adding $cnt to list" 1> /dev/stderr + [ "$watched" = "" ] && watched="$cnt" || watched="$watched, $cnt" + fi + ((++cnt)) + done <<< "$(find "$search_dir" -maxdepth 1 -type d | sed -E "s|$search_dir/||" | tail -n +2 | sort -V)" while read -r filename; do if ! check_db "file" "$search_dir" "$filename"; then - log "$filename watched before... adding to list" 1> /dev/stderr + log "$filename watched before... adding $cnt to list" 1> /dev/stderr [ "$watched" = "" ] && watched="$cnt" || watched="$watched, $cnt" fi ((++cnt)) @@ -396,6 +409,7 @@ find_media() { span=$(generate_span "Current directory: $inp") inputlist=$(generate_inputlist "$inp") watched_files=$(generate_file_watchedlist "$inp") + log "watched files -> $watched_files" selection=$(rofi -dmenu -only-match -config "$ROFI_CFG" \ -l 13 -i -sep '|' -mesg "$span" -a "$watched_files" \ -p "Enter selection" <<< "${inputlist[@]}") @@ -425,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" span="$msg" if [ -z "$*" ] && [ "$is_rofi" -eq 1 ]; then - query=$(rofi -dmenu -l 12 -p "Search Anime:" \ + query=$(rofi -dmenu -l 15 -p "Search Anime:" \ -mesg "$span" \ -config "$ROFI_CFG" <<< "${hist[@]}") # Remove the id from the query diff --git a/themes/aniwrapper-dracula.rasi b/themes/aniwrapper-dracula.rasi index 5d8b826..5bcd4e6 100644 --- a/themes/aniwrapper-dracula.rasi +++ b/themes/aniwrapper-dracula.rasi @@ -1,191 +1,138 @@ -configuration { - font: "Open Sans 15"; - display-drun: "Dmenu"; - scroll-method: 0; - disable-history: false; - sidebar-mode: true; - steal-focus: true; -} - * { - selected-normal-foreground: rgba ( 255, 147, 5, 100 % ); - selected-normal-foreground: rgba ( 255, 147, 5, 100 % ); - /* foreground: rgba ( 196, 203, 212, 100 % ); */ - foreground: #ecbe7b; - normal-foreground: @foreground; - alternate-normal-background: rgba ( 45, 48, 59, 1 % ); - red: #ff6c6b; - selected-urgent-foreground: rgba ( 249, 249, 249, 100 % ); - blue: #1E90FF; - urgent-foreground: rgba ( 204, 102, 102, 100 % ); - alternate-urgent-background: rgba ( 75, 81, 96, 90 % ); - active-foreground: #bd93f9; - lightbg: rgba ( 238, 232, 213, 100 % ); - selected-active-foreground: #1E90FF; - alternate-active-background: rgba ( 45, 48, 59, 95 % ); - background: #282a36; - alternate-normal-foreground: @foreground; - normal-background: rgba ( 45, 48, 59, 1 % ); - lightfg: rgba ( 88, 104, 117, 100 % ); - selected-normal-background: rgba ( 24, 26, 32, 80 % ); - spacing: 2; - separatorcolor: #44475a; - urgent-background: rgba ( 45, 48, 59, 15 % ); - selected-urgent-background: rgba ( 165, 66, 66, 100 % ); - alternate-urgent-foreground: @urgent-foreground; - background-color: rgba ( 0, 0, 0, 0 % ); - alternate-active-foreground: @active-foreground; - active-background: rgba ( 29, 31, 33, 24 % ); - selected-active-background: rgba ( 26, 28, 35, 100 % ); - black: #464b55; - blackwidget: #262626; - magenta: #c678dd; - blue2: #51afef; - element-border: #44475a; - element-text: #bd93f9; - element-selected-background: #44475a; - element-selected-border: #ffb86c; - normal-active: #8be9fd; - prompt-text: #ff79c6; - input-text: #50fa7b; + /* Dracula theme colour palette */ + drac-bgd: #282a36; + drac-cur: #44475a; + drac-fgd: #f8f8f2; + drac-cmt: #6272a4; + drac-cya: #8be9fd; + drac-grn: #50fa7b; + drac-ora: #ffb86c; + drac-pnk: #ff79c6; + drac-pur: #bd93f9; + drac-red: #ff5555; + drac-yel: #f1fa8c; + + font: "Jetbrains Mono 14"; + + foreground: @drac-fgd; + background: @drac-bgd; + active-background: @drac-pnk; + urgent-background: @drac-red; + + selected-background: @active-background; + selected-urgent-background: @urgent-background; + selected-active-background: @active-background; + separatorcolor: @active-background; + bordercolor: #6272a4; } - -window { +#window { background-color: @background; - border: 5px; - border-radius: 7px; - border-color: #282a36; - anchor: center; - location: center; - padding: 25; - width: 80%; + border: 3; + border-radius: 6; + border-color: @bordercolor; + padding: 5; + width: 75%; } -listview { - lines: 12; - columns: 2; -} - -mainbox { +#mainbox { border: 0; - padding: 2px; + padding: 5; } - -message { - border: 0; +#message { + border: 1px dash 0px 0px ; border-color: @separatorcolor; padding: 1px ; - text-color: @active-foreground; } - -textbox { - border: 0; +#textbox { text-color: @foreground; - background-color: @blackwidget; } - -listview { - border: 0; - dynamic: true; +#listview { fixed-height: 0; - spacing: 10px ; + border: 2px dash 0px 0px ; + border-color: @bordercolor; + spacing: 2px ; scrollbar: false; - padding: 2px 0px 0px 0px; - margin: 0px 0px 1px 0px; + padding: 2px 0px 0px ; + columns: 2; + lines: 15; } -element { - border: 4px; - border-color: @element-border; - padding: 2px 15px; - margin: 1px; +#element { + border: 0; + padding: 4px ; } -element-text { - background-color: inherit; - text-color: @element-text; +#element.normal.normal { + background-color: @background; + text-color: @foreground; } -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} -element.normal.urgent { +#element.normal.urgent { background-color: @urgent-background; text-color: @urgent-foreground; } -element.normal.active { +#element.normal.active { background-color: @active-background; - border-color: @normal-active; - text-color: @element-selected-border; + text-color: @background; } -element.selected.normal { - background-color: @element-selected-background; - border-color: @element-selected-border; - text-color: @element-selected-border; +#element.selected.normal { + background-color: @selected-background; + text-color: @foreground; } -element.selected.urgent { +#element.selected.urgent { background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; + text-color: @foreground; } -element.selected.active { - background-color: @element-selected-background; - text-color: @normal-active; - border-color: @element-selected-border; +#element.selected.active { + background-color: @selected-active-background; + text-color: @foreground; } - -scrollbar { - width: 4px ; +#element.alternate.normal { + background-color: @background; + text-color: @foreground; +} +#element.alternate.urgent { + background-color: @urgent-background; + text-color: @foreground; +} +#element.alternate.active { + background-color: @active-background; + text-color: @foreground; +} +#scrollbar { + width: 2px ; border: 0; - handle-color: @normal-foreground; handle-width: 8px ; padding: 0; } - -mode-switcher { - border: 2px 0px 0px ; +#sidebar { + border: 2px dash 0px 0px ; border-color: @separatorcolor; } - -button { +#button.selected { + background-color: @selected-background; + text-color: @foreground; +} +#inputbar { spacing: 0; - text-color: @normal-foreground; + text-color: @foreground; + padding: 1px ; } - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -inputbar { +#case-indicator { spacing: 0; - text-color: @normal-foreground; - padding: 6px; + text-color: @foreground; } - -case-indicator { +#entry { spacing: 0; - text-color: @normal-foreground; + text-color: @drac-cya; } - -entry { - padding: 4px 8px; +#prompt { spacing: 0; - text-color: @input-text; + text-color: @drac-grn; } - -prompt { - spacing: 0; - text-color: @prompt-text; - padding: 4px 0px; +#inputbar { + children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; } - -inputbar { - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; - padding: 15px 0px; -} - -textbox-prompt-colon { +#textbox-prompt-colon { expand: false; str: ":"; margin: 0px 0.3em 0em 0em ; - text-color: @prompt-text; - padding: 4px 0px; + text-color: @drac-grn; }