change name of default theme to aniwrapper.rasi

update setup script to backup and update theme when updated on main repo
This commit is contained in:
ksyasuda 2022-01-02 23:18:38 -08:00
parent d48c702db1
commit 41c6e7649b
2 changed files with 24 additions and 20 deletions

View File

@ -5,17 +5,7 @@
######################
# DO NOT RUN AS ROOT #
######################
VERBOSE=0
DB="history.sqlite3"
# Set the XDG_CONFIG_HOME locally if not set
if [[ -z "$XDG_CONFIG_HOME" ]]; then
XDG_CONFIG_HOME="$HOME/.config"
fi
DIR="$XDG_CONFIG_HOME/aniwrapper"
MPV_DIR="$XDG_CONFIG_HOME/mpv"
VERBOSE=1
log() {
if [[ "$VERBOSE" -eq 1 ]]; then
@ -23,6 +13,14 @@ log() {
fi
}
DB="history.sqlite3"
DIR="${XDG_CONFIG_HOME:-$HOME/.config}/aniwrapper"
MPV_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/mpv"
log "CONFIG DIR:" "$DIR"
log "MPV DIR:" "$MPV_DIR"
# executes aniwrapper setup
# 1. create the aniwrapper directory in $XDG_CONFIG_HOME
# 2. create history databases in $DIR
@ -38,19 +36,26 @@ run_setup() {
log "Directory created"
fi
if [[ ! -f "$DIR"/"$DB" ]]; then
if [[ ! -f "$DIR/$DB" ]]; then
# Create the DB if not exists
log "Creating history database..."
sqlite3 "$DIR"/"$DB" < sql/watch_history_tbl.sql
sqlite3 "$DIR"/"$DB" < sql/search_history_tbl.sql
sqlite3 "$DIR/$DB" sql/watch_history_tbl.sql
sqlite3 "$DIR/$DB" sql/search_history_tbl.sql
log "History database created..."
fi
if [[ ! -f "$DIR/meh.rasi" ]]; then
if [[ ! -f "$DIR/aniwrapper.rasi" ]]; then
# Move theme files and skip-intro script to correct locations
log "Moving theme files..."
log "aniwrapper.rasi does not exist in filesystem... Moving theme files"
cp themes/* "$DIR"/
log "Theme files moved..."
elif diff -q "themes/aniwrapper.rasi" "$DIR/aniwrapper.rasi" &>/dev/null; then
log "Theme file has not changed... skipping"
else
log "Theme has changed... backing up old theme"
mv "$DIR/aniwrapper.rasi" "$DIR/aniwrapper.rasi.bak"
log "Renamed $DIR/aniwrapper.rasi -> $DIR/aniwrapper.rasi.bak"
cp themes/aniwrapper.rasi "$DIR/"
fi
log "Creating mpv/scripts/ directory if it doesn't exist..."
@ -60,7 +65,7 @@ run_setup() {
cp lua/skip-intro.lua "$MPV_DIR/scripts/"
log "Moved skip-intro.lua into scripts directory..."
else
log "skip-intro.lua already exists in $XDG_CONFIG_HOME/mpv/scripts/"
log "skip-intro.lua already exists in $XDG_CONFIG_HOME/mpv/scripts/... skipping"
fi
if [[ ! -d "$DIR/icons" ]]; then
@ -70,7 +75,6 @@ run_setup() {
# install aniwrapper icons
cp .assets/icons/* "$DIR/icons/"
log "Installed icons in config directory..."
# xdg-icon-resource install --size 64 ./assets/icons/icon-64.png aniwrapper --novendor
}
if run_setup; then

View File

@ -1,5 +1,5 @@
configuration {
font: "Open Sans 15";
font: "Open Sans 15";
display-drun: "Dmenu";
scroll-method: 0;
disable-history: false;
@ -52,7 +52,7 @@ window {
anchor: center;
location: center;
padding: 25;
width: 69%;
width: 80%;
}
listview {
lines: 12;