mirror of
https://github.com/swaywm/sway.git
synced 2024-11-26 18:01:29 +00:00
Merge pull request #440 from SethBarberee/zsh-completions
Basic Zsh auto-completion for --options
This commit is contained in:
commit
a6b19988c5
|
@ -45,6 +45,7 @@ option(enable-swaygrab "Enables the swaygrab utility" YES)
|
||||||
option(enable-swaymsg "Enables the swaymsg utility" YES)
|
option(enable-swaymsg "Enables the swaymsg utility" YES)
|
||||||
option(enable-gdk-pixbuf "Use Pixbuf to support more image formats" YES)
|
option(enable-gdk-pixbuf "Use Pixbuf to support more image formats" YES)
|
||||||
option(enable-binding-event "Enables binding event subscription" YES)
|
option(enable-binding-event "Enables binding event subscription" YES)
|
||||||
|
option(zsh-completions "Zsh shell completions" YES)
|
||||||
option(default-wallpaper "Installs the default wallpaper" YES)
|
option(default-wallpaper "Installs the default wallpaper" YES)
|
||||||
|
|
||||||
find_package(JsonC REQUIRED)
|
find_package(JsonC REQUIRED)
|
||||||
|
@ -120,7 +121,9 @@ if(enable-swaylock)
|
||||||
message(WARNING "Not building swaylock - cairo, pango, and PAM are required.")
|
message(WARNING "Not building swaylock - cairo, pango, and PAM are required.")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
if(zsh-completions)
|
||||||
|
add_subdirectory(completions/zsh)
|
||||||
|
endif()
|
||||||
install(
|
install(
|
||||||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/sway.desktop
|
FILES ${CMAKE_CURRENT_SOURCE_DIR}/sway.desktop
|
||||||
DESTINATION share/wayland-sessions
|
DESTINATION share/wayland-sessions
|
||||||
|
|
4
completions/zsh/CMakeLists.txt
Normal file
4
completions/zsh/CMakeLists.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
install(
|
||||||
|
FILES _sway _swaymsg _swaygrab
|
||||||
|
DESTINATION share/zsh/site-functions/
|
||||||
|
)
|
28
completions/zsh/_sway
Normal file
28
completions/zsh/_sway
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#compdef sway
|
||||||
|
#------------
|
||||||
|
# Description
|
||||||
|
# -----------
|
||||||
|
#
|
||||||
|
# Completion script for the sway window manager (http://swaywm.org)
|
||||||
|
#
|
||||||
|
# ---------------------------------------------
|
||||||
|
# Author
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# * Seth Barberee <seth.barberee@gmail.com>
|
||||||
|
#
|
||||||
|
# -------------------------------
|
||||||
|
|
||||||
|
_sway() {
|
||||||
|
local -a options
|
||||||
|
options=('--version:shows version'
|
||||||
|
'--help:shows help message'
|
||||||
|
'--config:Specify a config file different than $HOME/.config/sway/config'
|
||||||
|
'--validate:Check validity of the config file, then exit'
|
||||||
|
'--debug:Enables full logging, including debug information'
|
||||||
|
'--verbose:Enables more verbose logging'
|
||||||
|
'--get-socketpath:Gets the IPC socket path and prints it, then exits'
|
||||||
|
)
|
||||||
|
_describe 'values' options
|
||||||
|
}
|
||||||
|
_sway "$@"
|
28
completions/zsh/_swaygrab
Normal file
28
completions/zsh/_swaygrab
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#compdef swaygrab
|
||||||
|
#-----------------
|
||||||
|
# Description
|
||||||
|
# -----------
|
||||||
|
#
|
||||||
|
# Completion script for swaygrab in the sway wm (http://swaywm.org)
|
||||||
|
#
|
||||||
|
# -----------------------------------------------------
|
||||||
|
# Author
|
||||||
|
# ------
|
||||||
|
#
|
||||||
|
# * Seth Barberee <seth.barberee@gmail.com>
|
||||||
|
#
|
||||||
|
# ------------------------------------------
|
||||||
|
|
||||||
|
_swaygrab() {
|
||||||
|
local -a options
|
||||||
|
options=('--version:shows version'
|
||||||
|
'--help:shows help message'
|
||||||
|
'--capture:Captures multiple frames as video as passes into ffmpeg until SIGTERM (ctrl+c) is sent to swaygrab'
|
||||||
|
'--output:Use the specified output. If no output is defined, the currently focused output in sway is used'
|
||||||
|
'--socket:Use the specified socket path. Otherwise, swayuses $SWAYSOCK then $I3SOCK'
|
||||||
|
'--rate:Specify a framerate (in fps). Used in combination with -c. Default is 30 and must be an integer'
|
||||||
|
'--raw:Instead of ImageMagick or ffmpeg, dump raw rgba data to stdout'
|
||||||
|
)
|
||||||
|
_describe 'values' options
|
||||||
|
}
|
||||||
|
_swaygrab "$@"
|
26
completions/zsh/_swaymsg
Normal file
26
completions/zsh/_swaymsg
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#compdef swaymsg
|
||||||
|
#-----------------
|
||||||
|
# Description
|
||||||
|
# -----------
|
||||||
|
#
|
||||||
|
# Completion script for swaymsg in sway wm (http://swaywm.org)
|
||||||
|
#
|
||||||
|
# ------------------------------------------------------
|
||||||
|
# Author
|
||||||
|
# --------
|
||||||
|
#
|
||||||
|
# * Seth Barberee <seth.barberee@gmail.com>
|
||||||
|
#
|
||||||
|
# -------------------------------------------
|
||||||
|
|
||||||
|
_swaymsg() {
|
||||||
|
local -a options
|
||||||
|
options=('--version:shows version'
|
||||||
|
'--help:shows help message'
|
||||||
|
'--quiet:sends the IPC message but does not print the response from sway'
|
||||||
|
'--socket:Use the specified socket path. Otherwise, swaymsg uses $SWAYSOCK then $I3SOCK'
|
||||||
|
'--type:Specify the type of IPC message. Tab completion still coming so use the man page instead'
|
||||||
|
)
|
||||||
|
_describe 'values' options
|
||||||
|
}
|
||||||
|
_swaymsg "$@"
|
Loading…
Reference in a new issue