diff --git a/home/.config/compton.conf b/home/.config/compton.conf index 97f4a514..600d3e4c 100644 --- a/home/.config/compton.conf +++ b/home/.config/compton.conf @@ -2,12 +2,10 @@ shadow = true; no-dnd-shadow = true; no-dock-shadow = true; -clear-shadow = true; shadow-radius = 7; shadow-offset-x = -7; shadow-offset-y = -7; shadow-opacity = 0.60; -shadow-ignore-shaped = true; # Opacity menu-opacity = 1.0; @@ -17,7 +15,7 @@ inactive-opacity-override = false; # Fade fading = true; -fade-delta = 7.0; +fade-delta = 8.0; fade-in-step = 0.03; fade-out-step = 0.028; alpha-step = 0.06; diff --git a/home/bin/baph b/home/bin/baph index 48b4b0ee..cdecb9f1 100755 --- a/home/bin/baph +++ b/home/bin/baph @@ -38,19 +38,19 @@ EOF #-- Utility functions --# -msg() { printf "$1\e[0m \e[1m$2\e[0m\n"; } +msg() { printf "$1\\e[0m \e[1m$2\e[0m\n"; } die() { printf "\e[1m\e[31merror:\e[0m $1\n"; exit ${2:-1}; } comp() { # compare AUR package versions, returns 0 or 1.. usage: comp "package" "current version" NEW="$(curl --silent "$PKG_ADDR/$1" | awk '/Details:/ {sub(/<\/h.?>/, ""); print $4}')" + [[ $i =~ -git$ ]] && NEW="$(grep -ow '[0-9]*\.[0-9]*\.[0-9]*' <<< "$NEW")" [[ -n $NEW && "$2" == "$NEW" ]] && return 0 || return 1 } yesno() { # only shown when not using --noconfirm, returns 0 or 1.. usage: yesno "question" - if [[ $NOCONF ]]; then - printf "\n\e[34m::\e[0m \e[1m$1? [Y/n]\e[0m "; read -r conf - [[ $conf =~ [nN] ]] && return 1 # return non zero when confirm n/N - fi + [[ $NOCONF ]] && return 0 + printf "\n\e[34m::\e[0m \e[1m$1? [Y/n]\e[0m "; read -r conf + [[ $conf =~ [nN] ]] && return 1 # return non zero when confirm n/N return 0 } @@ -64,23 +64,22 @@ prepupdate() { # prep for package update.. usage: prepupdate } update() { # check update for each package in AUR_PKGS=().. usage: update - local cur + local ver local up=() msg '\e[34m::' "Synchronizing AUR package versions..." for i in "${AUR_PKGS[@]}"; do ver="$(pacman -Qs "^$i$" 2>/dev/null | awk 'NR==1 {print $2}')" + [[ $i =~ -git$ ]] && ver="$(grep -ow '[0-9]*\.[0-9]*\.[0-9]*' <<< "$ver")" if [[ $ver ]]; then - comp "$i" "$ver" && printf "$i-$ver --> up to date\n" || up+=("$i") - else - msg '\e[33m::' "$i is not installed.. skipping" + printf "\e7 $i-$ver \e[1m\e[33m?\e[0m\e8" + comp "$i" "$ver" && printf " $i-$ver \e[1m\e[32m✓\e[0m\n" || + { up+=("$i"); printf " $i-$ver \e[1m\e[33m*\e[0m\n"; } fi done msg '\e[34m::' "Starting AUR package upgrade..." if (( ${#up[@]} > 0 )); then printf "\n\e[1mPackages (${#up[@]})\e[0m %s\n\n" "${up[@]}" - for i in "${up[@]}"; do - getpkg "$i" - done + for i in "${up[@]}"; do getpkg "$i" 0; done else printf " there is nothing to do\n" fi @@ -103,15 +102,14 @@ getpkg() { # install an AUR package.. usage: getpkg "package" local bd="$BUILD_DIR/$1" local pkgbuild="$bd/PKGBUILD" - comp "$1" && msg '\e[1m'$'\e[33mwarning:' "$1-$OLD is up to date -- reinstalling" + (( $# > 1 )) && comp "$1" && msg '\e[1m'$'\e[33mwarning:' "$1-$OLD is up to date -- reinstalling" (( CACHE == 1 )) || rm -rf "$bd" >/dev/null 2>&1 [[ -d $bd ]] || mkdir -p "$bd" if [[ ! -e $pkgbuild || $CACHE -eq 0 ]]; then git clone "$AUR_ADDR/$1" "$bd" || die "failed to clone $AUR_ADDR/$1" elif [[ -e $pkgbuild ]]; then - cd "$bd" - git pull || die "failed to pull from $AUR_ADDR/$1" + cd "$bd" && git pull || die "failed to pull from $AUR_ADDR/$1" fi [[ -e $pkgbuild ]] && cd "$bd" || die "$bd doesn't contain a PKGBUILD" @@ -121,19 +119,20 @@ getpkg() { # install an AUR package.. usage: getpkg "package" } view() { # view PKGBUILD.. usage: view "package" "/path/to/PKGBUILD" - if ! [[ $NOVIEW ]]; then - yesno "View the PKGBUILD for $1" || return 1 - if hash nvim >/dev/null 2>&1; then - nvim -n -R -u "$(find /usr/share/nvim/ -wholename '*/macros/less.vim')" "$2" - elif hash vim >/dev/null 2>&1; then - vim -n -R -u "$(find /usr/share/vim/ -wholename '*/macros/less.vim')" "$2" - else - less -P " -- Viewing PKGBUILD for $1 -- (press q to exit)" "$2" - fi + [[ $NOVIEW ]] && return 0 + yesno "View the PKGBUILD for $1" || return 0 + if hash nvimpager >/dev/null 2>&1; then + nvimpager "$2" + elif [[ $PAGER ]]; then + $PAGER "$2" + else + less -P " -- Viewing PKGBUILD for $1 -- (press q to exit)" "$2" fi } buildpkg() { # build package.. usage: buildpkg "package" "/path/to/PKGBUILD" + local depends=() + local validpgpkeys=() eval "$(cat "$BUILD_DIR/$1/PKGBUILD")" (( ${#validpgpkeys[@]} > 0 )) && importkeys ${validpgpkeys[*]} (( ${#depends[@]} > 0 )) && builddeps "$1" ${depends[*]} @@ -158,7 +157,7 @@ builddeps() { # build package depends.. usage: builddeps "package" ${DEPENDS[@]} msg '\e[33m::' "resolving AUR dependency -> $depend" getpkg "$depend" || die "failed to build dependency $depend" done - cd "$BUILD_DIR/$pdir" + cd "$BUILD_DIR/$pdir" || die "failed to cd $BUILD_DIR/$pdir" } #-- Argument parsing & execution --#