X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=.zsh_functions;h=5e443340f3f6e3fe48e98302d1c72fe17893b85c;hb=82cf852dfc3a1b37af376fcfac9606b287e3a3f0;hp=137c38151311bd5be55c5c1ec11c95e3612113e1;hpb=3a5f48b983b238885420013ae7a1b4c0c86f8f58;p=user%2Fhenk%2Fvcsh%2Fzsh.git diff --git a/.zsh_functions b/.zsh_functions index 137c381..5e44334 100644 --- a/.zsh_functions +++ b/.zsh_functions @@ -1,49 +1,49 @@ -function info_print () { - local esc_begin esc_end - esc_begin="$1" - esc_end="$2" - shift 2 - printf '%s' ${esc_begin} - printf '%s' "$*" - printf '%s' "${esc_end}" -} - -function set_title () { - info_print $'\e]0;' $'\a' "$@" -} - -function ESC_print () { - info_print $'\ek' $'\e\\' "$@" -} - -preexec () { - case $TERM in - (xterm*|rxvt*) - set_title "${(%):-"%n@%m:"}" "$1" - ;; - (screen*) - local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]} - ESC_print ${CMD} - ;; - esac -} - -precmd () { - case $TERM in - (xterm*|rxvt*) - set_title ${(%):-"%n@%m: %~"} - ;; - (screen*) - ESC_print "zsh" - ;; - esac - - vcs_info - - local INBOXINFO="$(task rc.gc=off rc.verbose=nothing +in +PENDING count) " - - PS1="${HENKSPROMPTHEADER}${INBOXINFO}%(0?..%F{red}E%?%f )%(1j.%F{yellow}J%j%f .)%(3L.%F{yellow}L%L%f .)%3~ %F{green}$VCSH_REPO_NAME%f%F{yellow}${vcs_info_msg_0_}%f%# " -} +#function info_print () { +# local esc_begin esc_end +# esc_begin="$1" +# esc_end="$2" +# shift 2 +# printf '%s' ${esc_begin} +# printf '%s' "$*" +# printf '%s' "${esc_end}" +#} +# +#function set_title () { +# info_print $'\e]0;' $'\a' "$@" +#} +# +#function ESC_print () { +# info_print $'\ek' $'\e\\' "$@" +#} +# +#preexec () { +# case $TERM in +# (xterm*|rxvt*) +# set_title "${(%):-"%n@%m:"}" "$1" +# ;; +# (screen*) +# local CMD=${1[(wr)^(*=*|sudo|ssh|evince|-*)]} +# ESC_print ${CMD} +# ;; +# esac +#} +# +#precmd () { +# case $TERM in +# (xterm*|rxvt*) +# set_title ${(%):-"%n@%m: %~"} +# ;; +# (screen*) +# ESC_print "zsh" +# ;; +# esac +# +# vcs_info +# +## local INBOXINFO="$(task rc.gc=off rc.verbose=nothing +in +PENDING count) " +# +# PS1="${HENKSPROMPTHEADER}%(0?..%F{red}E%?%f )%(1j.%F{yellow}J%j%f .)%(3L.%F{yellow}L%L%f .)%3~ %F{green}$VCSH_REPO_NAME%f%F{yellow}${vcs_info_msg_0_}%f%# " +#} function vifind () { vi $( find $@) @@ -60,10 +60,48 @@ function henkspngpostproc () { local img resize_by="$1" shift + echo "Creating Directories …" + mkdir --parents resized/pngnqed/optipnged optimized for img in $* do - mkdir -p resized/pngnqed - convert -resize $resize_by% $img resized/$img - pngnq -f -d resized/pngnqed -e .png resized/$img + echo "Resizing image …" + convert -resize $resize_by% "$img" "resized/$img" + echo "Running pngnq …" + pngnq -s1 -f -d "resized/pngnqed" -e .png "resized/$img" + echo "Running optipng …" + optipng -force -out "resized/pngnqed/optipnged/$img" "resized/pngnqed/$img" + echo "Moving final image to directory 'optimized' …" + cp --verbose --interactive --target-directory=optimized/ "resized/pngnqed/optipnged/$img" + echo "Removing temporary images …" + #rm --verbose --interactive \ + rm --verbose \ + "resized/$img" \ + "resized/pngnqed/$img" \ + "resized/pngnqed/optipnged/$img" + done + rmdir --parents resized/pngnqed/optipnged +} + +function with () { + local prefix="$* " str compcontext=normal:normal:_normal + while : + do + str=$prefix + vared str && eval $str done } + +function stardewpause () { + while read bar + do + xdotool \ + search --class 'StardewValley' \ + windowactivate --sync \ + type --delay 100 t/pause + done +} + +function henkpwgen () { + echo $( (tr -cd '[:alnum:]' | head -c $1) < /dev/urandom) +} +