commit 077ae01d3415326adb12953dd5c5abc8bff3f043
parent 5a9b51f76e210215851a91c7c99632a5ff6f68f0
Author: Matthew Carlson <matt@mcarlson.xyz>
Date: Fri, 6 Aug 2021 20:27:29 -0400
shellcheck and other small fixes
Diffstat:
8 files changed, 51 insertions(+), 54 deletions(-)
diff --git a/.config/mpd/mpd.conf b/.config/mpd/mpd.conf
@@ -1,6 +1,6 @@
# general
auto_update "yes"
-bind_to_address "localhost"
+bind_to_address "0.0.0.0"
db_file "~/.local/share/mpd/database"
follow_inside_symlinks "yes"
follow_outside_symlinks "yes"
diff --git a/.config/sh/aliasrc b/.config/sh/aliasrc
@@ -2,33 +2,36 @@
#
# aliasrc
-# unix commands
+# posix
alias \
- bc='bc -lq' \
- cp='cp -iv' \
- df='df -hT' \
- diff='diff --color=auto' \
- du='du -h' \
- echo='echo -en' \
- egrep='egrep --color=auto' \
- fgrep='fgrep --color=auto' \
- grep='grep --color=auto' \
- ls='ls -ahls --color=auto --group-directories-first' \
- mkdir='mkdir -p' \
- more='less' \
- mv='mv -iv' \
- rmdir='rmdir -pv' \
- vi='vim'
+ bc='bc -l' \
+ cp='cp -R' \
+ ls='ls -ls' \
+ mkdir='mkdir -p' \
+ more='less' \
+ rm='rm -iR' \
+ rmdir='rmdir -p'
# gnu/linux
-alias \
- def='sdcv -u '\''en-wiktionary'\''' \
- free='free -m' \
- ft='grep -nwIR' \
- o='open.sh'
-
-# startx
-[ -f "${XINITRC}" ] && alias startx='startx ${XINITRC}'
+if uname -s | grep -i 'linux' >/dev/null 2>&1; then
+ alias \
+ bc='bc -lq' \
+ cp='cp -vR' \
+ def='sdcv -u '\''en-wiktionary'\''' \
+ df='df -hT' \
+ diff='diff --color=auto' \
+ du='du -h' \
+ echo='echo -en' \
+ egrep='egrep --color=auto' \
+ fgrep='fgrep --color=auto' \
+ ft='grep -nwIR' \
+ grep='grep --color=auto' \
+ ls='ls -ahls --color=auto --group-directories-first' \
+ mv='mv -v' \
+ o='open.sh' \
+ rmdir='rmdir -pv --ignore-fail-on-non-empty' \
+ vi='vim'
+fi
# directories
alias \
diff --git a/.config/sh/profile b/.config/sh/profile
@@ -3,7 +3,7 @@
# profile
# add local scripts to path
-PATH="${PATH}:$(du "${HOME}/.local/bin/" | cut -f2 | tr '\n' ':' | sed 's/:*$//')"
+PATH="${PATH}:$(du "${HOME}/.local/bin/" | cut -f 2 | tr '\n' ':' | sed 's/:*$//')"
export PATH
# programs
@@ -50,8 +50,6 @@ export VIDEOS_DIR="${HOME}/vids/"
export GNUPG="9CC4E75365C16465FFE752C94DDBF97211D4EA31"
# colorful man pages
-
-# colorful man pages
LESS_TERMCAP_mb="$(printf '%b' '\x1b[1;32m')"
export LESS_TERMCAP_mb
LESS_TERMCAP_md="$(printf '%b' '\x1b[1;32m')"
@@ -90,14 +88,6 @@ export FFF_LS_COLORS=1
export FFF_OPENER="${HOME}/.local/bin/open.sh"
export FFF_STAT_CMD="stat"
-# pash
-export PASH_KEYID="${GNUPG}"
-export PASH_LENGTH=32
-export PASH_PATTERN=_A-Z-a-z-0-9
-export PASH_DIR="${XDG_DATA_HOME:-${HOME}/.local/share}/pash/"
-export PASH_CLIP='xclip -sel c'
-export PASH_TIMEOUT=60
-
# pfetch
export HOSTNAME='pc'
export PF_INFO='ascii title os host kernel uptime pkgs memory shell editor wm palette'
@@ -121,7 +111,6 @@ export FZF_DEFAULT_OPTS='
--color spinner:2
--color header:2
'
-
# clean up
export LESSHISTFILE=-
export SDCV_HISTFILE='/dev/null'
diff --git a/.config/x/xprofile b/.config/x/xprofile
@@ -4,8 +4,8 @@
xrdb "${XDG_CONFIG_HOME:-${HOME}/.config}/x/xresources"
lock.sh &
-"${BAR}" &
feh --no-fehbg --bg-scale "${XDG_DATA_HOME:-${HOME}/.local/share}/wp"
+"${BAR}" &
xcompmgr &
mpd &
xset r rate 250 50
diff --git a/.config/x/xresources b/.config/x/xresources
@@ -17,12 +17,12 @@
#define col15 #c5d1dc
! font
-Xft.antialias: 1
-Xft.hinting: 1
-Xft.autohint: 0
-Xft.rgba: rgb
-Xft.hintstyle: hintmedium
-Xft.lcdfilter: lcddefault
+Xft.antialias : 1
+Xft.hinting : 1
+Xft.autohint : 0
+Xft.rgba : rgb
+Xft.hintstyle : hintmedium
+Xft.lcdfilter : lcddefault
! dwm
dwm.font : monospace:size=16
diff --git a/.local/bin/bar/monitor.sh b/.local/bin/bar/monitor.sh
@@ -11,7 +11,7 @@ BRIGHTNESS="${XDG_CACHE_HOME:-${HOME}/.cache}/bar/brightness"
get_brightness() {
[ ! -f "${BRIGHTNESS}" ] && return
# brightness cache should contain only number
- ! brightness=$(cat ${BRIGHTNESS} | grep '^[0-9][0-9]*$') && return
+ ! brightness=$(grep '^[0-9][0-9]*$' "${BRIGHTNESS}") && return
}
@@ -19,13 +19,18 @@ set_brightness() {
get_brightness
# keep between 0-100
- [ "${1}" = '+' ] && [ ${brightness} -ge 100 ] && return
- [ "${1}" = '-' ] && [ ${brightness} -le 0 ] && return
-
- brightness=$((${brightness} ${1} ${2}))
+ if [ "${1}" = '+' ]; then
+ if [ "${brightness}" -lt 100 ]; then brightness=$((brightness + ${2}))
+ else return
+ fi
+ elif [ "${1}" = '-' ]; then
+ if [ "${brightness}" -gt 0 ]; then brightness=$((brightness - ${2}))
+ else return
+ fi
+ fi
# set brightness using ddcutil
- doas ddcutil setvcp ${VCP_CODE} ${brightness} >/dev/null 2>&1
+ doas ddcutil setvcp ${VCP_CODE} "${brightness}" >/dev/null 2>&1
# get actual brightness and send output to cache
printf '%s\n' "$(doas ddcutil getvcp ${VCP_CODE} | awk '{ print $9 }' | tr -d '[:punct:]')" 2>/dev/null > "${BRIGHTNESS}"
diff --git a/.local/bin/bar/net.sh b/.local/bin/bar/net.sh
@@ -16,7 +16,7 @@ net_menu() {
iwctl station "${interface}" scan
# get available networks and known networks
- get_network_info "iwctl station "${interface}" get-networks" 'iwctl known-networks list'
+ get_network_info "iwctl station ${interface} get-networks" 'iwctl known-networks list'
# user can connect, disconnect, or forget network
# don't care bout access points or other stuff
@@ -31,7 +31,7 @@ net_menu() {
case "${network}" in '> '*) printf 'Already connected to this network\n' && return ;; esac
# if network is known connect with no passphrase
- if [ $(printf '%s\n' "${known_network_info}" | awk -F '|' '{print $1}' | grep "\<${network}\>") ]; then
+ if printf '%s\n' "${known_network_info}" | awk -F '|' '{print $1}' | grep -q "\<${network}\>"; then
iwctl station "${interface}" connect "${network}"
return
fi
@@ -79,7 +79,7 @@ net_menu() {
}
get_network_info() {
- if [ "${1}" = "iwctl station "${interface}" get-networks" ]; then
+ if [ "${1}" = "iwctl station ${interface} get-networks" ]; then
info="$(eval "${1}" | grep '\s' | tail +3 | awk '{ $1 = $1 }; 1' | sed -e 's/\x1b\[[0-9;]*m//g')"
available_network_names="$(get_network_column '1')"
diff --git a/.local/bin/lock.sh b/.local/bin/lock.sh
@@ -4,7 +4,7 @@
SOCKETS_DIR="/tmp/mpv-sockets/"
-mpc pause &>/dev/null;
+mpc pause >/dev/null 2>&1;
for socket in "${SOCKETS_DIR}"/*; do
[ -e "${socket}" ] || break