]> git.lizzy.rs Git - bspwm.git/commitdiff
Add fish shell completion.
authorNathan Isom <nathanisom27@gmail.com>
Wed, 11 May 2016 21:59:01 +0000 (16:59 -0500)
committerNathan Isom <nathanisom27@gmail.com>
Wed, 11 May 2016 21:59:01 +0000 (16:59 -0500)
fixes #459.

Makefile
contrib/fish_completion [new file with mode: 0644]

index 41c833834d1fc0eb78b0cdf48f7b4077c13dd1c7..67bbea45c124ca79e9bfbb010d9e3fbb6f07b2dd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ BINPREFIX ?= $(PREFIX)/bin
 MANPREFIX ?= $(PREFIX)/share/man
 DOCPREFIX ?= $(PREFIX)/share/doc/bspwm
 BASHCPL   ?= $(PREFIX)/share/bash-completion/completions
+FISHCPL   ?= $(PREFIX)/share/fish/vendor_completions.d
 ZSHCPL    ?= $(PREFIX)/share/zsh/site-functions
 
 MD_DOCS    = README.md doc/CHANGELOG.md doc/CONTRIBUTING.md doc/INSTALL.md doc/MISC.md doc/TODO.md
@@ -43,6 +44,8 @@ install:
        cp -Pp doc/bspc.1 "$(DESTDIR)$(MANPREFIX)"/man1
        mkdir -p "$(DESTDIR)$(BASHCPL)"
        cp -p contrib/bash_completion "$(DESTDIR)$(BASHCPL)"/bspc
+       mkdir -p "$(DESTDIR)$(FISHCPL)"
+       cp -p contrib/fish_completion "$(DESTDIR)$(FISHCPL)"/bspc.fish
        mkdir -p "$(DESTDIR)$(ZSHCPL)"
        cp -p contrib/zsh_completion "$(DESTDIR)$(ZSHCPL)"/_bspc
        mkdir -p "$(DESTDIR)$(DOCPREFIX)"
@@ -57,6 +60,7 @@ uninstall:
        rm -f "$(DESTDIR)$(MANPREFIX)"/man1/bspwm.1
        rm -f "$(DESTDIR)$(MANPREFIX)"/man1/bspc.1
        rm -f "$(DESTDIR)$(BASHCPL)"/bspc
+       rm -f "$(DESTDIR)$(FISHCPL)"/bspc.fish
        rm -f "$(DESTDIR)$(ZSHCPL)"/_bspc
        rm -rf "$(DESTDIR)$(DOCPREFIX)"
        rm -f "$(DESTDIR)$(XSESSIONS)"/bspwm.desktop
diff --git a/contrib/fish_completion b/contrib/fish_completion
new file mode 100644 (file)
index 0000000..6488d11
--- /dev/null
@@ -0,0 +1,14 @@
+function __fish_bspc_needs_command
+  set cmd (commandline -opc)
+  [ (count $cmd) -eq 1 -a $cmd[1] = 'bspc' ]; and return 0
+  return 1
+end
+
+function __fish_bspc_using_command
+  set cmd (commandline -opc)
+  [ (count $cmd) -gt 1 ]; and [ $argv[1] = $cmd[2] ]; and return 0
+  return 1
+end
+
+complete -f -c bspc -n '__fish_bspc_needs_command' -a 'node desktop monitor query rule restore wm subscribe config quit'
+complete -f -c bspc -n '__fish_bspc_using_command config' -a 'external_rules_command status_prefix normal_border_color active_border_color focused_border_color presel_feedback_color border_width window_gap top_padding right_padding bottom_padding left_padding split_ratio initial_polarity borderless_monocle gapless_monocle single_monocle pointer_modifier pointer_action1 pointer_action2 pointer_action3 click_to_focus focus_follows_pointer pointer_follows_focus pointer_follows_monitor ignore_ewmh_focus center_pseudo_tiled honor_size_hints remove_disabled_monitors remove_unplugged_monitors merge_overlapping_monitors'