File: _polybar_msg

package info (click to toggle)
polybar 3.7.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,108 kB
  • sloc: cpp: 30,424; python: 3,750; sh: 284; makefile: 83
file content (32 lines) | stat: -rw-r--r-- 828 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#compdef polybar-msg
#
# Completion for polybar-msg (https://github.com/polybar/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:(show hide toggle restart quit)'; 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 "$@"