]> git.lizzy.rs Git - bspwm.git/commitdiff
Minor fixes to zsh completions
authorJunak <vlypak@gmail.com>
Mon, 27 Aug 2018 22:44:01 +0000 (01:44 +0300)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 28 Aug 2018 18:18:29 +0000 (20:18 +0200)
contrib/zsh_completion

index d66b9b2f87157b7b75ab3b8be354de48f97e6c3b..5b663f7ed48f634e8a924ce280111218116aa41a 100644 (file)
@@ -98,6 +98,8 @@ _bspc_selector() {
                                -- completions $@ -S '.' -r ". \n:#${quote}\-" -J ${sel_type}
                        fi
                        ;|
+               (node*@*'#'*)
+                       ;;
                (node*@*)
                        _bspc_selector desktop -S ':' -qr ".#\-\n ${quote}"
                        ;;
@@ -312,11 +314,13 @@ _bspc() {
                                _describe 'match window class' completions -q -S ':'
                        ;;
                (config)
-                       local -a look behaviour input
-                       # Boolean settings are identified by index!
-                       look=(borderless_monocle gapless_monocle {normal,active,focused}_border_color {top,right,bottom,left}_padding presel_feedback_color border_width window_gap)
-                       behaviour=(single_monocle mapping_events_count ignore_ewmh_focus ignore_ewmh_fullscreen center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors status_prefix external_rules_command split_ratio initial_polarity directional_focus_tightness status_prefix)
-                       input=({swallow_first_click,focus_follows_pointer,pointer_follows_{focus,monitor}} click_to_focus pointer_motion_interval pointer_modifier pointer_action{1,2,3} )
+                       local -a {look,behaviour,input}{_bool,}
+                       look_bool=(borderless_monocle gapless_monocle)
+                       look=({normal,active,focused}_border_color {top,right,bottom,left}_padding presel_feedback_color border_width window_gap)
+                       behaviour_bool=(single_monocle ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors)
+                       behaviour=(mapping_events_count ignore_ewmh_fullscreen external_rules_command split_ratio initial_polarity directional_focus_tightness status_prefix)
+                       input_bool=(swallow_first_click focus_follows_pointer pointer_follows_{focus,monitor})
+                       input=(click_to_focus pointer_motion_interval pointer_modifier pointer_action{1,2,3})
                        if [[ "$CURRENT" == (2|3) ]];then
                                _arguments \
                                        '-d[Set settings for the selected desktop]: :_bspc_selector -- desktop'\
@@ -326,18 +330,19 @@ _bspc() {
                        if [[ "${words[2]}" == -* ]] ;then
                                (( CURRENT == 3 )) && return
                                if (( CURRENT > 3 )) ;then
-                                       ((CURRENT-=$#words))
-                                       words=('config' "${(@)words[4,-1]}")
-                                       ((CURRENT+=$#words))
+                                       compset -n 3
                                fi
                        fi
                        if ((CURRENT==2)) ;then
-                               _describe 'look' look -J look
-                               _describe 'input' input -J input
-                               _describe 'behaviour' behaviour -J behaviour
+                               _describe 'look' look -J look -- look_bool -J look
+                               _describe 'input' input -J input -- input_bool -J input
+                               _describe 'behaviour' behaviour -J behaviour -- behaviour_bool -J behaviour
                        elif ((CURRENT==3)) ;then
                                setting=$words[2]
                                case $setting in
+                                       (ignore_ewmh_fullscreen)
+                                               _values -S "," "set $setting" all none "enter:: :(exit)" "exit:: :(enter)"
+                                               ;;
                                        (initial_polarity)
                                                _values "set $setting" first_child second_child
                                                ;;
@@ -354,9 +359,9 @@ _bspc() {
                                                _values "set $setting" any button1 button2 button3 none
                                                ;;
                                        (*)
-                                               ((look[(i)$setting] <= 2)) ||
-                                                       ((behaviour[(i)$setting] <= 7)) ||
-                                                       ((input[(i)$setting] <= 4)) &&
+                                               [[ -n $look_bool[(r)$setting] ]] ||
+                                                       [[ -n $behaviour_bool[(r)$setting] ]] ||
+                                                       [[ -n $input_bool[(r)$setting] ]] &&
                                                        _values "set $setting" true false
                                                ;;
                                esac