dots

git clone git://mattcarlson.org/repos/dots.git
Log | Files | Refs

commit 566dafb68463e09b8e9c22e7164e5a2ab8127dbb
parent 780b32eb39ade2d147e4085ed8aab4f75817ab96
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Mon, 23 Aug 2021 21:11:31 -0400

fixed laptop-specific scripts; qemu alias

Diffstat:
M.config/sh/aliasrc | 17+++++++++++++++--
M.config/x/xprofile | 5++---
M.local/bin/bar/light.sh | 8+++++---
M.local/bin/bar/mail.sh | 8+++++++-
M.local/bin/bar/music.sh | 7+++++++
M.local/bin/bar/net.sh | 6+++++-
M.local/bin/bar/pkgs.sh | 3+++
M.local/bin/bar/vol.sh | 2+-
M.local/share/wp | 4++--
9 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/.config/sh/aliasrc b/.config/sh/aliasrc @@ -30,7 +30,20 @@ if uname -s | grep -i 'linux' >/dev/null 2>&1; then mv='mv -v' \ o='open.sh' \ rmdir='rmdir -pv --ignore-fail-on-non-empty' \ - vi='vim' + vi='vim' \ + vm='qemu-system-x86_64 \ + -cpu host \ + -enable-kvm \ + -k de \ + -m 4096 \ + -machine type=pc,accel=kvm \ + -net nic \ + -net user,hostfwd=tcp::10022-:22 \ + -smp $(nproc) \ + -soundhw all \ + -usb \ + -vga std' + fi # directories @@ -69,7 +82,7 @@ alias \ alias dots='/usr/bin/git --git-dir=${HOME}/.dots/ --work-tree=${HOME}' # sync mail on mail exit when entered thru cmd line -alias ${MAIL_CLIENT}='cd "${DOWNLOADS_DIR}"; ${TERMINAL} -c "${MAIL_CLIENT}" -e "${MAIL_CLIENT}"; mail.sh -g &' +alias ${MAIL_CLIENT}='"${HOME}/.local/bin/bar/mail.sh" -o' # youtube alias \ diff --git a/.config/x/xprofile b/.config/x/xprofile @@ -3,10 +3,9 @@ # xprofile xrdb "${XDG_CONFIG_HOME:-${HOME}/.config/}/x/xresources" -lock.sh & +"${HOME}/.local/bin/lock.sh" & feh --no-fehbg --bg-scale "${XDG_DATA_HOME:-${HOME}/.local/share/}/wp" -xclickroot -r menu.sh & -# "${BAR}" & +xclickroot -r "${HOME}/.local/bin/menu.sh" & xcompmgr & mpd & unclutter & diff --git a/.local/bin/bar/light.sh b/.local/bin/bar/light.sh @@ -4,7 +4,7 @@ ICON='' # intel_backlight for thinkpad at least -LIGHT='/sys/class/backlight/intel_backlight/' +LIGHT='/sys/class/backlight/intel_backlight' # 852 on thinkpad not sure if universal MAX_BRIGHTNESS="$([ -f "${LIGHT}/max_brightness" ] && cat "${LIGHT}/max_brightness")" @@ -40,9 +40,11 @@ set_brightness() { [ ${brightness} -gt ${MAX_BRIGHTNESS} ] && brightness=${MAX_BRIGHTNESS} # send brightness to file for future reading - printf '%s\n' ${brightness} > "${LIGHT}/brightness" + printf '%s\n' ${brightness} | doas tee "${LIGHT}/brightness" 1>/dev/null - env HERBE_ID=/0 herbe "Brightness: ${brightness}%" + get_brightness + + env HERBE_ID=/0 herbe "Brightness: ${brightness}%" & } bar() { diff --git a/.local/bin/bar/mail.sh b/.local/bin/bar/mail.sh @@ -20,7 +20,13 @@ get_mail() { rm -f "${TMP}" } -open() { cd "${DOWNLOADS_DIR}"; "${TERMINAL}" -c "${MAIL_CLIENT}" -e "${MAIL_CLIENT}" && { get_mail & } ; } +open() { + wd="$(pwd)" + cd "${DOWNLOADS_DIR}"; + "${TERMINAL}" -c "${MAIL_CLIENT}" -e "${MAIL_CLIENT}" + cd "${wd}" + get_mail & +} bar() { # count personal and school mail then sum together diff --git a/.local/bin/bar/music.sh b/.local/bin/bar/music.sh @@ -11,6 +11,7 @@ open() { "${TERMINAL}" -c "${MUSIC_PLAYER}" -e "${MUSIC_PLAYER}" ; } get_song_and_state() { # get current song name song="$(mpc -f %title% | head -n 1)" + # get state of song state="$(mpc -f %title% | sed '2q;d' | awk '{ print $1 }' | tr -d '[:punct:]')" } @@ -33,6 +34,12 @@ toggle() { bar() { get_song_and_state + # print ellipses if song name cuts off in bar + if [ "${#song}" -ge 20 ]; then + song="$(printf '%.17s' "${song}")" + song="${song}..." + fi + # no songs [ -z "${state}" ] && printf '%s\n' "${MUSIC_ICON}" # song is playing diff --git a/.local/bin/bar/net.sh b/.local/bin/bar/net.sh @@ -79,7 +79,11 @@ bar() { [ -z "${wifi}" ] && [ -z "${eth}" ] && printf '%s\n' "${ERROR_ICON}" && return 1 # space needed between wifi and eth if eth is available - if [ -z "${eth}" ]; then printf '%s\n' "${wifi}${eth}" + # no eth but wifi + if [ -z "${eth}" ]; then printf '%s\n' "${wifi}" + # no wifi but eth + elif [ -z "${wifi}" ]; then printf '%s\n' "${eth}" + # both wifi and eth else printf '%s\n' "${wifi} ${eth}" fi } diff --git a/.local/bin/bar/pkgs.sh b/.local/bin/bar/pkgs.sh @@ -77,6 +77,9 @@ upgrade_pkgs() { case "${os}" in 'arch') upgrade_arch_pkgs ;; esac rm -f "${UPGRADE_TMP}" + + # update counter immediately after upgrade + get_pkgs & } get_pkgs() { diff --git a/.local/bin/bar/vol.sh b/.local/bin/bar/vol.sh @@ -15,7 +15,7 @@ get_scontrol() { fi } -get_vol() { vol=$(amixer get "${scontrol}" -M | grep '\[[0-9][0-9]*\%\]' | awk '{ print $5 }' | head -n 1 | tr -d '[:punct:]') ; } +get_vol() { vol=$(amixer get "${scontrol}" -M | awk '{ for (i = 1; i<=NF; i++) { if ( $i ~ /\[[0-9][0-9]*%\]/ ) { print $i } } }' | head -n 1 | tr -d '[:punct:]') ; } toggle() { [ "${scontrol}" = 'Master' ] && amixer set "${scontrol}" toggle diff --git a/.local/share/wp b/.local/share/wp @@ -1 +1 @@ -/home/mc/pix/wp/paladin-charge.jpg -\ No newline at end of file +/home/mc/pix/wp/roger-dean/paladin-charge.jpg +\ No newline at end of file