Before, sed would add quotes to every line of the single multiline argument,
causing the final quoted argument to "split ... command" or screen to contain
unquoted newlines such as this (from kakoune-cr):
tell application "iTerm"
tell current session of current window
tell (split vertically with same profile command "env PATH='...' 'sh' '-c' ''
' export KAKOUNE_SESSION=$1'
' export KAKOUNE_CLIENT=$2'
' shift 3'
''
' [ $# = 0 ] && set \"$SHELL\"'
''
' \"sh\"'
' ' '--' '51909' 'client0' 'terminal' ") to select
end tell
end tell
Instead of using sed to do this which operates on single lines at a time, simply
use printf to insert ' quotes before and after the entire argument.
While Wayland offers nothing general to help us support `focus` on all
window managers, WM-specific implementations are generally possible.
Sway is a tiling window manager that mimics i3, and has a reasonably
powerful CLI that can help us achieve this.
In addition to supporting `focus` for Sway, this change paves the way
for additional WM-specific Wayland functionality by adding a detection
step to wayland.kak, in a similar fashion to detection.kak.
currently focus client doesn't work if target pane of the client is in different tab or window from current one.
select window, select tab should be triggered in order to select a pane on a currently not focused tab or window.
The X11 repl is unique in that it sends the selection (or parameter) with a
new line appended.
This patch removes that new line and thus, brings it into line with the tmux
and kitty versions.
tmux-send-text allows sending an argument, when supplied the argument
will be sent to the REPL instead of the current selection.
tmux-send-text also keeps kak focussed, which does not happen in the x11
variant as it uses xdotool to switch window.
this patch allows:
* Passing an argument to x11-send-text, so that value will be sent
instead of the current selection.
* We capture the window id of the current (presumably kak window)
before we use xdotool to switch window. We can therefore switch back to
kak afterwards (which we do)
When $1 or ${kak_selection} start with dash, like "-1", the command will fail, because tmux think it's an argument flag.
-- prevent this.
Also the doc (append new line) is no longer valid.
Now it uses the window id to identify the REPL window. It is stored in
the option x11_repl_id. That way it is possible to have different REPLs
for different buffers or windows.
It's unclear what the `send-text` alias does at first glance,
so prefixing it with "repl-" both fixes that and helps make it
discoverable via the command prompt's fuzzy matcher.
The `repl` alias also seems too generic a name, the "-new" suffix
should hopefully give a hint that it creates a new window.
In case a user connects to the same Kakoune session from multiple tmux
windows/sessions, this makes the splits appear next to the calling client,
instead the client where the Kakoune session was started.