diff options
-rw-r--r-- | .config/init/funcreqs/mpd-cover-convert | 2 | ||||
-rw-r--r-- | .config/init/funcreqs/mpd-sleep | 2 | ||||
-rw-r--r-- | .config/init/funcreqs/scap | 2 | ||||
-rw-r--r-- | .config/init/funcreqs/send | 2 | ||||
-rwxr-xr-x | .config/init/funcs/mpd-cover-convert | 2 | ||||
-rwxr-xr-x | .config/init/funcs/mpd-sleep | 12 | ||||
-rwxr-xr-x | .config/init/funcs/scap | 26 | ||||
-rwxr-xr-x | .config/init/funcs/send | 53 | ||||
-rw-r--r-- | .config/init/gen/bg-saved.sh (renamed from .config/init/gen-bg-saved.sh) | 0 | ||||
-rw-r--r-- | .config/init/gen/urxvt-theme.sh (renamed from .config/init/gen-urxvt-theme.sh) | 0 | ||||
-rw-r--r-- | .config/init/gen/userChrome.sh (renamed from .config/init/gen-userChrome.sh) | 0 | ||||
-rw-r--r-- | .config/init/gen/zathurarc.sh (renamed from .config/init/gen-zathurarc.sh) | 0 | ||||
-rwxr-xr-x | .config/init/init.sh | 12 | ||||
-rw-r--r-- | .zprofile | 33 |
14 files changed, 92 insertions, 54 deletions
diff --git a/.config/init/funcreqs/mpd-cover-convert b/.config/init/funcreqs/mpd-cover-convert new file mode 100644 index 0000000..31bbd05 --- /dev/null +++ b/.config/init/funcreqs/mpd-cover-convert @@ -0,0 +1,2 @@ +func_init_prereqs=(mpc) +func_init_checks=("stat $HOME/music") diff --git a/.config/init/funcreqs/mpd-sleep b/.config/init/funcreqs/mpd-sleep new file mode 100644 index 0000000..66ce754 --- /dev/null +++ b/.config/init/funcreqs/mpd-sleep @@ -0,0 +1,2 @@ +func_init_prereqs=(mpc poweroff) +func_init_checks=() diff --git a/.config/init/funcreqs/scap b/.config/init/funcreqs/scap new file mode 100644 index 0000000..1a58abc --- /dev/null +++ b/.config/init/funcreqs/scap @@ -0,0 +1,2 @@ +func_init_prereqs=(ffmpeg archey3) +func_init_checks=() diff --git a/.config/init/funcreqs/send b/.config/init/funcreqs/send new file mode 100644 index 0000000..85dd46c --- /dev/null +++ b/.config/init/funcreqs/send @@ -0,0 +1,2 @@ +func_init_prereqs=(scrot xclip scp ssh) +func_init_checks=() diff --git a/.config/init/funcs/mpd-cover-convert b/.config/init/funcs/mpd-cover-convert index cd3569a..e8359b7 100755 --- a/.config/init/funcs/mpd-cover-convert +++ b/.config/init/funcs/mpd-cover-convert @@ -1,4 +1,4 @@ -#!/bin/zsh +#!/usr/bin/env zsh # make small cover versions for mpc-notify.sh # leaks memory for some reason, so don't run on a clean library # or it'll crash everything diff --git a/.config/init/funcs/mpd-sleep b/.config/init/funcs/mpd-sleep index c01d734..d821572 100755 --- a/.config/init/funcs/mpd-sleep +++ b/.config/init/funcs/mpd-sleep @@ -1,10 +1,10 @@ -#!/bin/zsh +#!/usr/bin/env zsh +# power off after mpd stops playing -# power off after finishing mpd playlist mpc play > /dev/null while true; do - mpc idle player > /dev/null || return 1 - if [[ -z "$(mpc status | grep playing)" ]]; then - poweroff - fi + mpc idle player > /dev/null || return 1 + if [[ -z "$(mpc status | grep playing)" ]]; then + poweroff + fi done diff --git a/.config/init/funcs/scap b/.config/init/funcs/scap index 489f7b8..bf9c66d 100755 --- a/.config/init/funcs/scap +++ b/.config/init/funcs/scap @@ -1,18 +1,18 @@ -#!/bin/zsh - +#!/usr/bin/env zsh # capture webm -scap() { - archey3 - sleep .2 - if [[ -f '/tmp/cap.mp4' ]]; then - rm '/tmp/cap.mp4' - fi +xset q +[[ $? -ne 0 ]] && return 1 + +archey3 +sleep .2 - echo 'recording...' +if [[ -f '/tmp/cap.mp4' ]]; then + rm '/tmp/cap.mp4' +fi - ffmpeg -v panic -video_size 1920x1080 -framerate 30 -f x11grab -i :0.0 \ - -f pulse -ac 2 -i default -af aresample=async=1 \ - -c:v libx264 -q 0 -preset fast '/tmp/cap.mp4' -} +echo 'recording...' +ffmpeg -v panic -video_size 1920x1080 -framerate 30 -f x11grab -i :0.0 \ + -f pulse -ac 2 -i default -af aresample=async=1 \ + -c:v libx264 -q 0 -preset ultrafast '/tmp/cap.mp4' diff --git a/.config/init/funcs/send b/.config/init/funcs/send index e88c8aa..009c601 100755 --- a/.config/init/funcs/send +++ b/.config/init/funcs/send @@ -1,46 +1,47 @@ -#!/bin/zsh +#!/usr/bin/env zsh # quickly send a file to hosted /tmp/ dir +# attempt to copy its location to the x clipboard local name local basename local escapes typeset -A escapes escapes=(' ' '%20' '"' '%22' '#' '%23' '$' '%24' - '%' '%25' '&' '%26' "'" '%27' '+' '%2b' - ',' '%2c' '/' '%2f' ':' '%3a' ';' '%3b' - '<' '%3c' '=' '%3d' '>' '%3e' '?' '%3f' - '@' '%40' '[' '%5b' '\' '%5c' ']' '%5d' - '^' '%5e' '`' '%60' '{' '%7b' '|' '%7c' - '}' '%7d' '~' '%7e') + '%' '%25' '&' '%26' "'" '%27' '+' '%2b' + ',' '%2c' '/' '%2f' ':' '%3a' ';' '%3b' + '<' '%3c' '=' '%3d' '>' '%3e' '?' '%3f' + '@' '%40' '[' '%5b' '\' '%5c' ']' '%5d' + '^' '%5e' '`' '%60' '{' '%7b' '|' '%7c' + '}' '%7d' '~' '%7e') [[ "$1" ]] \ - || { echo "please specify at least one file to send"; return 1 } + || { echo "please specify at least one file to send"; return 1 } for i in "$@"; do - [[ -f "$i" ]] \ - || { echo "file '$i' not found"; return 1 } + [[ -f "$i" ]] \ + || { echo "file '$i' not found"; return 1 } done scp "$@" shmibbles.me:http/tmp/ 2>/dev/null \ - || { echo "sending files failed"; return 1 } + || { echo "sending files failed"; return 1 } for name in "$@" do - basename=${name:t} + basename=${name:t} - ssh shmibbles.me "cd http/tmp; chmod o+r \"${basename//\"/\\\"}\"" \ - || { echo "making '$name' readable failed"; return 1 } + ssh shmibbles.me "cd http/tmp; chmod o+r \"${basename//\"/\\\"}\"" \ + || { echo "making '$name' readable failed"; return 1 } - { - printf "%s" 'https://shmibbles.me/tmp/' - for c in "${(s::)basename}"; do - if [[ "${escapes[$c]}" == "" ]]; then - printf "%s" "$c" - else - printf "%s" "${escapes[$c]}" - fi - done - } | tee \ - >(xclip -i -selection clipboard) \ - >(xclip -i -selection primary) >/dev/null + { + printf "%s" 'https://shmibbles.me/tmp/' + for c in "${(s::)basename}"; do + if [[ "${escapes[$c]}" == "" ]]; then + printf "%s" "$c" + else + printf "%s" "${escapes[$c]}" + fi + done + } | tee \ + >(xclip -i -selection clipboard) \ + >(xclip -i -selection primary) >/dev/null done diff --git a/.config/init/gen-bg-saved.sh b/.config/init/gen/bg-saved.sh index bf2d7cc..bf2d7cc 100644 --- a/.config/init/gen-bg-saved.sh +++ b/.config/init/gen/bg-saved.sh diff --git a/.config/init/gen-urxvt-theme.sh b/.config/init/gen/urxvt-theme.sh index 40e986b..40e986b 100644 --- a/.config/init/gen-urxvt-theme.sh +++ b/.config/init/gen/urxvt-theme.sh diff --git a/.config/init/gen-userChrome.sh b/.config/init/gen/userChrome.sh index 44fb6a9..44fb6a9 100644 --- a/.config/init/gen-userChrome.sh +++ b/.config/init/gen/userChrome.sh diff --git a/.config/init/gen-zathurarc.sh b/.config/init/gen/zathurarc.sh index 387b1e3..387b1e3 100644 --- a/.config/init/gen-zathurarc.sh +++ b/.config/init/gen/zathurarc.sh diff --git a/.config/init/init.sh b/.config/init/init.sh index 9b45f62..6a21763 100755 --- a/.config/init/init.sh +++ b/.config/init/init.sh @@ -1,7 +1,7 @@ -#!/bin/bash -source ~/.config/init/vars +#!/bin/zsh -source ~/.config/init/gen-zathurarc.sh -source ~/.config/init/gen-urxvt-theme.sh -source ~/.config/init/gen-userChrome.sh -source ~/.config/init/gen-bg-saved.sh +source $HOME/.config/init/vars + +for f in $HOME/.config/init/gen/*; do + source "$f" +done @@ -7,8 +7,37 @@ export QT_STYLE_OVERRIDE=gtk PATH=$PATH:~/.cabal/bin ########## MAKE USER FUNCS AVAILABLE ########## -[[ -d ~/.config/init/funcs/ ]] && \ - PATH="$PATH:$HOME/.config/init/funcs" +func_init_checkreq() { + local func_init_state=0 + for e in "$@"; do + if [[ $func_init_state -eq 0 ]]; then + if [[ "$e" == ',' ]]; then + func_init_state=1 + else + whence $e >/dev/null + [[ $? -eq 0 ]] || return 1 + fi + else + local cmd + echo "$e" | read -A cmd + $cmd 2>/dev/null 1>&2 + [[ $? -eq 0 ]] || return 1 + fi + done + return 0 +} + +if [[ -d ~/.config/init/funcs/ && -d ~/.config/init/funcreqs ]]; then + rm -r /tmp/funcs + mkdir -p /tmp/funcs + PATH=$PATH:/tmp/funcs + for f in $HOME/.config/init/funcreqs/*; do + source "$f" + func_init_checkreq $func_init_prereqs , $func_init_checks + [[ $? -eq 0 ]] && \ + ln -s $HOME/.config/init/funcs/${f:t} /tmp/funcs/${f:t} + done +fi ############# CONNECTING OVER SSH ############# [[ -f ~/.zprofile-dtach ]] && \ |