aboutsummaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2025-05-29 18:55:34 +0000
committerGitHub <noreply@github.com>2025-05-29 18:55:34 +0000
commita63c770befd3aa8be916ef9cfadd7e541f5377f0 (patch)
treeddf720e1834f101175f6ac3a8d11120dcca861a7 /extra
parent9eb68039dcb3edf9c87d253532a3ddd6c3cb8c4e (diff)
downloadr-alacritty-a63c770befd3aa8be916ef9cfadd7e541f5377f0.tar.gz
r-alacritty-a63c770befd3aa8be916ef9cfadd7e541f5377f0.tar.bz2
r-alacritty-a63c770befd3aa8be916ef9cfadd7e541f5377f0.zip
Add IPC config retrieval subcommand
This patch adds a new `alacritty msg get-config` subcommand which can retrieve the current config from any Alacritty window using the IPC socket. The command will always print the full configuration file in JSON, without the ability to filter which values are returned, leaning on tools like `jq` instead of adding this complexity to Alacritty. Contrary to deserialization, this relies heavily on the default serialization implementations to reduce the necessary changes. Key and Mouse bindings are omitted entirely since their structure is very complex and they tend to just bloat the message size without having an obvious usecase.
Diffstat (limited to 'extra')
-rw-r--r--extra/completions/_alacritty34
-rw-r--r--extra/completions/alacritty.bash65
-rw-r--r--extra/completions/alacritty.fish15
3 files changed, 106 insertions, 8 deletions
diff --git a/extra/completions/_alacritty b/extra/completions/_alacritty
index a0ac0e3b..971d93ce 100644
--- a/extra/completions/_alacritty
+++ b/extra/completions/_alacritty
@@ -87,6 +87,14 @@ _arguments "${_arguments_options[@]}" : \
'*::options -- Configuration file options \[example\: '\''cursor.style="Beam"'\''\]:_default' \
&& ret=0
;;
+(get-config)
+_arguments "${_arguments_options[@]}" : \
+'-w+[Window ID for the config request]:WINDOW_ID:_default' \
+'--window-id=[Window ID for the config request]:WINDOW_ID:_default' \
+'-h[Print help (see more with '\''--help'\'')]' \
+'--help[Print help (see more with '\''--help'\'')]' \
+&& ret=0
+;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_alacritty__msg__help_commands" \
@@ -107,6 +115,10 @@ _arguments "${_arguments_options[@]}" : \
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
+(get-config)
+_arguments "${_arguments_options[@]}" : \
+&& ret=0
+;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
@@ -166,6 +178,10 @@ _arguments "${_arguments_options[@]}" : \
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
+(get-config)
+_arguments "${_arguments_options[@]}" : \
+&& ret=0
+;;
esac
;;
esac
@@ -220,6 +236,7 @@ _alacritty__help__msg_commands() {
local commands; commands=(
'create-window:Create a new window in the same Alacritty process' \
'config:Update the Alacritty configuration' \
+'get-config:Read runtime Alacritty configuration' \
)
_describe -t commands 'alacritty help msg commands' commands "$@"
}
@@ -233,6 +250,11 @@ _alacritty__help__msg__create-window_commands() {
local commands; commands=()
_describe -t commands 'alacritty help msg create-window commands' commands "$@"
}
+(( $+functions[_alacritty__help__msg__get-config_commands] )) ||
+_alacritty__help__msg__get-config_commands() {
+ local commands; commands=()
+ _describe -t commands 'alacritty help msg get-config commands' commands "$@"
+}
(( $+functions[_alacritty__migrate_commands] )) ||
_alacritty__migrate_commands() {
local commands; commands=()
@@ -243,6 +265,7 @@ _alacritty__msg_commands() {
local commands; commands=(
'create-window:Create a new window in the same Alacritty process' \
'config:Update the Alacritty configuration' \
+'get-config:Read runtime Alacritty configuration' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty msg commands' commands "$@"
@@ -257,11 +280,17 @@ _alacritty__msg__create-window_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg create-window commands' commands "$@"
}
+(( $+functions[_alacritty__msg__get-config_commands] )) ||
+_alacritty__msg__get-config_commands() {
+ local commands; commands=()
+ _describe -t commands 'alacritty msg get-config commands' commands "$@"
+}
(( $+functions[_alacritty__msg__help_commands] )) ||
_alacritty__msg__help_commands() {
local commands; commands=(
'create-window:Create a new window in the same Alacritty process' \
'config:Update the Alacritty configuration' \
+'get-config:Read runtime Alacritty configuration' \
'help:Print this message or the help of the given subcommand(s)' \
)
_describe -t commands 'alacritty msg help commands' commands "$@"
@@ -276,6 +305,11 @@ _alacritty__msg__help__create-window_commands() {
local commands; commands=()
_describe -t commands 'alacritty msg help create-window commands' commands "$@"
}
+(( $+functions[_alacritty__msg__help__get-config_commands] )) ||
+_alacritty__msg__help__get-config_commands() {
+ local commands; commands=()
+ _describe -t commands 'alacritty msg help get-config commands' commands "$@"
+}
(( $+functions[_alacritty__msg__help__help_commands] )) ||
_alacritty__msg__help__help_commands() {
local commands; commands=()
diff --git a/extra/completions/alacritty.bash b/extra/completions/alacritty.bash
index bfa0b5c9..a52f5075 100644
--- a/extra/completions/alacritty.bash
+++ b/extra/completions/alacritty.bash
@@ -40,12 +40,18 @@ _alacritty() {
alacritty__help__msg,create-window)
cmd="alacritty__help__msg__create__window"
;;
+ alacritty__help__msg,get-config)
+ cmd="alacritty__help__msg__get__config"
+ ;;
alacritty__msg,config)
cmd="alacritty__msg__config"
;;
alacritty__msg,create-window)
cmd="alacritty__msg__create__window"
;;
+ alacritty__msg,get-config)
+ cmd="alacritty__msg__get__config"
+ ;;
alacritty__msg,help)
cmd="alacritty__msg__help"
;;
@@ -55,6 +61,9 @@ _alacritty() {
alacritty__msg__help,create-window)
cmd="alacritty__msg__help__create__window"
;;
+ alacritty__msg__help,get-config)
+ cmd="alacritty__msg__help__get__config"
+ ;;
alacritty__msg__help,help)
cmd="alacritty__msg__help__help"
;;
@@ -198,7 +207,7 @@ _alacritty() {
return 0
;;
alacritty__help__msg)
- opts="create-window config"
+ opts="create-window config get-config"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -239,6 +248,20 @@ _alacritty() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
+ alacritty__help__msg__get__config)
+ opts=""
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
alacritty__migrate)
opts="-c -d -i -s -h --config-file --dry-run --skip-imports --skip-renames --silent --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
@@ -284,7 +307,7 @@ _alacritty() {
return 0
;;
alacritty__msg)
- opts="-s -h --socket --help create-window config help"
+ opts="-s -h --socket --help create-window config get-config help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -406,8 +429,30 @@ _alacritty() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
+ alacritty__msg__get__config)
+ opts="-w -h --window-id --help"
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+ --window-id)
+ COMPREPLY=($(compgen -f "${cur}"))
+ return 0
+ ;;
+ -w)
+ COMPREPLY=($(compgen -f "${cur}"))
+ return 0
+ ;;
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
alacritty__msg__help)
- opts="create-window config help"
+ opts="create-window config get-config help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
@@ -448,6 +493,20 @@ _alacritty() {
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
+ alacritty__msg__help__get__config)
+ opts=""
+ if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ fi
+ case "${prev}" in
+ *)
+ COMPREPLY=()
+ ;;
+ esac
+ COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
+ return 0
+ ;;
alacritty__msg__help__help)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then
diff --git a/extra/completions/alacritty.fish b/extra/completions/alacritty.fish
index 7cfc3337..5f58ce4c 100644
--- a/extra/completions/alacritty.fish
+++ b/extra/completions/alacritty.fish
@@ -43,11 +43,12 @@ complete -c alacritty -n "__fish_alacritty_needs_command" -s V -l version -d 'Pr
complete -c alacritty -n "__fish_alacritty_needs_command" -f -a "msg" -d 'Send a message to the Alacritty socket'
complete -c alacritty -n "__fish_alacritty_needs_command" -f -a "migrate" -d 'Migrate the configuration file'
complete -c alacritty -n "__fish_alacritty_needs_command" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
-complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config help" -s s -l socket -d 'IPC socket connection path override' -r -F
-complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config help" -s h -l help -d 'Print help'
-complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config help" -f -a "create-window" -d 'Create a new window in the same Alacritty process'
-complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config help" -f -a "config" -d 'Update the Alacritty configuration'
-complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config get-config help" -s s -l socket -d 'IPC socket connection path override' -r -F
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config get-config help" -s h -l help -d 'Print help'
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config get-config help" -f -a "create-window" -d 'Create a new window in the same Alacritty process'
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config get-config help" -f -a "config" -d 'Update the Alacritty configuration'
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config get-config help" -f -a "get-config" -d 'Read runtime Alacritty configuration'
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and not __fish_seen_subcommand_from create-window config get-config help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from create-window" -l working-directory -d 'Start the shell in the specified working directory' -r -F
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from create-window" -s e -l command -d 'Command and args to execute (must be last argument)' -r
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from create-window" -s T -l title -d 'Defines the window title [default: Alacritty]' -r
@@ -58,8 +59,11 @@ complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from config" -s w -l window-id -d 'Window ID for the new config' -r
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from config" -s r -l reset -d 'Clear all runtime configuration changes'
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from config" -s h -l help -d 'Print help (see more with \'--help\')'
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from get-config" -s w -l window-id -d 'Window ID for the config request' -r
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from get-config" -s h -l help -d 'Print help (see more with \'--help\')'
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from help" -f -a "create-window" -d 'Create a new window in the same Alacritty process'
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from help" -f -a "config" -d 'Update the Alacritty configuration'
+complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from help" -f -a "get-config" -d 'Read runtime Alacritty configuration'
complete -c alacritty -n "__fish_alacritty_using_subcommand msg; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c alacritty -n "__fish_alacritty_using_subcommand migrate" -s c -l config-file -d 'Path to the configuration file' -r -F
complete -c alacritty -n "__fish_alacritty_using_subcommand migrate" -s d -l dry-run -d 'Only output TOML config to STDOUT'
@@ -72,3 +76,4 @@ complete -c alacritty -n "__fish_alacritty_using_subcommand help; and not __fish
complete -c alacritty -n "__fish_alacritty_using_subcommand help; and not __fish_seen_subcommand_from msg migrate help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c alacritty -n "__fish_alacritty_using_subcommand help; and __fish_seen_subcommand_from msg" -f -a "create-window" -d 'Create a new window in the same Alacritty process'
complete -c alacritty -n "__fish_alacritty_using_subcommand help; and __fish_seen_subcommand_from msg" -f -a "config" -d 'Update the Alacritty configuration'
+complete -c alacritty -n "__fish_alacritty_using_subcommand help; and __fish_seen_subcommand_from msg" -f -a "get-config" -d 'Read runtime Alacritty configuration'