modify setup to locally set $XDG_CONFIG_HOME env var if it is not set

This commit is contained in:
ksyasuda 2021-11-02 10:09:02 -07:00
parent 2c0921842e
commit 404beb96c0
3 changed files with 73 additions and 76 deletions

View File

@ -9,11 +9,10 @@ logfile="${XDG_CACHE_HOME:-$HOME/.cache}/ani-hsts"
# Set config directory # Set config directory
if [[ -z "$XDG_CONFIG_HOME" ]]; then if [[ -z "$XDG_CONFIG_HOME" ]]; then
config_dir="$HOME/.config/ani-cli" XDG_CONFIG_HOME="$HOME/.config"
else
config_dir="$XDG_CONFIG_HOME/ani-cli"
fi fi
config_dir="$XDG_CONFIG_HOME/ani-cli"
history_db="$XDG_CONFIG_HOME/ani-cli/history.sqlite3" history_db="$XDG_CONFIG_HOME/ani-cli/history.sqlite3"
# sql=$(sqlite3 -noheader "$history_db") # sql=$(sqlite3 -noheader "$history_db")

View File

@ -1,15 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
[ -z "$XDG_CONFIG_HOME" ] && XDG_CONFIG_HOME="$HOME/.config"
CMD=/usr/local/bin/ani-cli CMD=/usr/local/bin/ani-cli
DEFAULT="$HOME/Videos/sauce/" DEFAULT="$HOME/Videos/sauce/"
CFG_DIR="$XDG_CONFIG_HOME/ani-cli" CFG_DIR="$XDG_CONFIG_HOME/ani-cli"
echo "CONFIG DIR: $CFG_DIR"
# not a wrapper around the ani-cli-rofi # not a wrapper around the ani-cli-rofi
options="1. Stream|2. Download|3. Continue|4. Quit" options="1. Stream|2. Download|3. Continue|4. Quit"
choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' \ choice=$(echo "${options[@]}" | rofi -dmenu -sep '|' -config "$CFG_DIR/meh.rasi" -l 4 -i -p "Enter choice:")
-config "$CFG_DIR/meh.rasi" -l 4 -i -p "Enter choice:")
[ "$choice" == "4. Quit" ] && ( [ "$choice" == "4. Quit" ] && (
echo 'Quitting...' echo 'Quitting...'

View File

@ -8,22 +8,17 @@ log() {
printf "%s\n" "$1" printf "%s\n" "$1"
} }
# DIR="$HOME/.ani-cli/"
DB="history.sqlite3" DB="history.sqlite3"
# Set the XDG_CONFIG_HOME locally if not set
if [[ -z "$XDG_CONFIG_HOME" ]]; then if [[ -z "$XDG_CONFIG_HOME" ]]; then
DIR="$HOME/.config/ani-cli" XDG_CONFIG_HOME="$HOME/.config"
MPV_DIR="$HOME/.config/mpv"
else
DIR="$XDG_CONFIG_HOME/ani-cli"
MPV_DIR="$XDG_CONFIG_HOME/mpv"
fi fi
printf "%s\n" "INSTALL DIR: $DIR" DIR="$XDG_CONFIG_HOME/ani-cli"
MPV_DIR="$XDG_CONFIG_HOME/mpv"
# log "Deleting old directory..." printf "%s\n" "INSTALL DIR: $DIR"
# rm -rf "$DIR"
# log "Directory deleted..."
if [[ ! -d "$DIR" ]]; then if [[ ! -d "$DIR" ]]; then
log "Creating directory $DIR" log "Creating directory $DIR"