From 41c6e7649b368f6247bc9f728284aec4ac749267 Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Sun, 2 Jan 2022 23:18:38 -0800 Subject: [PATCH] change name of default theme to aniwrapper.rasi update setup script to backup and update theme when updated on main repo --- setup.sh | 40 +++++++++++++++------------- themes/{meh.rasi => aniwrapper.rasi} | 4 +-- 2 files changed, 24 insertions(+), 20 deletions(-) rename themes/{meh.rasi => aniwrapper.rasi} (99%) diff --git a/setup.sh b/setup.sh index 52f65d7..fb81f96 100755 --- a/setup.sh +++ b/setup.sh @@ -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 diff --git a/themes/meh.rasi b/themes/aniwrapper.rasi similarity index 99% rename from themes/meh.rasi rename to themes/aniwrapper.rasi index 0e29a3b..c0bef30 100644 --- a/themes/meh.rasi +++ b/themes/aniwrapper.rasi @@ -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;