mirror of
https://github.com/vale981/bspwm
synced 2025-03-06 02:01:42 -05:00
Bash completion: first cut
This commit is contained in:
parent
51206461ee
commit
978f655c7e
3 changed files with 47 additions and 0 deletions
4
Makefile
4
Makefile
|
@ -9,6 +9,7 @@ LDFLAGS = -L$(PREFIX)/lib
|
|||
PREFIX ?= /usr/local
|
||||
BINPREFIX = $(PREFIX)/bin
|
||||
MANPREFIX = $(PREFIX)/share/man
|
||||
CPLPREFIX = $(PREFIX)/usr/share/bash-completion/completions
|
||||
|
||||
WM_SRC = bspwm.c events.c messages.c ewmh.c settings.c helpers.c tree.c types.c rules.c window.c
|
||||
WM_OBJ = $(WM_SRC:.c=.o)
|
||||
|
@ -40,10 +41,13 @@ install:
|
|||
cp -p bsp{wm,c} "$(DESTDIR)$(BINPREFIX)"
|
||||
mkdir -p "$(DESTDIR)$(MANPREFIX)"/man1
|
||||
cp -p bspwm.1 "$(DESTDIR)$(MANPREFIX)"/man1
|
||||
mkdir -p "$(DESTDIR)$(CPLPREFIX)"
|
||||
cp -p bash_completion "$(DESTDIR)$(CPLPREFIX)"/bspc
|
||||
|
||||
uninstall:
|
||||
rm -f "$(DESTDIR)$(BINPREFIX)"/bsp{wm,c}
|
||||
rm -f "$(DESTDIR)$(MANPREFIX)"/man1/bspwm.1
|
||||
rm -f "$(DESTDIR)$(CPLPREFIX)"/bspc
|
||||
|
||||
clean:
|
||||
rm -f $(WM_OBJ) $(CL_OBJ) bsp{wm,c}
|
||||
|
|
29
bash_completion
Normal file
29
bash_completion
Normal file
|
@ -0,0 +1,29 @@
|
|||
_bspc()
|
||||
{
|
||||
local messages='get set list list_desktops list_monitors list_windows list_rules presel cancel ratio pad focus shift swap push pull cycle nearest circulate grab_pointer track_pointer ungrab_pointer toggle_fullscreen toggle_floating toggle_locked toggle_visibility close kill send_to drop_to send_to_monitor drop_to_monitor use use_monitor alternate alternate_desktop alternate_monitor add add_in rename_monitor rename cycle_monitor cycle_desktop layout cycle_layout rotate flip balance rule remove_rule put_status adopt_orphans restore quit'
|
||||
|
||||
local settings='focused_border_color active_border_color normal_border_color presel_border_color focused_locked_border_color active_locked_border_color normal_locked_border_color urgent_border_color border_width window_gap split_ratio top_padding right_padding bottom_padding left_padding wm_name borderless_monocle gapless_monocle focus_follows_pointer adaptative_raise apply_shadow_property auto_alternate'
|
||||
|
||||
COMPREPLY=()
|
||||
|
||||
if [[ $COMP_CWORD -ge 1 ]] ; then
|
||||
local current_word="${COMP_WORDS[COMP_CWORD]}"
|
||||
if [[ $COMP_CWORD -eq 1 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "$messages" -- "$current_word") )
|
||||
return 0
|
||||
else
|
||||
local second_word=${COMP_WORDS[1]}
|
||||
case $second_word in
|
||||
set|get)
|
||||
if [[ $COMP_CWORD -eq 2 ]] ; then
|
||||
COMPREPLY=( $(compgen -W "$settings" -- "$current_word") )
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
complete -F _bspc bspc
|
||||
|
||||
# vim: set ft=sh:
|
14
examples/misc/getdoc
Executable file
14
examples/misc/getdoc
Executable file
|
@ -0,0 +1,14 @@
|
|||
#! /bin/sh
|
||||
|
||||
case $1 in
|
||||
messages)
|
||||
secstart=Messages
|
||||
secend=Settings
|
||||
;;
|
||||
settings)
|
||||
secstart=Settings
|
||||
secend=Environment
|
||||
;;
|
||||
esac
|
||||
|
||||
awk '/## '$secstart'/, /## '$secend'/ { if (match($0, /- `([^`]+)`/, grp)) print grp[1] }' README.md
|
Loading…
Add table
Reference in a new issue