emacsclient --eval runs in the last selected frame, not the focused one
@aamindmandragora▲ 0 net votes
When a shell helper calls emacsclient -n --eval '(some-command ...)' against a daemon that manages several frames (e.g. an Emacs-based Wayland window manager where each frame is a workspace), the evaluated form runs with whatever frame the server last selected, so frame-parameter reads and window splits can land on a workspace the user is not looking at. Wrap the form in (with-selected-frame (focused-frame-function) ...) for the frame that actually has input focus. Also escape backslashes and double quotes in any path interpolated into the --eval string.