aboutsummaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2021-10-23 07:16:47 +0000
committerGitHub <noreply@github.com>2021-10-23 07:16:47 +0000
commit1df7dc5171abfe1eab3e95be964f61c5876198f1 (patch)
tree315ceaa093b86b8e875512825302f38e32f697a4 /extra
parentd8a98f88295e59d6518ae780a9857c033a83161c (diff)
downloadalacritty-1df7dc5171abfe1eab3e95be964f61c5876198f1.tar.gz
alacritty-1df7dc5171abfe1eab3e95be964f61c5876198f1.zip
Add multi-window support
Previously Alacritty would always initialize only a single terminal emulator window feeding into the winit event loop, however some platforms like macOS expect all windows to be spawned by the same process and this "daemon-mode" can also come with the advantage of increased memory efficiency. The event loop has been restructured to handle all window-specific events only by the event processing context with the associated window id. This makes it possible to add new terminal windows at any time using the WindowContext::new function call. Some preliminary tests have shown that for empty terminals, this reduces the cost of additional terminal emulators from ~100M to ~6M. However at this point the robustness of the daemon against issues with individual terminals has not been refined, making the reliability of this system questionable. New windows can be created either by using the new `CreateNewWindow` action, or with the `alacritty msg create-window` subcommand. The subcommand sends a message to an IPC socket which Alacritty listens on, its location can be found in the `ALACRITTY_SOCKET` environment variable. Fixes #607.
Diffstat (limited to 'extra')
-rw-r--r--extra/alacritty-msg.man31
-rw-r--r--extra/alacritty.man9
-rw-r--r--extra/completions/_alacritty74
-rw-r--r--extra/completions/alacritty.bash9
-rw-r--r--extra/completions/alacritty.fish62
5 files changed, 149 insertions, 36 deletions
diff --git a/extra/alacritty-msg.man b/extra/alacritty-msg.man
new file mode 100644
index 00000000..818169d0
--- /dev/null
+++ b/extra/alacritty-msg.man
@@ -0,0 +1,31 @@
+.TH ALACRITTY-MSG "1" "October 2021" "alacritty 0.10.0-dev" "User Commands"
+.SH NAME
+alacritty-msg \- Send messages to Alacritty
+.SH "SYNOPSIS"
+alacritty msg [OPTIONS] [MESSAGES]
+.SH DESCRIPTION
+This command communicates with running Alacritty instances through a socket,
+making it possible to control Alacritty without directly accessing it.
+.SH "OPTIONS"
+.TP
+\fB\-s\fR, \fB\-\-socket\fR <socket>
+Path for IPC socket creation
+.SH "MESSAGES"
+.TP
+\fBcreate-window\fR
+Create a new window in the same Alacritty process
+.SH "SEE ALSO"
+See the alacritty github repository at https://github.com/alacritty/alacritty for the full documentation.
+.SH "BUGS"
+Found a bug? Please report it at https://github.com/alacritty/alacritty/issues.
+.SH "MAINTAINERS"
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+Christian Duerr <contact@christianduerr.com>
diff --git a/extra/alacritty.man b/extra/alacritty.man
index fbc28c25..5ff0852e 100644
--- a/extra/alacritty.man
+++ b/extra/alacritty.man
@@ -2,7 +2,7 @@
.SH NAME
Alacritty \- A fast, cross-platform, OpenGL terminal emulator
.SH "SYNOPSIS"
-alacritty [FLAGS] [OPTIONS]
+alacritty [SUBCOMMANDS] [FLAGS] [OPTIONS]
.SH DESCRIPTION
Alacritty is a modern terminal emulator that comes with sensible defaults, but
allows for extensive configuration. By integrating with other applications,
@@ -57,11 +57,18 @@ Defines the X11 window ID (as a decimal integer) to embed Alacritty within
\fB\-o\fR, \fB\-\-option\fR <option>...
Override configuration file options [example: cursor.style=Beam]
.TP
+\fB\-\-socket\fR <socket>
+Path for IPC socket creation
+.TP
\fB\-t\fR, \fB\-\-title\fR <title>
Defines the window title [default: Alacritty]
.TP
\fB\-\-working\-directory\fR <working\-directory>
Start the shell in the specified working directory
+.SH "SUBCOMMANDS"
+.TP
+\fBmsg\fR
+Available socket messages
.SH "SEE ALSO"
See the alacritty github repository at https://github.com/alacritty/alacritty for the full documentation.
.SH "BUGS"
diff --git a/extra/completions/_alacritty b/extra/completions/_alacritty
index c97d563e..1313128e 100644
--- a/extra/completions/_alacritty
+++ b/extra/completions/_alacritty
@@ -1,20 +1,62 @@
#compdef alacritty
-local ign
+# Completions available for the first parameter.
+_alacritty_first_param() {
+ # Main subcommands.
+ _describe "command" "(msg:'Available socket messages')"
-(( $#words > 2 )) && ign='!'
+ # Default options.
+ _alacritty_main
+}
+
+# Completions available for parameters after the first.
+_alacritty_following_param() {
+ case $words[2] in
+ msg)
+ _alacritty_msg;;
+ *)
+ _alacritty_main;;
+ esac
+}
+
+# Completions for the main Alacritty executable.
+_alacritty_main() {
+ # Limit some suggestions to the first option.
+ local ignore
+ (( $#words > 2 )) && ignore='!'
+
+ _arguments \
+ "$ignore(-)"{-h,--help}"[print help information]" \
+ "$ignore(-)"{-V,--version}"[print version information]" \
+ "--print-events[print all events to stdout]" \
+ '(-v)'{-q,-qq}"[reduce the level of verbosity (min is -qq)]" \
+ "--ref-test[generate ref test]" \
+ "--hold[remain open after child process exits]" \
+ '(-q)'{-v,-vv,-vvv}"[increase the level of verbosity (max is -vvv)]" \
+ "--class=[define the window class]:class" \
+ "--embed=[define the X11 window ID (as a decimal integer) to embed Alacritty within]:windowId" \
+ "(-e --command)"{-e,--command}"[execute command (must be last arg)]:program: _command_names -e:*::program arguments: _normal" \
+ "--config-file=[specify an alternative config file]:file:_files" \
+ "*"{-o=,--option=}"[override config file options]:option" \
+ "(-t --title)"{-t=,--title=}"[define the window title]:title" \
+ "--working-directory=[start shell in specified directory]:directory:_directories"\
+ "--socket=[Path for IPC socket creation]:file:_files"
+}
+
+# Completions for the `msg` subcommand.
+_alacritty_msg() {
+ # Limit some suggestions to the first option.
+ local ignore
+ (( $#words > 3 )) && ignore='!'
+
+ _arguments \
+ "$ignore(-)"{-h,--help}"[print help information]" \
+ "$ignore(-)"{-V,--version}"[print version information]" \
+ "(-s --socket)"{-s=,--socket=}"[Path for IPC socket creation]:file:_files" \
+ "*: :((create-window:'Create a new window in the same Alacritty process'))"
+}
+
+# Handle arguments based on their position.
_arguments \
- "$ign(-)"{-h,--help}"[print help information]" \
- "--print-events[print all events to stdout]" \
- '(-v)'{-q,-qq}"[reduce the level of verbosity (min is -qq)]" \
- "--ref-test[generate ref test]" \
- "--hold[remain open after child process exits]" \
- '(-q)'{-v,-vv,-vvv}"[increase the level of verbosity (max is -vvv)]" \
- "$ign(-)"{-V,--version}"[print version information]" \
- "--class=[define the window class]:class" \
- "--embed=[define the X11 window ID (as a decimal integer) to embed Alacritty within]:windowId" \
- "(-e --command)"{-e,--command}"[execute command (must be last arg)]:program: _command_names -e:*::program arguments: _normal" \
- "--config-file=[specify an alternative config file]:file:_files" \
- "*"{-o=,--option=}"[override config file options]:option" \
- "(-t --title)"{-t=,--title=}"[define the window title]:title" \
- "--working-directory=[start shell in specified directory]:directory:_directories"
+ "1: :_alacritty_first_param" \
+ "*: :_alacritty_following_param"
diff --git a/extra/completions/alacritty.bash b/extra/completions/alacritty.bash
index e514126c..464afe6e 100644
--- a/extra/completions/alacritty.bash
+++ b/extra/completions/alacritty.bash
@@ -11,7 +11,7 @@ _alacritty()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
prevprev="${COMP_WORDS[COMP_CWORD-2]}"
- opts="-h --help -V --version --print-events -q -qq -v -vv -vvv --ref-test --hold -e --command --config-file -o --option -t --title --embed --class --working-directory"
+ opts="-h --help -V --version --print-events -q -qq -v -vv -vvv --ref-test --hold -e --command --config-file -o --option -t --title --embed --class --working-directory --socket msg"
# If `--command` or `-e` is used, stop completing
for i in "${!COMP_WORDS[@]}"; do
@@ -29,8 +29,8 @@ _alacritty()
# Complete all commands in $PATH
COMPREPLY=( $(compgen -c -- "${cur}") )
return 0;;
- --config-file)
- # Path based completion
+ --config-file | --socket)
+ # File completion
local IFS=$'\n'
compopt -o filenames
COMPREPLY=( $(compgen -f -- "${cur}") )
@@ -44,6 +44,9 @@ _alacritty()
compopt -o filenames
COMPREPLY=( $(compgen -d -- "${cur}") )
return 0;;
+ msg)
+ COMPREPLY=( $(compgen -W "-h --help -V --version -s --socket" -- "${cur}") )
+ return 0;;
esac
# Show all flags if there was no previous word
diff --git a/extra/completions/alacritty.fish b/extra/completions/alacritty.fish
index 6f8da9b0..fa399ffb 100644
--- a/extra/completions/alacritty.fish
+++ b/extra/completions/alacritty.fish
@@ -1,74 +1,104 @@
+# Available subcommands
+set -l commands msg help
+
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
+ -a "msg help"
+
# Meta
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from help" \
-s "v" \
-l "version" \
-d "Prints version information"
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from help" \
-s "h" \
-l "help" \
-d "Prints help information"
# Config
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-f \
-l "config-file" \
-d "Specify an alternative config file"
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "t" \
-l "title" \
-d "Defines the window title"
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-l "class" \
-d "Defines the window class"
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-l "embed" \
-d "Defines the X11 window ID (as a decimal integer) to embed Alacritty within"
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-x \
-a '(__fish_complete_directories (commandline -ct))' \
-l "working-directory" \
-d "Start shell in specified directory"
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-l "hold" \
-d "Remain open after child process exits"
complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "o" \
-l "option" \
-d "Override config file options"
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
+ -l "socket" \
+ -d "Path for IPC socket creation"
# Output
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-l "print-events" \
-d "Print all events to stdout"
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "q" \
-d "Reduces the level of verbosity (min is -qq)"
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "qq" \
-d "Reduces the level of verbosity"
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "v" \
-d "Increases the level of verbosity"
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "vv" \
-d "Increases the level of verbosity"
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "vvv" \
-d "Increases the level of verbosity"
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-l "ref-test" \
-d "Generates ref test"
-complete \
- -c alacritty \
+complete -c alacritty \
+ -n "not __fish_seen_subcommand_from $commands" \
-s "e" \
-l "command" \
-d "Execute command (must be last arg)"
+
+# Subcommand `msg`
+complete -c alacritty \
+ -n "__fish_seen_subcommand_from msg" \
+ -s "s" \
+ -l "socket" \
+ -d "Socket path override"
+complete -c alacritty \
+ -n "__fish_seen_subcommand_from msg" \
+ -a "create-window help"