Sublime Forum

Send commands to a terminal in wayland

#1

Hi, I will preface this by saying that I am a big fan of the SendCode package which is integral to my workflow when writing code in interpreted languages. For some time I also used the Terminus package but ever since I switched to a tiling window manager I prefer to have my terminal standalone.

Now to the issue at hand. For communicating with a terminal on Linux, SendCode uses xdotool for which AFAIK there won’t be a replacement on Wayland due to security reasons. Therefore, I think it would be a good idea to start working on an alternative for Wayland as it is clearly the future of Linux desktop.

Something, I am quite confident that would work, is using the kitty terminal emulator and its remote control feature. I made some preliminary tests and using the subprocess module in python I can start an instance of kitty listening to a specific socket, launch additional windows, set windows’ titles, and send text to a specific window.

Also worth considering is the usage of LSPs. In particular, LSP-julia has a very useful command LSP-julia: Select Code Block. Using this command to select entire functions, for-loops, multi-line matrices, and then sending the selection to the terminal would cover most if not all of my use cases in julia. If similar functionality is provided also by other LSPs I think it would be a shame not to use it. If not, maybe it could be provided by independent packages.

Right now I plan to slowly develop a package implementing these ideas before I eventually switch to a tiling compositor (Wayland). What do you guys think, is this worthwhile?

0 Likes