From e92af1f7088cc5b6b40a5ceba275a197c305de62 Mon Sep 17 00:00:00 2001 From: katherine Date: Sat, 19 Mar 2016 22:17:28 -0700 Subject: snapshot lots of random things changed; forgot to update for a while again. moving things to .config/init/funcs is one important thing; means being able to use those shell scripts anywhere, like ranger or whatever --- .config/init/funcs/mpd-cover-convert | 12 +++++++ .config/init/funcs/mpd-sleep | 10 ++++++ .config/init/funcs/send | 48 ++++++++++++++++++++++++++ .config/init/gen-urxvt-theme.sh | 5 +-- .config/init/gen-userChrome.sh | 8 ++--- .config/init/gen-zathurarc.sh | 2 +- .config/init/vars | 65 ++++++++++++++++++++++++------------ 7 files changed, 121 insertions(+), 29 deletions(-) create mode 100755 .config/init/funcs/mpd-cover-convert create mode 100755 .config/init/funcs/mpd-sleep create mode 100755 .config/init/funcs/send (limited to '.config/init') diff --git a/.config/init/funcs/mpd-cover-convert b/.config/init/funcs/mpd-cover-convert new file mode 100755 index 0000000..cd3569a --- /dev/null +++ b/.config/init/funcs/mpd-cover-convert @@ -0,0 +1,12 @@ +#!/bin/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 + +local d +find ~/music -type f -regextype posix-extended -regex ".*cover\.(png|jpg)"\ + | while read file; do + if [[ ! -f "${file:h}/cover-small.png" ]]; then + convert "$file" -resize 250x "${file:h}/cover-small.png" + fi +done diff --git a/.config/init/funcs/mpd-sleep b/.config/init/funcs/mpd-sleep new file mode 100755 index 0000000..c01d734 --- /dev/null +++ b/.config/init/funcs/mpd-sleep @@ -0,0 +1,10 @@ +#!/bin/zsh + +# 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 +done diff --git a/.config/init/funcs/send b/.config/init/funcs/send new file mode 100755 index 0000000..88b3dbb --- /dev/null +++ b/.config/init/funcs/send @@ -0,0 +1,48 @@ +#!/bin/zsh +# quickly send a file to hosted tmp dir + +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') +if [[ "$1" ]]; then + for i in "$@"; do + [[ -f "$i" ]] \ + || { echo "file '$i' not found"; return 1 } + done + scp "$@" shmibbles.me:http/tmp/ >/dev/null 2>&1 \ + || { echo "sending files failed"; return 1 } + if [[ $? -eq 0 ]]; then + for name in "$@" + do + basename=${name:t} + ssh shmibbles.me "cd http/tmp; chmod o+r \"${basename//\"/\\\"}\"" + if [[ $? -eq 0 ]]; then + { + 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 + else + echo "making '$name' readable failed" + return 1 + fi + done + fi +else + echo "specify at least one file to send" + return 1 +fi diff --git a/.config/init/gen-urxvt-theme.sh b/.config/init/gen-urxvt-theme.sh index ba11d71..40e986b 100644 --- a/.config/init/gen-urxvt-theme.sh +++ b/.config/init/gen-urxvt-theme.sh @@ -42,8 +42,9 @@ URxvt*color15: $light_white # Select the fonts to be used. This is a comma separated list of font names that are checked in order when trying to find glyphs for characters. The first font echo -n "URxvt*font: " -echo -n "xft:${ttfont}:size=${ttfont_size}, " -echo "xft:${jfont}:size=${jfont_size}" +echo -n "xft:${mfont}:size=${mfont_size}, " +echo -n "xft:${jfont}:size=${jfont_size}, " +echo "xft:${bkfont}:size=${bkfont_size}" } > /tmp/urxvt-theme diff --git a/.config/init/gen-userChrome.sh b/.config/init/gen-userChrome.sh index ed5f1f2..14b3dec 100644 --- a/.config/init/gen-userChrome.sh +++ b/.config/init/gen-userChrome.sh @@ -25,15 +25,15 @@ echo "\ .tabbrowser-tab { background: ${bg_normal} !important; color: ${fg_normal} !important; - font-family: \"${ttfont}\" !important; - font-size: ${ttfont_size}pt !important; + font-family: \"${mfont}\" !important; + font-size: ${mfont_size}pt !important; } .tabbrowser-tab[selected] { background: ${bg_focus} !important; color: ${fg_focus} !important; - font-family: \"${ttfont}\" !important; - font-size: ${ttfont_size}pt !important; + font-family: \"${mfont}\" !important; + font-size: ${mfont_size}pt !important; } " > /tmp/userChrome.css diff --git a/.config/init/gen-zathurarc.sh b/.config/init/gen-zathurarc.sh index 9e577b5..6ef7b7b 100644 --- a/.config/init/gen-zathurarc.sh +++ b/.config/init/gen-zathurarc.sh @@ -1,7 +1,7 @@ { echo "\ -set font \"$ttfont $ttfont_size\" +set font \"$mfont $mfont_size\" set highlight-color \"$bg_normal\" set highlight-active-color \"$bg_focus\" diff --git a/.config/init/vars b/.config/init/vars index beda3de..32dd1d2 100644 --- a/.config/init/vars +++ b/.config/init/vars @@ -1,24 +1,3 @@ -############# -# general # -############# - -bheight=20 - -ifont='-*-stlarch-medium-r-*-*-*-*-*-*-*-*-*-*' -ifont_off='-2' - -bfont='Droid Sans Mono' -bfont_size='9' -bfont_off='-1' - -jfont='Togoshi Mono' -jfont_size='10' -jfont_off='0' - - -ttfont='Droid Sans Mono' -ttfont_size='10' - ############ # themes # ############ @@ -88,7 +67,7 @@ wallpaper='kuvshinov-ilya.png' std_black='#262626' std_red='#ed4047' -std_green='#6fbf6d' +std_green='#72c76f' std_yellow='#f0b73d' std_blue='#0075a6' std_magenta='#d95784' @@ -110,3 +89,45 @@ bg_focus="$std_magenta" fg_focus="$light_white" bg_urgent="$std_red" fg_urgent="$light_white" + + +############### +# misc vars # +############### + +bheight=20 + +# icon font +ifont='-*-stlarch-medium-r-*-*-*-*-*-*-*-*-*-*' +ifont_off='-2' + +# bar font +bfont='Droid Sans Mono' +bfont_size='9' +bfont_off='-1' + +# jp font +jfont='Togoshi Mono' +jfont_size='10' +jfont_off='0' + +# backup font +bkfont='Noto Sans' +bkfont_size='10' +bkfont_off='0' + +# main font +mfont='Droid Sans Mono' +mfont_size='10' +dmenu_args=( -fn "${bfont}:size=${bfont_size}" -h "$bheight" + -nb "$bg_normal" -nf "$fg_normal" -sb "$bg_focus" + -sf "$fg_focus" ) + + +############### +# functions # +############### +hc() { + herbstclient "$@" +} + -- cgit v1.2.3