feat(zsh): Compdef for polybar-msg
This commit is contained in:
parent
99e432cae7
commit
cabdb4f8d5
@ -1,7 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Zsh completion template
|
# Zsh completion template
|
||||||
#
|
#
|
||||||
|
install(FILES _polybar _polybar_msg
|
||||||
install(FILES _polybar
|
|
||||||
DESTINATION share/zsh/site-functions
|
DESTINATION share/zsh/site-functions
|
||||||
COMPONENT tools)
|
COMPONENT tools)
|
||||||
|
32
doc/zsh/_polybar_msg
Normal file
32
doc/zsh/_polybar_msg
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#compdef polybar-msg
|
||||||
|
#
|
||||||
|
# Completion for polybar-msg (https://github.com/jaagr/polybar)
|
||||||
|
# jaagr <c@rlberg.se>
|
||||||
|
#
|
||||||
|
_polybar_msg() {
|
||||||
|
integer ret=1
|
||||||
|
|
||||||
|
_arguments -n : \
|
||||||
|
'-p[Process id of target instance]:process id:_polybar_msg_pids' \
|
||||||
|
'(-p)1:message type:(action cmd hook)' \
|
||||||
|
'*:: :->args'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
args)
|
||||||
|
case $words[1] in
|
||||||
|
hook) _arguments ':module name:' ':hook index:'; ret=0 ;;
|
||||||
|
action) _arguments ':action payload:'; ret=0 ;;
|
||||||
|
cmd) _arguments ':command payload:'; ret=0 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
(( $+functions[_polybar_msg_pids] )) || _polybar_msg_pids() {
|
||||||
|
local pids; pids=(${(f)"$(ls -1 /tmp/polybar_mqueue.* | egrep -o '[0-9]+$')"})
|
||||||
|
_describe -t pids 'process id of target instance' pids
|
||||||
|
}
|
||||||
|
|
||||||
|
_polybar_msg "$@"
|
Loading…
Reference in New Issue
Block a user