Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,29 @@ install(TARGETS ydotool DESTINATION ${CMAKE_INSTALL_BINDIR})

add_subdirectory(Daemon)
add_subdirectory(manpage)

# Install bash completion scripts
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/completions/ydotool-completion.bash
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
RENAME ydotool
)

install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/completions/ydotoold-completion.bash
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
RENAME ydotoold
)

# Install zsh completion scripts
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/completions/ydotool-completion.zsh
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
RENAME _ydotool
)

install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/completions/ydotoold-completion.zsh
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
RENAME _ydotoold
)
11 changes: 11 additions & 0 deletions completions/ydotool-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# bash completion for ydotool -*- shell-script -*-

_ydotool_completions() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local options="-h --help click mousemove type key debug bakers stdin"
COMPREPLY=($(compgen -W "$options" -- "$cur"))
}

complete -F _ydotool_completions ydotool

# ex: ts=4 sw=4 et filetype=sh
12 changes: 12 additions & 0 deletions completions/ydotool-completion.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#compdef ydotool

_ydotool() {
local -a commands
commands=(click mousemove type key debug bakers stdin)

_arguments \
'(-h --help)'{-h,--help}'[Show help message]' \
'1:command:_values "commands" $commands[@]'
}

_ydotool "$@"
11 changes: 11 additions & 0 deletions completions/ydotoold-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# bash completion for ydotoold -*- shell-script -*-

_ydotoold_completions() {
local cur="${COMP_WORDS[COMP_CWORD]}"
local options="-h --help -V --version -p --socket-path -P --socket-perm -m --mouse-off -k --keyboard-off -T --touch-on"
COMPREPLY=($(compgen -W "$options" -- "$cur"))
}

complete -F _ydotoold_completions ydotoold

# ex: ts=4 sw=4 et filetype=sh
15 changes: 15 additions & 0 deletions completions/ydotoold-completion.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#compdef ydotoold

_ydotoold() {
_arguments \
'(-h --help)'{-h,--help}'[Display help and exit]' \
'(-V --version)'{-V,--version}'[Show version information]' \
'(-p --socket-path)'{-p,--socket-path}'[Custom socket path]:path:_files' \
'(-P --socket-perm)'{-P,--socket-perm}'[Socket permission (default 0600)]:permission:' \
'(-o --socket-own)'{-o,--socket-own}'[Socket ownership]:ownership:' \
'(-m --mouse-off)'{-m,--mouse-off}'[Disable mouse (EV_REL)]' \
'(-k --keyboard-off)'{-k,--keyboard-off}'[Disable keyboard (EV_KEY)]' \
'(-T --touch-on)'{-T,--touch-on}'[Enable touchscreen (EV_ABS)]'
}

_ydotoold "$@"