diff options
Diffstat (limited to '.config/init')
-rw-r--r-- | .config/init/funcreqs/gifo | 2 | ||||
-rwxr-xr-x | .config/init/funcs/gifo | 21 | ||||
-rwxr-xr-x | .config/init/funcs/make-gif | 40 | ||||
-rw-r--r-- | .config/init/gen/urxvt-theme.sh | 4 | ||||
-rw-r--r-- | .config/init/vars | 10 |
5 files changed, 56 insertions, 21 deletions
diff --git a/.config/init/funcreqs/gifo b/.config/init/funcreqs/gifo new file mode 100644 index 0000000..6724e30 --- /dev/null +++ b/.config/init/funcreqs/gifo @@ -0,0 +1,2 @@ +func_init_prereqs=(gifsicle du cut tr) +func_init_checks=() diff --git a/.config/init/funcs/gifo b/.config/init/funcs/gifo new file mode 100755 index 0000000..854b45a --- /dev/null +++ b/.config/init/funcs/gifo @@ -0,0 +1,21 @@ +#!/usr/bin/env zsh +# optimise gifs with gifsicle + +local before +local after +local ofile + +for i in $@; do + if [[ -f "$i" ]]; then + ofile="$i.out" + while [[ -f "$ofile" ]]; do + ofile="$ofile.out" + done + du -h "$i" | cut -f 1 | read before + echo "$i..." + gifsicle --no-ignore-errors -w -O3 "$i" -o "$i.out" + [[ -f "$ofile" ]] && rm "$i" && mv "$ofile" "$i" && \ + du -h "$i" | cut -f 1 | read after && \ + echo " $before -> $after" || echo " failed" + fi +done diff --git a/.config/init/funcs/make-gif b/.config/init/funcs/make-gif index 3221e97..e100650 100755 --- a/.config/init/funcs/make-gif +++ b/.config/init/funcs/make-gif @@ -10,9 +10,9 @@ usage() { echo "" echo " description option default val" echo " start time -s <time> 00:00:00" - echo " length in seconds -t <int> full length" - echo " gif fps -f <int> 10" - echo " gif pixel width -w <int> 480" + echo " length in seconds -t <num> full length" + echo " gif fps -f <num> 10" + echo " gif pixel width -w <num> 480" echo " use subtitles -b" echo " use subtitle track -n <int> 0" [[ $hasgsic ]] && echo "optimise with gifsicle -g" @@ -28,8 +28,10 @@ local subs="" local strack=0 local gsic="" -local timepat='^(([0-9][0-9]:){1,2}[0-9][0-9]|[0-9]+)$' -local intpat='^[0-9]+$' +local timepat='^(([0-9][0-9]:){1,2}[0-9][0-9]|[0-9]+)(\.[0-9]+){0,1}$' +local numpat='^[1-9][0-9]*(\.[0-9]+){0,1}$' +local intpat='^[1-9][0-9]*$' +local zintpat='^[0-9]+$' # tmp var used to old '-t' if length is used local t="" @@ -44,25 +46,25 @@ if [[ $hasgsic ]]; then start="$OPTARG" ;; t) - [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "length must be an integer" + [[ ! $(echo $OPTARG | grep -oE "$numpat") ]] \ + && usage "length must be a positive rational number" length=$OPTARG t="-t" ;; f) - [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "start time must be an integer" + [[ ! $(echo $OPTARG | grep -oE "$numpat") ]] \ + && usage "fps must be a positive rational number" fps=$OPTARG ;; w) [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "fps must be an integer" + && usage "width must be a positive integer" width=$OPTARG ;; b) subs=true ;; n) - [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "sub track specifier must be an integer" + [[ ! $(echo $OPTARG | grep -oE "$zintpat") ]] \ + && usage "sub track index must be a non-negative integer" strack=$OPTARG ;; g) gsic=true ;; @@ -79,25 +81,25 @@ else start="$OPTARG" ;; t) - [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "length must be an integer" + [[ ! $(echo $OPTARG | grep -oE "$numpat") ]] \ + && usage "length must be a positive rational number" length=$OPTARG t="-t" ;; f) - [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "start time must be an integer" + [[ ! $(echo $OPTARG | grep -oE "$numpat") ]] \ + && usage "fps must be a positive rational number" fps=$OPTARG ;; w) [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "fps must be an integer" + && usage "width must be a positive integer" width=$OPTARG ;; b) subs=true ;; n) - [[ ! $(echo $OPTARG | grep -oE "$intpat") ]] \ - && usage "sub track specifier must be an integer" + [[ ! $(echo $OPTARG | grep -oE "$zintpat") ]] \ + && usage "sub track index must be a non-negative integer" strack=$OPTARG ;; h) usage ;; diff --git a/.config/init/gen/urxvt-theme.sh b/.config/init/gen/urxvt-theme.sh index 40e986b..97f7951 100644 --- a/.config/init/gen/urxvt-theme.sh +++ b/.config/init/gen/urxvt-theme.sh @@ -44,9 +44,9 @@ URxvt*color15: $light_white echo -n "URxvt*font: " echo -n "xft:${mfont}:size=${mfont_size}, " echo -n "xft:${jfont}:size=${jfont_size}, " +echo -n "xft:${cfont}:size=${cfont_size}, " +echo -n "xft:${efont}:size=${efont_size}, " echo "xft:${bkfont}:size=${bkfont_size}" } > /tmp/urxvt-theme -xrdb -merge /tmp/urxvt-theme - diff --git a/.config/init/vars b/.config/init/vars index af1a09c..23b2153 100644 --- a/.config/init/vars +++ b/.config/init/vars @@ -243,6 +243,16 @@ jfont='Noto Sans Mono CJK JP Regular' jfont_size='9' jfont_off='-1' +# c font +cfont='Noto Sans Mono CJK SC Regular' +cfont_size='9' +cfont_off='-1' + +# emoji font +efont='Noto Emoji' +efont_size='9' +efont_off='-1' + # backup font bkfont='Dejavu Sans Mono' bkfont_size='9' |