dots

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

commit d417bc7dc2a0fe4d3a476924c50ce6c99567955f
parent a159a163acb77d6573963031994cec2b53c1fb29
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Wed, 28 Jul 2021 18:52:18 -0400

readability and made some scripts POSIX-compliant

Diffstat:
M.config/fontconfig/fonts.conf | 6+++---
M.config/mutt/muttrc | 6+++---
M.config/sh/functionrc | 2+-
M.config/sh/profile | 8++++----
M.config/x/xprofile | 1+
M.config/x/xresources | 48++++++++++++++++++++++++++++--------------------
M.config/zathura/zathurarc | 54+++++++++++++++++++++++++++---------------------------
M.local/bin/lock.sh | 8+++++---
M.local/bin/wp.sh | 45+++++++++++++++++++++++----------------------
M.local/share/wp | 4++--
10 files changed, 97 insertions(+), 85 deletions(-)

diff --git a/.config/fontconfig/fonts.conf b/.config/fontconfig/fonts.conf @@ -1,14 +1,14 @@ <fontconfig> <alias> <family>serif</family> - <prefer><family>FreeSerif</family></prefer> + <prefer><family>Source Serif Pro</family></prefer> </alias> <alias> <family>sans-serif</family> - <prefer><family>FreeSans</family></prefer> + <prefer><family>Fira Sans</family></prefer> </alias> <alias> <family>monospace</family> - <prefer><family>FreeMono</family></prefer> + <prefer><family>Fira Code</family></prefer> </alias> </fontconfig> diff --git a/.config/mutt/muttrc b/.config/mutt/muttrc @@ -43,7 +43,7 @@ color hdrdefault bold color2 default color index_date color2 default color index_number color2 default color index_size color2 default -color indicator bold default color2 +color indicator bold color0 color2 color markers color2 default color normal color7 default color quoted color2 default @@ -51,9 +51,9 @@ color quoted1 color3 default color quoted2 color4 default color quoted3 color5 default color quoted4 color6 default -color sidebar_divider color0 default +color sidebar_divider color7 default color sidebar_highlight bold color3 default -color status bold default color2 +color status bold color0 color2 color tilde color0 default # sidebar diff --git a/.config/sh/functionrc b/.config/sh/functionrc @@ -4,5 +4,5 @@ f() { fff "${@}" && cd "$(cat "${XDG_CACHE_HOME:-${HOME}/.cache}/fff/.fff_d")" || exit ; } s() { du -a "${HOME}" | awk '{ $1="" } { gsub("^ ", "", $0); print "\"" $0 "\"" }' | fzf | xargs -or xdg-open ; } -rands() { </dev/urandom tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c "${1}" ; echo ; } +rands() { </dev/urandom tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c "${1}" ; printf '%s\n'; } rp() { for f in *; do mv "${f}" "$(printf '%s\n' "${f}" | sed "s/${1}/${2}/g")"; done ; } diff --git a/.config/sh/profile b/.config/sh/profile @@ -11,7 +11,7 @@ export WM='dwm' export BAR='dwmblocks' export MENU='dmenu_run -c -l 10' export LOCKER='slock' -export BROWSER='firefox' +export BROWSER='brave' export TERMINAL='st' export FILE_VIEWER='fff' export EDITOR='vim' @@ -53,7 +53,7 @@ LESS_TERMCAP_md=$(tput bold; tput setaf 2) export LESS_TERMCAP_md LESS_TERMCAP_me=$(tput sgr0) export LESS_TERMCAP_me -LESS_TERMCAP_so=$(tput bold; tput setaf 7; tput setab 2) +LESS_TERMCAP_so=$(tput bold; tput setaf 0; tput setab 2) export LESS_TERMCAP_so LESS_TERMCAP_se=$(tput rmso; tput sgr0) export LESS_TERMCAP_se @@ -79,7 +79,7 @@ export FFF_COL1=2 export FFF_COL2=2 export FFF_COL3=1 export FFF_COL4=2 -export FFF_COL5=7 +export FFF_COL5=0 export FFF_HIDDEN=1 export FFF_LS_COLORS=1 export FFF_OPENER="xdg-open" @@ -104,7 +104,7 @@ export FZF_DEFAULT_OPTS=' --color preview-fg:2 --color preview-bg:2 --color hl:2 - --color fg+:7 + --color fg+:0 --color bg+:2 --color gutter:2 --color hl+:7 diff --git a/.config/x/xprofile b/.config/x/xprofile @@ -6,4 +6,5 @@ xrdb "${XDG_CONFIG_HOME:-${HOME}/.config}/x/xresources" lock.sh & "${BAR}" & feh --no-fehbg --bg-scale "${XDG_DATA_HOME:-${HOME}/.local/share}/wp" +xcompmgr & xset r rate 250 50 diff --git a/.config/x/xresources b/.config/x/xresources @@ -1,20 +1,28 @@ ! colors -#define col0 #160f0c -#define col1 #3844a1 -#define col2 #6b5f92 -#define col3 #506e83 -#define col4 #867497 -#define col5 #8b7dc3 -#define col6 #6e878d -#define col7 #c6c0cb -#define col8 #8a868e -#define col9 #3844a1 -#define col10 #6b5f92 -#define col11 #506e83 -#define col12 #867497 -#define col13 #8b7dc3 -#define col14 #6e878d -#define col15 #c6c0cb +#define col0 #121613 +#define col1 #c3619a +#define col2 #6f92af +#define col3 #76b3c9 +#define col4 #7bc2d4 +#define col5 #9b91ae +#define col6 #b08fab +#define col7 #c5d1dc +#define col8 #89929a +#define col9 #c3619a +#define col10 #6f92af +#define col11 #76b3c9 +#define col12 #7bc2d4 +#define col13 #9b91ae +#define col14 #b08fab +#define col15 #c5d1dc + +! font +Xft.antialias: 1 +Xft.hinting: 1 +Xft.autohint: 0 +Xft.rgba: rgb +Xft.hintstyle: hintslight +Xft.lcdfilter: lcddefault ! dwm dwm.font : monospace:size=16 @@ -23,7 +31,7 @@ dwm.normbordercolor : col0 dwm.normfgcolor : col7 dwm.selbgcolor : col2 dwm.selbordercolor : col2 -dwm.selfgcolor : col7 +dwm.selfgcolor : col0 dwm.borderpx : 3 dwm.snap : 32 dwm.topbar : 0 @@ -48,7 +56,7 @@ dwm.ulineall : 0 dmenu.font : monospace:size=16 dmenu.normfgcolor : col7 dmenu.normbgcolor : col0 -dmenu.selfgcolor : col7 +dmenu.selfgcolor : col0 dmenu.selbgcolor : col2 dmenu.prompt : dmenu.min_width : 500 @@ -118,8 +126,8 @@ st.cursorthickness : 2 st.boxdraw : 1 st.boxdraw_bold : 1 st.boxdraw_braille : 1 -st.alpha : 0.8 -st.alphaUnfocused : 0.6 +st.alpha : 0.95 +st.alphaUnfocused : 0.90 st.defaultfg : 15 st.defaultbg : 258 st.defaultcs : 256 diff --git a/.config/zathura/zathurarc b/.config/zathura/zathurarc @@ -12,35 +12,35 @@ set recolor-keephue "false" set recolor-reverse-video "false" # Command line completion entries -set completion-fg "#c6c0cb" -set completion-bg "#160f0c" +set completion-fg "#c5d1dc" +set completion-bg "#121613" # Command line completion group elements -set completion-group-fg "#6B5F92" -set completion-group-bg "#160f0c" +set completion-group-fg "#6F92AF" +set completion-group-bg "#121613" # Current command line completion element -set completion-highlight-fg "#160f0c" -set completion-highlight-bg "#c6c0cb" +set completion-highlight-fg "#121613" +set completion-highlight-bg "#c5d1dc" # Default foreground/background color -set default-bg rgba(22,15,12,1) +set default-bg rgba(18,22,19,1) # Input bar -set inputbar-fg "#c6c0cb" -set inputbar-bg "#160f0c" +set inputbar-fg "#c5d1dc" +set inputbar-bg "#121613" # Notification -set notification-fg "#c6c0cb" -set notification-bg "#160f0c" +set notification-fg "#c5d1dc" +set notification-bg "#121613" # Error notification -set notification-error-fg "#c6c0cb" -set notification-error-bg "#3844A1" +set notification-error-fg "#c5d1dc" +set notification-error-bg "#C3619A" # Warning notification -set notification-warning-fg "#c6c0cb" -set notification-warning-bg "#3844A1" +set notification-warning-fg "#c5d1dc" +set notification-warning-bg "#C3619A" # Tab - TODO # set tabbar-fg @@ -51,25 +51,25 @@ set notification-warning-bg "#3844A1" # set tabbar-focus-bg # Status bar -set statusbar-fg "#c6c0cb" -set statusbar-bg "#160f0c" +set statusbar-fg "#c5d1dc" +set statusbar-bg "#121613" # Highlighting parts of the document (e.g. show search results) -set highlight-color "#6B5F92" -set highlight-active-color "#6B5F92" +set highlight-color "#6F92AF" +set highlight-active-color "#6F92AF" # Represent light/dark colors in recoloring mode set recolor-lightcolor rgba(0,0,0,0) -set recolor-darkcolor "#c6c0cb" +set recolor-darkcolor "#c5d1dc" # "Loading..." text -set render-loading-fg "#c6c0cb" -set render-loading-bg "#160f0c" +set render-loading-fg "#c5d1dc" +set render-loading-bg "#121613" # Index mode -set index-fg "#c6c0cb" -set index-bg "#160f0c" +set index-fg "#c5d1dc" +set index-bg "#121613" # Selected element in index mode -set index-active-fg "#160f0c" -set index-active-bg "#c6c0cb" -\ No newline at end of file +set index-active-fg "#121613" +set index-active-bg "#c5d1dc" +\ No newline at end of file diff --git a/.local/bin/lock.sh b/.local/bin/lock.sh @@ -6,10 +6,12 @@ SOCKETS_DIR="/tmp/mpv-sockets/" for socket in "${SOCKETS_DIR}"/*; do [ -e "${socket}" ] || break - echo 'set pause yes' | socat - "${socket}"; + printf 'set pause yes' | socat - "${socket}"; done -[ -n "$(pgrep "${BROWSER}")" ] && pkill -STOP "${BROWSER}" +bpid=$(ps -ef | grep "\<${BROWSER}\>" | awk '{ printf "%s ", $2 }') + +[ -n "${bpid}" ] && kill -STOP ${bpid} "${LOCKER}" @@ -19,4 +21,4 @@ jobs -p > "${temp}" wait < "${temp}" -pkill -CONT "${BROWSER}" +kill -CONT ${bpid} diff --git a/.local/bin/wp.sh b/.local/bin/wp.sh @@ -11,6 +11,7 @@ DEFAULTFG=259 # xresources handles suckless vars XRESOURCES="${XDG_CONFIG_HOME:-${HOME}/.config}/x/xresources" TMP='/tmp/xsettingsd' +FLATCOLOR="${XDG_DATA_HOME:-${HOME}/.local/share}/themes/FlatColor/gtk-3.20/gtk.css" # get random valid file in dir get_rand_file() { @@ -24,17 +25,19 @@ get_rand_file() { file='' while ! check_file "${file}"; do # get random file and remove it from list - file="$(printf '%s' "${files}" | shuf -n 1)" - files="$(printf '%s' "${files}" | grep -vw "${file}")" + file="$(printf '%s' "${files}" | awk 'BEGIN{ srand() } { printf "%f %s\n", rand(), $0 }' | sort | cut -d ' ' -f 2 | head -n 1)" + files="$(printf '%s' "${files}" | grep -v "${file}")" - # exit if no more files to check + # break if no more files to check [ -z "${files}" ] && break done # no files in dir are valid if ! check_file "${file}"; then file=''; fi - [ -z "${file}" ] && return 1 || break + if [ -z "${file}" ]; then return 1 + else return 0 + fi } check_file () { @@ -63,7 +66,7 @@ check_file () { | tif \ | tiff \ | webp \ - | xpm) break ;; + | xpm) return ;; *) return 1 ;; esac } @@ -80,14 +83,14 @@ wp () { } theme() { - # remove cached themes and gen new one - wal -c && wal -ni "${WP}" + # remove cached themes + wal -c - # gtk + # gen new theme with wpg (uses pywal) wpg -a "${file}" && wpg -ns "${file}" - # use main color for gtk - sed -i "s/\@define-color selected_bg_color.*/\@define-color selected_bg_color @color2;/g" "${XDG_DATA_HOME:-${HOME}/.local/share}/themes/FlatColor/gtk-3.20/gtk.css" + # fix colors for gtk + printf '%s\n' "$(sed 's/\@define-color selected_bg_color.*/\@define-color selected_bg_color @color2;/g' "${FLATCOLOR}")" > "${FLATCOLOR}" # xsettingsd to live reload gtk with correct color printf "Net/ThemeName \"FlatColor\"" > "${TMP}" @@ -95,14 +98,14 @@ theme() { [ -f "${COLORS}" ] && . "${COLORS}" - set -- ${color0} ${color1} ${color2} ${color3} ${color4} ${color5} ${color6} ${color7} \ - ${color8} ${color9} ${color10} ${color11} ${color12} ${color13} ${color14} ${color15} + set -- "${color0}" "${color1}" "${color2}" "${color3}" "${color4}" "${color5}" "${color6}" "${color7}" \ + "${color8}" "${color9}" "${color10}" "${color11}" "${color12}" "${color13}" "${color14}" "${color15}" # replace colors in xresources i=0 for color in "${@}"; do color="$(printf '%s' "${color}" | tr '[:upper:]' '[:lower:]')" - sed -i "s/#define col${i} .*/#define col${i} ${color}/" "${XRESOURCES}" + printf '%s\n' "$(sed "s/#define col${i} .*/#define col${i} ${color}/" "${XRESOURCES}")" > "${XRESOURCES}" i=$((i+1)) [ ${i} -eq 16 ] && break done @@ -110,13 +113,13 @@ theme() { # reload xresources xrdb "${XRESOURCES}" - # reload all instances of st - kill -s USR1 $(pidof st) + # reload all instances of term + kill -s USR1 $(ps -ef | grep "\<${TERMINAL}\>" | grep -v "\<grep\>" | awk '{ printf "%s ", $2 }') # hacky work-around to change terminal fg on the fly # buggy with alpha - for tty in $(ls /dev/pts/ | egrep -i '[1-9][0-9]*'); do - printf "\033]4;${DEFAULTFG};${color0}\007" > "/dev/pts/${tty}" 2>/dev/null + for tty in $(find /dev/pts/ -name '*' | grep '[1-9][0-9]*' | tr -d '[:alpha:][=/=]'); do + echo "\033]4;${DEFAULTFG};${color0}\007" > "/dev/pts/${tty}" 2>/dev/null done # reload dwm @@ -138,14 +141,12 @@ main() { # if dir get rand file if [ -d "${path}" ]; then - get_rand_file "${path}" + get_rand_file "${path}" && wp "${file}" # if file check it elif [ -f "${path}" ]; then - check_file "${path}" + check_file "${path}" && wp "${file}" + else return 1 fi - - # change wp if file exists and is ok - { [ ${?} -eq 0 ] && [ -n "${file}" ] && wp "${file}" ; } || return 1 } main "${@}" diff --git a/.local/share/wp b/.local/share/wp @@ -1 +1 @@ -/home/mc/pix/wp/olympus.jpg -\ No newline at end of file +/home/mc/pix/wp/cassettes.jpg +\ No newline at end of file