Update lots of things, rename custom prompts, move active prompts out of tree and update commits
This commit is contained in:
parent
961bc66584
commit
13467890d6
2
.zshenv
2
.zshenv
|
@ -1,2 +0,0 @@
|
||||||
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
|
||||||
export EDITOR=vim
|
|
|
@ -3,6 +3,6 @@ source "${ZDOTDIR}/custom/aliases.zsh"
|
||||||
source "${ZDOTDIR}/custom/gpg.zsh"
|
source "${ZDOTDIR}/custom/gpg.zsh"
|
||||||
fpath+=("${ZDOTDIR}/custom/functions" "${ZDOTDIR}/custom/segments")
|
fpath+=("${ZDOTDIR}/custom/functions" "${ZDOTDIR}/custom/segments")
|
||||||
compdef _files mplay
|
compdef _files mplay
|
||||||
function {prompt_c_{covid_19,docker_host,mpv_mpris,new_mail,todo,weather,newsboat,mumble,sfeed},cprompts:cache:async:{covid,weather,rss},get{gbooru,mangareader,nhentai},gitsubrepo,osutab,ffmpeg-{compress,gif},prettygitlog,paste,mplay,qff}() {
|
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,{send,format}irc}() {
|
||||||
autoload -X
|
autoload -X
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
alias recordscreen='ffmpeg -hwaccel vdpau -video_size 1920x1080 -framerate 60 -f x11grab -i :0 -c:v libx264rgb -crf 0 -preset ultrafast -movflags +faststart -tune zerolatency'
|
|
||||||
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 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'
|
alias ls='ls --color=auto'
|
||||||
alias grep='grep --color=auto'
|
alias grep='grep --color=auto'
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
ffmpeg -hwaccel cuda -i $1 -c:v h264 -crf 30 -vf "normalize,scale=480:-1:flags=spline,mpdecimate" $2
|
ffmpeg -hwaccel vdpau -i $1 -c:v h264 -crf 30 -movflags +faststart $2
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
local -A colormap
|
||||||
|
while read LINE; do
|
||||||
|
NICK="${${${=LINE#:}[1]%\!*}#:}"
|
||||||
|
CHAN="${${=LINE#:}[3]}"
|
||||||
|
RANDS=($RANDOM $RANDOM)
|
||||||
|
[ -z $colormap["$NICK"] ] && colormap["$NICK"]=${(%)$(<<< %F\{$(( $RANDS[1] % 6 + 1 ))\} )}
|
||||||
|
[ -z $colormap["$CHAN"] ] && colormap["$CHAN"]=${(%)$(<<< %F\{$(( $RANDS[2] % 6 + 1 ))\} )}
|
||||||
|
<<< "${colormap["$CHAN"]}${(l:10:)${CHAN}:0:10}${(%)$(<<< %F\{default\})} | ${colormap["$NICK"]}${(l:14:)${NICK}:0:14}${(%)$(<<< %F\{default\})} | ${${=LINE#:}[4,-1]#:}";
|
||||||
|
done
|
|
@ -2,8 +2,13 @@ local -a urls
|
||||||
local -a fetch
|
local -a fetch
|
||||||
local page=0
|
local page=0
|
||||||
while [ ${page} -eq 0 ] || [ ${#fetch} -eq 100 ]; do
|
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"))
|
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)
|
urls+=($fetch)
|
||||||
page=$(($page + 1))
|
page=$(($page + 1))
|
||||||
done
|
done
|
||||||
[ ${#urls} -gt 0 ] && curl -L\# --remote-name-all $urls
|
if [[ $2 == "mpv" ]]; then
|
||||||
|
[ ${#urls} -gt 0 ] && mpv --loop $urls
|
||||||
|
else
|
||||||
|
[ ${#urls} -gt 0 ] && curl -RL\#C - --remote-name-all $urls
|
||||||
|
fi
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
busctl call --no-pager --user org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player OpenUri s "$1"
|
local REPLY
|
||||||
|
zsocket ~/.mpvsock 2>/dev/null || return
|
||||||
|
print -u $REPLY "loadfile $@"
|
||||||
|
exec {REPLY}>&-
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ffmpeg -hwaccel vdpau -y -filter_threads 4 -v warning -thread_queue_size 8 -f pulse -i default -video_size 1920x1080 -framerate 60 -thread_queue_size 8 -f x11grab -i :0 -c:v h264 -crf 30 -preset ultrafast -movflags +faststart -tune zerolatency $1
|
|
@ -0,0 +1,2 @@
|
||||||
|
([ -z $1 ] || [ -z $2 ]) && return
|
||||||
|
printf "PRIVMSG %s :%s\r\n" "$1" "${argv[2,-1]}"
|
|
@ -1,10 +1,13 @@
|
||||||
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/sudo/sudo.plugin.zsh
|
# https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/sudo/sudo.plugin.zsh
|
||||||
sudo-command-line() {
|
sudo-command-line() {
|
||||||
[[ -z $BUFFER ]] && zle up-history
|
[[ -z $BUFFER ]] && zle up-history
|
||||||
if [[ $BUFFER == sudo\ * ]]; then
|
local rootcmd
|
||||||
LBUFFER="${LBUFFER#sudo }"
|
[ -v commands\[sudo\] ] && rootcmd=sudo
|
||||||
|
[ -v commands\[doas\] ] && rootcmd=doas
|
||||||
|
if [[ $BUFFER == $rootcmd\ * ]]; then
|
||||||
|
LBUFFER="${LBUFFER#$rootcmd }"
|
||||||
else
|
else
|
||||||
LBUFFER="sudo $LBUFFER"
|
LBUFFER="$rootcmd $LBUFFER"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
zle -N sudo-command-line
|
zle -N sudo-command-line
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
local REPLY
|
local REPLY
|
||||||
zstyle -s ':custom:prompts:weather' location 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": {"min": .min_temp, "max": .max_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, "icon": .weather_state_abbr}')
|
||||||
if [ ! -z $result ]; then
|
if [ ! -z $result ]; then
|
||||||
local ico=$(print $result | jq -r '.icon')
|
local ico=$(print $result | jq -r '.icon')
|
||||||
typeset -g _cprompts_weather=($(jq -r '.temp.min' <<< $result) $(jq -r '.temp.max' <<< $result) ${colors[$ico]:-white} ${icons[${ico:-X}]})
|
typeset -g _cprompts_weather=($(( int(rint($(jq -r '.temp' <<< $result))) )) ${colors[$ico]:-white} ${icons[${ico:-X}]})
|
||||||
print ${_cprompts_weather} > $tmpfile
|
print ${_cprompts_weather} > $tmpfile
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
ROOT=~/IRC
|
||||||
|
[ -r $ROOT ] || return
|
||||||
|
for i in $ROOT/*/channels/*; do
|
||||||
|
if [ ${stats[1]:-0} -lt $(($epochtime[1]-86400)) ]; then
|
||||||
|
done
|
|
@ -0,0 +1,6 @@
|
||||||
|
local REPLY
|
||||||
|
zstyle -s ':custom:prompts:mpv' socket REPLY
|
||||||
|
[ -S $REPLY ] && zsocket $REPLY 2>/dev/null || return
|
||||||
|
_cprompts_mpv[2]="${${$(print -u $REPLY '{ "command": ["get_property", "media-title"] }' && read -eEu $REPLY)#*\"data\"([^[:print:]])#:([^[:print:]])#\"}%%(\"~\\\")*}"
|
||||||
|
exec {REPLY}>&-
|
||||||
|
[ -z $_cprompts_mpv[2] ] || p10k segment -b magenta -i '' -t "${_cprompts_mpv[2]}"
|
|
@ -1,6 +0,0 @@
|
||||||
local REPLY
|
|
||||||
zsocket ~/.mpvsock 2>/dev/null || return
|
|
||||||
typeset -ga _cprompts_mpv=($REPLY)
|
|
||||||
_cprompts_mpv[2]="${${$(print -u $_cprompts_mpv[1] '{ "command": ["get_property", "media-title"] }' && read -Eu $_cprompts_mpv[1])#*\"data\"([^[:print:]])#:([^[:print:]])#\"}%%(\"~\\\")*}"
|
|
||||||
exec {REPLY}>&-
|
|
||||||
[ -z $_cprompts_mpv[2] ] || p10k segment -b magenta -i '' -t "${_cprompts_mpv[2]:0:20}$([ ${#_cprompts_mpv[2]} -gt 20 ] && print ...)"
|
|
|
@ -1,4 +1,6 @@
|
||||||
local new_mails=(~/Mail/*/Inbox/new/*(.N))
|
local REPLY
|
||||||
|
zstyle -s ':custom:prompts:mail' glob REPLY
|
||||||
|
local new_mails=(${~REPLY}(.N))
|
||||||
typeset -g _cprompts_mail_count=${#new_mails}
|
typeset -g _cprompts_mail_count=${#new_mails}
|
||||||
[[ ${_cprompts_mail_count} -gt 0 ]] || return
|
[[ ${_cprompts_mail_count} -gt 0 ]] || return
|
||||||
p10k segment -b yellow -i '' -t "${_cprompts_mail_count:-unknown}"
|
p10k segment -b yellow -i '' -t "${_cprompts_mail_count:-unknown}"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[ -v commands\[sqlite3\] ] || return
|
[ -v commands\[sqlite3\] ] || return
|
||||||
local newsboatdb=~/.newsboat/cache.db
|
local REPLY
|
||||||
|
zstyle -s ':custom:prompts:newsboat' database REPLY
|
||||||
if [ ! -v _cprompts_newsboat ]; then
|
if [ ! -v _cprompts_newsboat ]; then
|
||||||
typeset -g _cprompts_newsboat="$(sqlite3 ${newsboatdb} --ascii 'SELECT COUNT(id) FROM rss_item WHERE unread == 1 AND guid GLOB "yt:video:*"')"
|
typeset -g _cprompts_newsboat="$(sqlite3 $REPLY --ascii 'SELECT COUNT(id) FROM rss_item WHERE unread == 1 AND guid GLOB "yt:video:*"')"
|
||||||
fi
|
fi
|
||||||
p10k segment -b red -i '' -t "${_cprompts_newsboat}"
|
p10k segment -b red -i '' -t "${_cprompts_newsboat}"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
local -a stats
|
local -a stats
|
||||||
zstat -A stats +mtime -- todo.txt 2>/dev/null
|
zstat -A stats +mtime -- todo.txt 2>/dev/null
|
||||||
if [ ! -v _cprompts_todo ] || [ $_cprompts_todo[4] -ne $stats[1] ]; then
|
if [ ! -v _cprompts_todo ] || [ $_cprompts_todo[4] -ne $stats[1] ]; then
|
||||||
local todofi=(${(f@)${mapfile[todo.txt]}})
|
local todofi=(${(f@)$(< todo.txt)})
|
||||||
local t_nf=0
|
local t_nf=0
|
||||||
local t_f=0
|
local t_f=0
|
||||||
local colors=(red yellow green)
|
local colors=(red yellow green)
|
||||||
|
|
|
@ -28,10 +28,10 @@ colors[sn]="white"
|
||||||
|
|
||||||
if [ ! -v _cprompts_weather ]; then
|
if [ ! -v _cprompts_weather ]; then
|
||||||
zstat -A stats +mtime -- $tmpfile 2>/dev/null
|
zstat -A stats +mtime -- $tmpfile 2>/dev/null
|
||||||
if [ ${stats[1]:-0} -lt $(($epochtime[1]-21600)) ]; then
|
if [ ${stats[1]:-0} -lt $(($epochtime[1]-3600)) ]; then
|
||||||
cprompts:cache:async:weather &!
|
cprompts:cache:async:weather &!
|
||||||
else
|
else
|
||||||
typeset -g _cprompts_weather=($(< $tmpfile))
|
typeset -g _cprompts_weather=($(< $tmpfile))
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
[ -v _cprompts_weather ] && p10k segment -b ${_cprompts_weather[3]:-white} -i ${_cprompts_weather[4]:-\?} -t "${_cprompts_weather[1]:-unknown} - ${_cprompts_weather[2]:-unknown}"
|
[ -v _cprompts_weather ] && p10k segment -b ${_cprompts_weather[2]:-white} -i ${_cprompts_weather[3]:-\?} -t "${_cprompts_weather[1]:-unknown}"
|
||||||
|
|
|
@ -4,7 +4,6 @@ source ${ZDOTDIR}/powerlevel-config/dir.zsh
|
||||||
source ${ZDOTDIR}/powerlevel-config/disk.zsh
|
source ${ZDOTDIR}/powerlevel-config/disk.zsh
|
||||||
source ${ZDOTDIR}/powerlevel-config/misc.zsh
|
source ${ZDOTDIR}/powerlevel-config/misc.zsh
|
||||||
source ${ZDOTDIR}/powerlevel-config/prompt-char.zsh
|
source ${ZDOTDIR}/powerlevel-config/prompt-char.zsh
|
||||||
source ${ZDOTDIR}/powerlevel-config/prompt-elements.zsh
|
|
||||||
source ${ZDOTDIR}/powerlevel-config/separators.zsh
|
source ${ZDOTDIR}/powerlevel-config/separators.zsh
|
||||||
source ${ZDOTDIR}/powerlevel-config/status.zsh
|
source ${ZDOTDIR}/powerlevel-config/status.zsh
|
||||||
source ${ZDOTDIR}/powerlevel-config/time.zsh
|
source ${ZDOTDIR}/powerlevel-config/time.zsh
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
typeset -g POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
|
|
||||||
os_icon
|
|
||||||
time
|
|
||||||
battery
|
|
||||||
disk_usage
|
|
||||||
ssh
|
|
||||||
root_indicator
|
|
||||||
vim_shell
|
|
||||||
newline
|
|
||||||
vi_mode
|
|
||||||
status
|
|
||||||
dir
|
|
||||||
dir_writable
|
|
||||||
)
|
|
||||||
typeset -g POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
|
|
||||||
if [ ! -v SSH_CONNECTION ]; then
|
|
||||||
zmodload zsh/mapfile # Required by the todo segment, is way faster
|
|
||||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(
|
|
||||||
c_mpv_mpris
|
|
||||||
c_todo
|
|
||||||
c_new_mail
|
|
||||||
c_sfeed
|
|
||||||
# c_newsboat
|
|
||||||
# c_mumble
|
|
||||||
c_weather
|
|
||||||
c_covid_19
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS+=(
|
|
||||||
newline
|
|
||||||
command_execution_time
|
|
||||||
background_jobs
|
|
||||||
vcs
|
|
||||||
)
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6c9d0977a6378239f4153f5d3700bc5f70b36c3d
|
Subproject commit 71b39f0da9236acb1323f2833e7cec3ef3eda365
|
|
@ -16,25 +16,25 @@ export LESS_TERMCAP_us=$'\e[01;32m'
|
||||||
setopt appendhistory autocd auto_param_slash c_bases extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space share_history nobeep
|
setopt appendhistory autocd auto_param_slash c_bases extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space share_history nobeep
|
||||||
|
|
||||||
if [[ -r "${ZDOTDIR}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]]; then
|
if [[ -r "${ZDOTDIR}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ]]; then
|
||||||
source ${ZDOTDIR}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
||||||
typeset -g ZSH_HIGHLIGHT_HIGHLIGHTERS=(
|
typeset -g ZSH_HIGHLIGHT_HIGHLIGHTERS=(
|
||||||
main
|
main
|
||||||
brackets
|
brackets
|
||||||
pattern
|
pattern
|
||||||
cursor
|
cursor
|
||||||
)
|
)
|
||||||
|
source ${ZDOTDIR}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -r "${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh" ]]; then
|
if [[ -r "${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh" ]]; then
|
||||||
source ${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh
|
|
||||||
typeset -g ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
typeset -g ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||||
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=true
|
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=true
|
||||||
|
source ${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zstyle -s ':custom:preferences' prompt REPLY
|
zstyle -s ':custom:preferences' prompt _cur_prompt
|
||||||
if [[ $REPLY == "p9k" ]] && [[ -r "${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme" ]]; then
|
if [[ $_cur_prompt == "p9k" ]] && [[ -r "${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme" ]]; then
|
||||||
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
|
|
||||||
source ${ZDOTDIR}/powerlevel-config/all.zsh
|
source ${ZDOTDIR}/powerlevel-config/all.zsh
|
||||||
|
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
|
||||||
else
|
else
|
||||||
autoload -Uz promptinit
|
autoload -Uz promptinit
|
||||||
promptinit
|
promptinit
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit fb929edc30192407a9298aad64f55ca1b19a464e
|
Subproject commit 62c5575848f1f0a96161243d18497c247c9f52df
|
Loading…
Reference in New Issue