2016-12-31 05:06:36 +00:00
|
|
|
#compdef polybar
|
|
|
|
#
|
2019-05-06 11:51:49 +00:00
|
|
|
# Completion for polybar (https://github.com/polybar/polybar)
|
2016-12-31 05:06:36 +00:00
|
|
|
# jaagr <c@rlberg.se>
|
|
|
|
#
|
|
|
|
_polybar() {
|
2017-01-13 06:27:49 +00:00
|
|
|
local L='-l --log'
|
|
|
|
local Q='-q --quiet'
|
|
|
|
local C='-c --config'
|
|
|
|
local R='-r --reload'
|
|
|
|
local D='-d --dump'
|
|
|
|
local M='-m --list-monitors'
|
2019-06-24 15:58:40 +00:00
|
|
|
local MM='-M --list-all-monitors'
|
2017-01-13 06:27:49 +00:00
|
|
|
local W='-w --print-wmname'
|
|
|
|
local S='-s --stdout'
|
|
|
|
|
2016-12-31 05:06:36 +00:00
|
|
|
_arguments -n : \
|
2017-01-13 06:27:49 +00:00
|
|
|
'(-)'{-h,--help}'[Display help text and exit]' \
|
|
|
|
'(-)'{-v,--version}'[Display build details and exit]' \
|
2020-04-21 22:12:08 +00:00
|
|
|
"($L $Q)"{-l,--log=}'[Set the logging verbosity (default: notice)]:verbosity level:(error warning notice info trace)' \
|
2017-01-13 06:27:49 +00:00
|
|
|
"($L $Q)"{-q,--quiet}'[Be quiet (will override -l)]' \
|
|
|
|
"($C)"{-c,--config=}'[Path to the configuration file]:configuration file:_files' \
|
|
|
|
"($R)"{-r,--reload}'[Reload when the configuration has been modified]' \
|
|
|
|
"($D $R $M $W $S)"{-d,--dump=}'[Print parameter value in bar section and exit]:parameter name' \
|
2019-06-30 13:31:06 +00:00
|
|
|
"($MM $M $D $R $W $S)"{-m,--list-monitors}'[Print list of available monitors (Excluding cloned monitors) and exit]' \
|
2019-06-24 15:58:40 +00:00
|
|
|
"($MM $M $D $R $W $S)"{-M,--list-all-monitors}'[Print list of all available monitors (Including cloned monitors) and exit]' \
|
2017-01-13 06:27:49 +00:00
|
|
|
"($W $R $D $M $S)"{-w,--print-wmname}'[Print the generated WM_NAME and exit]' \
|
|
|
|
"($S)"{-s,--stdout}'[Output data to stdout instead of drawing the X window]' \
|
2017-01-13 05:01:20 +00:00
|
|
|
'::bar name:_polybar_list_names'
|
2016-12-31 05:06:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
(( $+functions[_polybar_list_names] )) || _polybar_list_names() {
|
|
|
|
local conf
|
|
|
|
if (( $+opt_args[-c] )); then
|
|
|
|
conf=${(e)opt_args[-c]}
|
|
|
|
elif (( $+opt_args[--config] )); then
|
|
|
|
conf=${(e)opt_args[--config]}
|
|
|
|
else
|
|
|
|
conf=${XDG_CONFIG_HOME:-$HOME/.config}/polybar/config
|
|
|
|
fi
|
|
|
|
local names; names=(${(f)"$(sed -nr 's|\[bar/([^\]+)\]$|\1|p' ${conf} 2>/dev/null)"})
|
|
|
|
_describe -t names 'configuration name' names
|
|
|
|
}
|
|
|
|
|
|
|
|
_polybar "$@"
|