diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-01-19 18:50:12 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-01-19 18:50:12 -0500 |
commit | a6b19988c54272dbd9366a7e8fa6b8c459541cb6 (patch) | |
tree | 5991fa5cb3c5003b003952365356ad123d3048d4 | |
parent | Merge pull request #448 from colemickens/libinput (diff) | |
parent | added basic zsh shell completion for sway, swaybg, and swaygrab (diff) | |
download | sway-a6b19988c54272dbd9366a7e8fa6b8c459541cb6.tar.gz sway-a6b19988c54272dbd9366a7e8fa6b8c459541cb6.tar.zst sway-a6b19988c54272dbd9366a7e8fa6b8c459541cb6.zip |
Merge pull request #440 from SethBarberee/zsh-completions
Basic Zsh auto-completion for --options
-rw-r--r-- | CMakeLists.txt | 5 | ||||
-rw-r--r-- | completions/zsh/CMakeLists.txt | 4 | ||||
-rw-r--r-- | completions/zsh/_sway | 28 | ||||
-rw-r--r-- | completions/zsh/_swaygrab | 28 | ||||
-rw-r--r-- | completions/zsh/_swaymsg | 26 |
5 files changed, 90 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4620ff54..db019083 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -45,6 +45,7 @@ option(enable-swaygrab "Enables the swaygrab utility" YES) | |||
45 | option(enable-swaymsg "Enables the swaymsg utility" YES) | 45 | option(enable-swaymsg "Enables the swaymsg utility" YES) |
46 | option(enable-gdk-pixbuf "Use Pixbuf to support more image formats" YES) | 46 | option(enable-gdk-pixbuf "Use Pixbuf to support more image formats" YES) |
47 | option(enable-binding-event "Enables binding event subscription" YES) | 47 | option(enable-binding-event "Enables binding event subscription" YES) |
48 | option(zsh-completions "Zsh shell completions" YES) | ||
48 | option(default-wallpaper "Installs the default wallpaper" YES) | 49 | option(default-wallpaper "Installs the default wallpaper" YES) |
49 | 50 | ||
50 | find_package(JsonC REQUIRED) | 51 | find_package(JsonC REQUIRED) |
@@ -120,7 +121,9 @@ if(enable-swaylock) | |||
120 | message(WARNING "Not building swaylock - cairo, pango, and PAM are required.") | 121 | message(WARNING "Not building swaylock - cairo, pango, and PAM are required.") |
121 | endif() | 122 | endif() |
122 | endif() | 123 | endif() |
123 | 124 | if(zsh-completions) | |
125 | add_subdirectory(completions/zsh) | ||
126 | endif() | ||
124 | install( | 127 | install( |
125 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/sway.desktop | 128 | FILES ${CMAKE_CURRENT_SOURCE_DIR}/sway.desktop |
126 | DESTINATION share/wayland-sessions | 129 | DESTINATION share/wayland-sessions |
diff --git a/completions/zsh/CMakeLists.txt b/completions/zsh/CMakeLists.txt new file mode 100644 index 00000000..561636f2 --- /dev/null +++ b/completions/zsh/CMakeLists.txt | |||
@@ -0,0 +1,4 @@ | |||
1 | install( | ||
2 | FILES _sway _swaymsg _swaygrab | ||
3 | DESTINATION share/zsh/site-functions/ | ||
4 | ) | ||
diff --git a/completions/zsh/_sway b/completions/zsh/_sway new file mode 100644 index 00000000..a9b1a14f --- /dev/null +++ b/completions/zsh/_sway | |||
@@ -0,0 +1,28 @@ | |||
1 | #compdef sway | ||
2 | #------------ | ||
3 | # Description | ||
4 | # ----------- | ||
5 | # | ||
6 | # Completion script for the sway window manager (http://swaywm.org) | ||
7 | # | ||
8 | # --------------------------------------------- | ||
9 | # Author | ||
10 | # ------- | ||
11 | # | ||
12 | # * Seth Barberee <seth.barberee@gmail.com> | ||
13 | # | ||
14 | # ------------------------------- | ||
15 | |||
16 | _sway() { | ||
17 | local -a options | ||
18 | options=('--version:shows version' | ||
19 | '--help:shows help message' | ||
20 | '--config:Specify a config file different than $HOME/.config/sway/config' | ||
21 | '--validate:Check validity of the config file, then exit' | ||
22 | '--debug:Enables full logging, including debug information' | ||
23 | '--verbose:Enables more verbose logging' | ||
24 | '--get-socketpath:Gets the IPC socket path and prints it, then exits' | ||
25 | ) | ||
26 | _describe 'values' options | ||
27 | } | ||
28 | _sway "$@" | ||
diff --git a/completions/zsh/_swaygrab b/completions/zsh/_swaygrab new file mode 100644 index 00000000..64d9d2c8 --- /dev/null +++ b/completions/zsh/_swaygrab | |||
@@ -0,0 +1,28 @@ | |||
1 | #compdef swaygrab | ||
2 | #----------------- | ||
3 | # Description | ||
4 | # ----------- | ||
5 | # | ||
6 | # Completion script for swaygrab in the sway wm (http://swaywm.org) | ||
7 | # | ||
8 | # ----------------------------------------------------- | ||
9 | # Author | ||
10 | # ------ | ||
11 | # | ||
12 | # * Seth Barberee <seth.barberee@gmail.com> | ||
13 | # | ||
14 | # ------------------------------------------ | ||
15 | |||
16 | _swaygrab() { | ||
17 | local -a options | ||
18 | options=('--version:shows version' | ||
19 | '--help:shows help message' | ||
20 | '--capture:Captures multiple frames as video as passes into ffmpeg until SIGTERM (ctrl+c) is sent to swaygrab' | ||
21 | '--output:Use the specified output. If no output is defined, the currently focused output in sway is used' | ||
22 | '--socket:Use the specified socket path. Otherwise, swayuses $SWAYSOCK then $I3SOCK' | ||
23 | '--rate:Specify a framerate (in fps). Used in combination with -c. Default is 30 and must be an integer' | ||
24 | '--raw:Instead of ImageMagick or ffmpeg, dump raw rgba data to stdout' | ||
25 | ) | ||
26 | _describe 'values' options | ||
27 | } | ||
28 | _swaygrab "$@" | ||
diff --git a/completions/zsh/_swaymsg b/completions/zsh/_swaymsg new file mode 100644 index 00000000..5d9277c4 --- /dev/null +++ b/completions/zsh/_swaymsg | |||
@@ -0,0 +1,26 @@ | |||
1 | #compdef swaymsg | ||
2 | #----------------- | ||
3 | # Description | ||
4 | # ----------- | ||
5 | # | ||
6 | # Completion script for swaymsg in sway wm (http://swaywm.org) | ||
7 | # | ||
8 | # ------------------------------------------------------ | ||
9 | # Author | ||
10 | # -------- | ||
11 | # | ||
12 | # * Seth Barberee <seth.barberee@gmail.com> | ||
13 | # | ||
14 | # ------------------------------------------- | ||
15 | |||
16 | _swaymsg() { | ||
17 | local -a options | ||
18 | options=('--version:shows version' | ||
19 | '--help:shows help message' | ||
20 | '--quiet:sends the IPC message but does not print the response from sway' | ||
21 | '--socket:Use the specified socket path. Otherwise, swaymsg uses $SWAYSOCK then $I3SOCK' | ||
22 | '--type:Specify the type of IPC message. Tab completion still coming so use the man page instead' | ||
23 | ) | ||
24 | _describe 'values' options | ||
25 | } | ||
26 | _swaymsg "$@" | ||