diff --git a/.zshrc b/.zshrc index 486dda9..bf6a10b 100644 --- a/.zshrc +++ b/.zshrc @@ -1,7 +1,4 @@ -if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then - source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" -fi source "${ZDOTDIR}/preferences.zsh" source "${ZDOTDIR}/completions.zsh" source "${ZDOTDIR}/bindings.zsh" -source "${ZDOTDIR}/custom.zsh" +source "${ZDOTDIR}/misc.zsh" diff --git a/custom.zsh b/custom.zsh deleted file mode 100644 index 402c95d..0000000 --- a/custom.zsh +++ /dev/null @@ -1,7 +0,0 @@ -source "${ZDOTDIR}/custom/prependsudo.zsh" -source "${ZDOTDIR}/custom/aliases.zsh" -fpath+=("${ZDOTDIR}/custom/functions" "${ZDOTDIR}/custom/segments") -compdef _files mplay -function {prompt_c_{covid_19,docker_host,mpv,new_mail,todo,weather,newsboat,mumble,sfeed},cprompts:cache:async:{covid,weather,rss},get{gbooru,mangareader,nhentai},gitsubrepo,osutab,prettygitlog,paste,mplay,qff,recordscreen,sendirc}() { - autoload -X -} diff --git a/custom/aliases.zsh b/custom/aliases.zsh deleted file mode 100644 index 3965614..0000000 --- a/custom/aliases.zsh +++ /dev/null @@ -1,2 +0,0 @@ -alias ytdldown='youtube-dl --no-part --newline -ixcw -R infinite -f bestaudio/best --add-metadata --embed-thumbnail -o "/home/caskd/Media/Music/%(album)s/%(track_number)s - %(track)s.%(ext)s"' -alias ls='ls --color=auto' diff --git a/custom/functions/ffmpeg-compress b/custom/functions/ffmpeg-compress deleted file mode 100644 index 677655b..0000000 --- a/custom/functions/ffmpeg-compress +++ /dev/null @@ -1 +0,0 @@ -ffmpeg -hwaccel vdpau -i $1 -c:v h264 -crf 30 -movflags +faststart $2 diff --git a/custom/functions/ffmpeg-gif b/custom/functions/ffmpeg-gif deleted file mode 100644 index 8a0f09b..0000000 --- a/custom/functions/ffmpeg-gif +++ /dev/null @@ -1 +0,0 @@ -ffmpeg -ss $2 -to $3 -i $1 -r 60 -pix_fmt bgr8 -vf "mpdecimate,normalize,scale=480:-1:flags=spline,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=5:diff_mode=rectangle" -loop 0 $4 diff --git a/custom/functions/getgbooru b/custom/functions/getgbooru deleted file mode 100644 index a5a2067..0000000 --- a/custom/functions/getgbooru +++ /dev/null @@ -1,14 +0,0 @@ -local -a urls -local -a fetch -local page=0 -while [ ${page} -eq 0 ] || [ ${#fetch} -eq 100 ]; do - <<< "Fetching page $page" - fetch=($(curl -sZSGL "https://gelbooru.com/index.php?q=index&s=post&page=dapi&json=1&pid=$page&tags=${1}" | jq -r ".[].file_url")) - urls+=($fetch) - page=$(($page + 1)) -done -if [[ $2 == "mpv" ]]; then - [ ${#urls} -gt 0 ] && mpv --loop $urls -else - [ ${#urls} -gt 0 ] && curl -RL\#C - --remote-name-all $urls -fi diff --git a/custom/functions/getmangareader b/custom/functions/getmangareader deleted file mode 100644 index ae55dd1..0000000 --- a/custom/functions/getmangareader +++ /dev/null @@ -1,14 +0,0 @@ -local link=("" "$1") -local IFS=$'/' -local img -local data - -while [[ ! -z $link ]]; do - data=$(curl -sS "http://www.mangareader.net/${link[2]}/${link[3]:-1}/${link[4]:-1}" | grep '
') - img=$(print $data | grep -oP '(?<=src=").*\.jpg(?=")') - if [[ ! -d "${link[3]:-1}/" ]]; then - mkdir "${link[3]:-1}/" - fi - curl -\#L "$img" -o "${link[3]:-1}/${link[4]:-1}.jpg" - link=($(print $data | grep -oP '(?<=\/dev/null || return -print -u $REPLY "loadfile $@" -exec {REPLY}>&- diff --git a/custom/functions/osutab b/custom/functions/osutab deleted file mode 100644 index f6fc52e..0000000 --- a/custom/functions/osutab +++ /dev/null @@ -1 +0,0 @@ -xinput --set-float-prop 'UGTABLET 6 inch PenTablet Pen (0)' 'Coordinate Transformation Matrix' 3.5 0 -0.5 0 2.9 0 0 0 1 diff --git a/custom/functions/paste b/custom/functions/paste deleted file mode 100644 index 0f0f302..0000000 --- a/custom/functions/paste +++ /dev/null @@ -1 +0,0 @@ -curl -F'file=@-' $@ diff --git a/custom/functions/prettygitlog b/custom/functions/prettygitlog deleted file mode 100644 index 4f23561..0000000 --- a/custom/functions/prettygitlog +++ /dev/null @@ -1 +0,0 @@ -git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all diff --git a/custom/functions/recordscreen b/custom/functions/recordscreen deleted file mode 100644 index cd9c854..0000000 --- a/custom/functions/recordscreen +++ /dev/null @@ -1,9 +0,0 @@ -ffmpeg -y \ - -f pulse -i 1 \ - -vaapi_device /dev/dri/renderD128 \ - -video_size 1920x1080 -framerate 60 \ - -f x11grab -i :0+1080 \ - -vf 'hwupload,scale_vaapi=format=nv12' \ - -c:v hevc_vaapi -b:v 15M -qp 18 \ - -c:a aac -b:a 64k -ar 24000 -ac 2 \ - $1 diff --git a/custom/functions/sendirc b/custom/functions/sendirc deleted file mode 100644 index 6b6d96b..0000000 --- a/custom/functions/sendirc +++ /dev/null @@ -1,2 +0,0 @@ -([ -z $1 ] || [ -z $2 ] || [ -z $3 ]) && return -printf "PRIVMSG %s :%s\r\n" "$2" "${argv[3,-1]}" > ~/IRC/$1/global/in diff --git a/custom/prependsudo.zsh b/misc.zsh similarity index 100% rename from custom/prependsudo.zsh rename to misc.zsh diff --git a/custom/segments/cprompts:cache:async:covid b/powerlevel-config/segments/cprompts:cache:async:covid similarity index 100% rename from custom/segments/cprompts:cache:async:covid rename to powerlevel-config/segments/cprompts:cache:async:covid diff --git a/custom/segments/cprompts:cache:async:rss b/powerlevel-config/segments/cprompts:cache:async:rss similarity index 100% rename from custom/segments/cprompts:cache:async:rss rename to powerlevel-config/segments/cprompts:cache:async:rss diff --git a/custom/segments/cprompts:cache:async:weather b/powerlevel-config/segments/cprompts:cache:async:weather similarity index 79% rename from custom/segments/cprompts:cache:async:weather rename to powerlevel-config/segments/cprompts:cache:async:weather index 366c0a0..92b63ae 100644 --- a/custom/segments/cprompts:cache:async:weather +++ b/powerlevel-config/segments/cprompts:cache:async:weather @@ -4,9 +4,9 @@ icons=([c]='' [lc]='' [hc]='' [s]='🌢' [lr]='🌢' [hr]='' [sn]=' colors=([c]="yellow" [lc]="yellow" [hc]="cyan" [s]="yellow" [lr]="cyan" [hr]="blue" [t]="white" [h]="white" [sl]="blue" [sn]="white") local REPLY zstyle -s ':custom:prompts:weather' location REPLY -local result=$(curl -sL https://www.metaweather.com/api/location/${REPLY:-1339615}/ | jq -e '.consolidated_weather[0] | {"temp": .the_temp, "icon": .weather_state_abbr}') +local result=$(curl -sL https://www.metaweather.com/api/location/${REPLY:-1339615}/ | jq -e '.consolidated_weather[0] | {"temp": .the_temp, "hum": .humidity, "icon": .weather_state_abbr}') if [ ! -z $result ]; then local ico=$(print $result | jq -r '.icon') - typeset -g _cprompts_weather=($(( int(rint($(jq -r '.temp' <<< $result))) )) ${colors[$ico]:-white} ${icons[${ico:-X}]}) + typeset -g _cprompts_weather=($(( int(rint($(jq -r '.temp' <<< $result))) )) ${colors[$ico]:-white} ${icons[${ico:-X}]} $(( int(rint($(jq -r '.hum' <<< $result))) ))) print ${_cprompts_weather} > $tmpfile fi diff --git a/custom/segments/prompt_c_covid_19 b/powerlevel-config/segments/prompt_c_covid_19 similarity index 100% rename from custom/segments/prompt_c_covid_19 rename to powerlevel-config/segments/prompt_c_covid_19 diff --git a/custom/segments/prompt_c_docker_host b/powerlevel-config/segments/prompt_c_docker_host similarity index 100% rename from custom/segments/prompt_c_docker_host rename to powerlevel-config/segments/prompt_c_docker_host diff --git a/custom/segments/prompt_c_mpv b/powerlevel-config/segments/prompt_c_mpv similarity index 100% rename from custom/segments/prompt_c_mpv rename to powerlevel-config/segments/prompt_c_mpv diff --git a/custom/segments/prompt_c_mumble b/powerlevel-config/segments/prompt_c_mumble similarity index 100% rename from custom/segments/prompt_c_mumble rename to powerlevel-config/segments/prompt_c_mumble diff --git a/custom/segments/prompt_c_new_mail b/powerlevel-config/segments/prompt_c_new_mail similarity index 100% rename from custom/segments/prompt_c_new_mail rename to powerlevel-config/segments/prompt_c_new_mail diff --git a/custom/segments/prompt_c_newsboat b/powerlevel-config/segments/prompt_c_newsboat similarity index 100% rename from custom/segments/prompt_c_newsboat rename to powerlevel-config/segments/prompt_c_newsboat diff --git a/custom/segments/prompt_c_sfeed b/powerlevel-config/segments/prompt_c_sfeed similarity index 100% rename from custom/segments/prompt_c_sfeed rename to powerlevel-config/segments/prompt_c_sfeed diff --git a/custom/segments/prompt_c_todo b/powerlevel-config/segments/prompt_c_todo similarity index 100% rename from custom/segments/prompt_c_todo rename to powerlevel-config/segments/prompt_c_todo diff --git a/custom/segments/prompt_c_weather b/powerlevel-config/segments/prompt_c_weather similarity index 89% rename from custom/segments/prompt_c_weather rename to powerlevel-config/segments/prompt_c_weather index 2a67504..29b125c 100644 --- a/custom/segments/prompt_c_weather +++ b/powerlevel-config/segments/prompt_c_weather @@ -8,4 +8,4 @@ if [ ${stats[1]:-0} -lt $(($epochtime[1]-3600)) ]; then else typeset -g _cprompts_weather=($(< $tmpfile)) fi -[ -v _cprompts_weather ] && p10k segment -b ${_cprompts_weather[2]:-white} -i ${_cprompts_weather[3]:-\?} -t "${_cprompts_weather[1]:-unknown}" +[ -v _cprompts_weather ] && p10k segment -b ${_cprompts_weather[2]:-white} -i ${_cprompts_weather[3]:-\?} -t "${_cprompts_weather[1]:-unknown}°C ${_cprompts_weather[4]:-unk}%%" diff --git a/preferences.zsh b/preferences.zsh index 3c6dc06..54ab3ea 100644 --- a/preferences.zsh +++ b/preferences.zsh @@ -1,5 +1,3 @@ -typeset -g HISTFILE=~/.histfile -typeset -g CACHEPATH=~/.cache typeset -g HISTSIZE=1000 typeset -g SAVEHIST=1000 typeset -g ZLE_RPROMPT_INDENT=0 @@ -33,6 +31,10 @@ fi zstyle -s ':custom:preferences' prompt _cur_prompt if [[ $_cur_prompt == "p9k" ]] && [[ -r "${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme" ]]; then + fpath+=("${ZDOTDIR}/powerlevel-config/segments") + function {prompt_c_{covid_19,docker_host,mpv,new_mail,todo,weather,newsboat,mumble,sfeed},cprompts:cache:async:{covid,weather,rss}}() { + autoload -X + } source ${ZDOTDIR}/powerlevel-config/all.zsh source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme else