add better dracula theme and fix some bugs

This commit is contained in:
ksyasuda 2022-01-06 16:03:31 -08:00
parent d30fd90b9b
commit e734fb131f
2 changed files with 111 additions and 150 deletions

22
ani-cli
View File

@ -177,7 +177,11 @@ check_db() {
# $1: anime name: str # $1: anime name: str
# $2: either 'search' or 'watch' for which db to query # $2: either 'search' or 'watch' for which db to query
log "check_db $*" 1> /dev/stderr 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(*) \ stmt="SELECT DISTINCT COUNT(*) \
FROM file_history \ FROM file_history \
WHERE directory = '$2' \ WHERE directory = '$2' \
@ -362,16 +366,25 @@ generate_inputlist() {
get_file_history_as_string() { get_file_history_as_string() {
while read -r directory; do while read -r directory; do
continue continue
done <<< $(run_stmt "SELECT DISTINCT DIRECTORY FROM FILE_HISTORY;") done <<< "$(run_stmt 'SELECT DISTINCT DIRECTORY FROM FILE_HISTORY;')"
} }
generate_file_watchedlist() { generate_file_watchedlist() {
search_dir="$1" search_dir="$1"
watched="" watched=""
cnt=0 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 while read -r filename; do
if ! check_db "file" "$search_dir" "$filename"; then 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" [ "$watched" = "" ] && watched="$cnt" || watched="$watched, $cnt"
fi fi
((++cnt)) ((++cnt))
@ -396,6 +409,7 @@ find_media() {
span=$(generate_span "Current directory: $inp") span=$(generate_span "Current directory: $inp")
inputlist=$(generate_inputlist "$inp") inputlist=$(generate_inputlist "$inp")
watched_files=$(generate_file_watchedlist "$inp") watched_files=$(generate_file_watchedlist "$inp")
log "watched files -> $watched_files"
selection=$(rofi -dmenu -only-match -config "$ROFI_CFG" \ selection=$(rofi -dmenu -only-match -config "$ROFI_CFG" \
-l 13 -i -sep '|' -mesg "$span" -a "$watched_files" \ -l 13 -i -sep '|' -mesg "$span" -a "$watched_files" \
-p "Enter selection" <<< "${inputlist[@]}") -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" msg="Choose from list of searched anime below, or enter a unique name of an anime to search for"
span="<span foreground='peachpuff' style='italic' size='small' weight='light'>$msg</span>" span="<span foreground='peachpuff' style='italic' size='small' weight='light'>$msg</span>"
if [ -z "$*" ] && [ "$is_rofi" -eq 1 ]; then 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" \ -mesg "$span" \
-config "$ROFI_CFG" <<< "${hist[@]}") -config "$ROFI_CFG" <<< "${hist[@]}")
# Remove the id from the query # Remove the id from the query

View File

@ -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 % ); /* Dracula theme colour palette */
selected-normal-foreground: rgba ( 255, 147, 5, 100 % ); drac-bgd: #282a36;
/* foreground: rgba ( 196, 203, 212, 100 % ); */ drac-cur: #44475a;
foreground: #ecbe7b; drac-fgd: #f8f8f2;
normal-foreground: @foreground; drac-cmt: #6272a4;
alternate-normal-background: rgba ( 45, 48, 59, 1 % ); drac-cya: #8be9fd;
red: #ff6c6b; drac-grn: #50fa7b;
selected-urgent-foreground: rgba ( 249, 249, 249, 100 % ); drac-ora: #ffb86c;
blue: #1E90FF; drac-pnk: #ff79c6;
urgent-foreground: rgba ( 204, 102, 102, 100 % ); drac-pur: #bd93f9;
alternate-urgent-background: rgba ( 75, 81, 96, 90 % ); drac-red: #ff5555;
active-foreground: #bd93f9; drac-yel: #f1fa8c;
lightbg: rgba ( 238, 232, 213, 100 % );
selected-active-foreground: #1E90FF; font: "Jetbrains Mono 14";
alternate-active-background: rgba ( 45, 48, 59, 95 % );
background: #282a36; foreground: @drac-fgd;
alternate-normal-foreground: @foreground; background: @drac-bgd;
normal-background: rgba ( 45, 48, 59, 1 % ); active-background: @drac-pnk;
lightfg: rgba ( 88, 104, 117, 100 % ); urgent-background: @drac-red;
selected-normal-background: rgba ( 24, 26, 32, 80 % );
spacing: 2; selected-background: @active-background;
separatorcolor: #44475a; selected-urgent-background: @urgent-background;
urgent-background: rgba ( 45, 48, 59, 15 % ); selected-active-background: @active-background;
selected-urgent-background: rgba ( 165, 66, 66, 100 % ); separatorcolor: @active-background;
alternate-urgent-foreground: @urgent-foreground; bordercolor: #6272a4;
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;
} }
#window {
window {
background-color: @background; background-color: @background;
border: 5px; border: 3;
border-radius: 7px; border-radius: 6;
border-color: #282a36; border-color: @bordercolor;
anchor: center; padding: 5;
location: center; width: 75%;
padding: 25;
width: 80%;
} }
listview { #mainbox {
lines: 12;
columns: 2;
}
mainbox {
border: 0; border: 0;
padding: 2px; padding: 5;
} }
#message {
message { border: 1px dash 0px 0px ;
border: 0;
border-color: @separatorcolor; border-color: @separatorcolor;
padding: 1px ; padding: 1px ;
text-color: @active-foreground;
} }
#textbox {
textbox {
border: 0;
text-color: @foreground; text-color: @foreground;
background-color: @blackwidget;
} }
#listview {
listview {
border: 0;
dynamic: true;
fixed-height: 0; fixed-height: 0;
spacing: 10px ; border: 2px dash 0px 0px ;
border-color: @bordercolor;
spacing: 2px ;
scrollbar: false; scrollbar: false;
padding: 2px 0px 0px 0px; padding: 2px 0px 0px ;
margin: 0px 0px 1px 0px; columns: 2;
lines: 15;
} }
element { #element {
border: 4px; border: 0;
border-color: @element-border; padding: 4px ;
padding: 2px 15px;
margin: 1px;
} }
element-text { #element.normal.normal {
background-color: inherit; background-color: @background;
text-color: @element-text; text-color: @foreground;
} }
element.normal.normal { #element.normal.urgent {
background-color: @normal-background;
text-color: @normal-foreground;
}
element.normal.urgent {
background-color: @urgent-background; background-color: @urgent-background;
text-color: @urgent-foreground; text-color: @urgent-foreground;
} }
element.normal.active { #element.normal.active {
background-color: @active-background; background-color: @active-background;
border-color: @normal-active; text-color: @background;
text-color: @element-selected-border;
} }
element.selected.normal { #element.selected.normal {
background-color: @element-selected-background; background-color: @selected-background;
border-color: @element-selected-border; text-color: @foreground;
text-color: @element-selected-border;
} }
element.selected.urgent { #element.selected.urgent {
background-color: @selected-urgent-background; background-color: @selected-urgent-background;
text-color: @selected-urgent-foreground; text-color: @foreground;
} }
element.selected.active { #element.selected.active {
background-color: @element-selected-background; background-color: @selected-active-background;
text-color: @normal-active; text-color: @foreground;
border-color: @element-selected-border;
} }
#element.alternate.normal {
scrollbar { background-color: @background;
width: 4px ; 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; border: 0;
handle-color: @normal-foreground;
handle-width: 8px ; handle-width: 8px ;
padding: 0; padding: 0;
} }
#sidebar {
mode-switcher { border: 2px dash 0px 0px ;
border: 2px 0px 0px ;
border-color: @separatorcolor; border-color: @separatorcolor;
} }
#button.selected {
button { background-color: @selected-background;
text-color: @foreground;
}
#inputbar {
spacing: 0; spacing: 0;
text-color: @normal-foreground; text-color: @foreground;
padding: 1px ;
} }
#case-indicator {
button.selected {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
}
inputbar {
spacing: 0; spacing: 0;
text-color: @normal-foreground; text-color: @foreground;
padding: 6px;
} }
#entry {
case-indicator {
spacing: 0; spacing: 0;
text-color: @normal-foreground; text-color: @drac-cya;
} }
#prompt {
entry {
padding: 4px 8px;
spacing: 0; spacing: 0;
text-color: @input-text; text-color: @drac-grn;
} }
#inputbar {
prompt { children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
spacing: 0;
text-color: @prompt-text;
padding: 4px 0px;
} }
#textbox-prompt-colon {
inputbar {
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
padding: 15px 0px;
}
textbox-prompt-colon {
expand: false; expand: false;
str: ":"; str: ":";
margin: 0px 0.3em 0em 0em ; margin: 0px 0.3em 0em 0em ;
text-color: @prompt-text; text-color: @drac-grn;
padding: 4px 0px;
} }