commit 885f67917248768323d43f78f0a0b12da9af5633
parent 8aa79f5129e12d0fc5f99317bf60f2ab309985cf
Author: Matthew Carlson <matt@mcarlson.xyz>
Date: Wed, 18 Aug 2021 23:14:13 -0400
clean up
Diffstat:
4 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/.config/sh/profile b/.config/sh/profile
@@ -15,9 +15,8 @@ export BROWSER='brave'
export TERMINAL='st'
export FILE_VIEWER='fff'
export EDITOR='vim'
-export MUSIC_PLAYER='ncmpcpp'
export MAIL_CLIENT='neomutt'
-export MEDIA_PLAYER='mpv'
+export MUSIC_PLAYER='ncmpcpp'
export READER='zathura'
export IMG_VIEWER='feh'
@@ -38,16 +37,8 @@ export YTFZF_CONFIG_FILE="${YTFZF_CONFIG_DIR}/ytfzf.sh"
export STARDICT_DATA_DIR="${XDG_DATA_HOME:-${HOME}/.local/share/}"
# folders
-export DEV_DIR="${HOME}/dev/"
-export DOWNLOADS_DIR="${HOME}/dl/"
-export DOCUMENTS_DIR="${HOME}/dox/"
export MAIL_DIR="${HOME}/mail/"
-export MUSIC_DIR="${HOME}/music/"
export PICTURES_DIR="${HOME}/pix/"
-export VIDEOS_DIR="${HOME}/vids/"
-
-# gpg
-export GNUPG="9CC4E75365C16465FFE752C94DDBF97211D4EA31"
# colorful man pages
LESS_TERMCAP_mb="$(printf '%b' '\x1b[1;32m')"
diff --git a/.config/x/xprofile b/.config/x/xprofile
@@ -5,7 +5,7 @@
xrdb "${XDG_CONFIG_HOME:-${HOME}/.config/}/x/xresources"
lock.sh &
feh --no-fehbg --bg-scale "${XDG_DATA_HOME:-${HOME}/.local/share/}/wp"
-"${BAR}" &
+# "${BAR}" &
xcompmgr &
mpd &
unclutter &
diff --git a/.local/bin/bar/pkgs.sh b/.local/bin/bar/pkgs.sh
@@ -4,9 +4,11 @@
ICON=''
UPGRADE_ICON=''
-TMP='/tmp/upgrade-pkgs'
+UPGRADE_TMP='/tmp/upgrade-pkgs'
AUR_HELPER='paru'
PKGS="${XDG_CACHE_HOME:-${HOME}/.cache}/bar/pkgs"
+GET_TMP='/tmp/get-pkgs'
+GET_ICON=''
get_os() {
command -v pacman >/dev/null && os='arch'
@@ -16,7 +18,8 @@ get_os() {
}
upgrade_pkgs() {
- trap "rm -f ${TMP}; exit 1" INT TERM
+ trap 'rm -f ${UPGRADE_TMP}; exit 1' INT TERM
+ trap exit 1
upgrade_arch_pkgs() {
upgrade_repo_pkgs() {
@@ -25,29 +28,30 @@ upgrade_pkgs() {
case "${1}" in
'pacman') repo_type='Official'
- available_upgrades=$(($(printf '%s\n' "${PACKAGES}" | wc -l)-1))
+ available_upgrades=$(printf '%s' "${pacman_pkgs}" | grep -c '^')
cmd='pacman'
;;
'aur') repo_type='AUR'
- available_upgrades=$(($(printf '%s\n' "${aur_pkgs}" | wc -l)-1))
+ available_upgrades=$(printf '%s' "${aur_pkgs}" | grep -c '^')
cmd="${AUR_HELPER} -a"
;;
*) return 1 ;;
esac
if [ "${available_upgrades}" -eq 0 ]; then
- [ "${repo_type}" = 'Official' ] && repo_type="$(printf '%s\n' "${repo_type}" | tr '[:upper:]' '[:lower:]')"
- printf '%s\n' "No ${repo_type} packages are available for upgrade at the moment. Press any key to continue."
+ [ "${repo_type}" = 'Official' ] && repo_type="$(printf '%s\n' "${repo_type}" | tr '[:upper:]' '[:lower:]')"
+ printf '%s\n' "No ${repo_type} packages available for upgrade at the moment. Press any key to continue."
read -r input
- break
+ return
else
- if ! doas "${cmd}" -Syu; then
+ if ! doas ${cmd} -Syu; then
printf '%s\n' "${repo_type} packages failed to upgrade. Retry? [Y/n] "
read -r input
input="$(printf '%s\n' "${input}" | tr '[:upper:]' '[:lower:]')"
if [ "${input}" = 'y' ]; then continue
else return 1
fi
+ else return
fi
fi
done
@@ -57,38 +61,44 @@ upgrade_pkgs() {
upgrade_repo_pkgs 'aur'
}
- touch "${TMP}"
+ touch "${UPGRADE_TMP}"
get_os
case "${os}" in 'arch') upgrade_arch_pkgs ;; esac
- rm -f "${TMP}"
+ rm -f "${UPGRADE_TMP}"
}
get_pkgs() {
+ touch "${GET_TMP}"
+
get_os
case "${os}" in
- 'arch') pacman_pkgs="$(printf '%s\n' "$(pacman -Qu 2>/dev/null)")"
+ 'arch') pacman_pkgs="$(pacman -Qu 2>/dev/null)"
if command -v "${AUR_HELPER}" >/dev/null; then
- aur_pkgs="$(printf '%s\n' "$("${AUR_HELPER}" -Qum --devel 2>/dev/null)")"
+ aur_pkgs="$("${AUR_HELPER}" -Qum --devel 2>/dev/null)"
fi
- pkgs="$(printf '%s\n%s\n' "${pacman_pkgs}" "${aur_pkgs}")"
+ pkgs="$(printf '%s\n%s' "${pacman_pkgs}" "${aur_pkgs}")"
;;
esac
if [ -f "${PKGS}" ]; then
- printf '%s\n' "${pkgs}" > "${PKGS}"
+ printf '%s' "${pkgs}" > "${PKGS}"
else touch "${PKGS}"
fi
+
+ rm -f "${GET_TMP}"
}
bar() {
- [ -f "${PKGS}" ] && pkgs=$(($(cat "${PKGS}" | wc -l)-1))
+ [ -f "${PKGS}" ] && pkgs=$(grep -c '^' < "${PKGS}")
- [ -f '/tmp/upgrade-pkgs' ] && printf '%s\n' "${UPGRADE_ICON}" \
- || printf '%s\n' "${ICON} ${pkgs}"
+ if [ -f "${UPGRADE_TMP}" ]; then printf '%s\n' "${UPGRADE_ICON}"
+ elif [ -f "${GET_TMP}" ]; then printf '%s\n' "${GET_ICON}"
+ else printf '%s\n' "${ICON} ${pkgs}"
+ fi
}
main() {
diff --git a/.local/bin/open.sh b/.local/bin/open.sh
@@ -15,7 +15,7 @@ main() {
| *.ogg \
| *.opus \
| *.wav)
- "${MEDIA_PLAYER}" --no-video "${opt}"
+ mpv --no-video "${opt}"
;;
# document
@@ -27,7 +27,7 @@ main() {
# gif
*.gif)
- "${MEDIA_PLAYER}" --loop "${opt}"
+ mpv --loop "${opt}"
;;
# image
@@ -58,7 +58,7 @@ main() {
| *.mkv \
| *.mp4 \
| *.webm)
- "${MEDIA_PLAYER}" "${opt}"
+ mpv "${opt}"
;;
# web/vector