Kittens for session management #3190
Replies: 5 comments 2 replies
-
On Fri, Dec 25, 2020 at 03:30:00PM -0800, Bartek Mucha wrote:
1. What is the best way to send `kitty @ ls` equivalent in `main()` of a kitten, so that a tui can be provided to select one of the windows to focus?
Simply run kitty +kitten @ ls using subprocess.check_output()
This assumes you have either: 1) setup remote control globally
or
2) are running the kitten via something like
map f1 launch --allow-remote-control kitty + kitten mykitten
2. My assumption is that I can set os window names permanently via `wname` arg to `add_os_window`, is this correct?
name corresponds to the --name cli arg and wclass to the --class cli
arg. They set properties of the OS window in the underlying operating
system's window manager and whether they work depends on the window
manager in question. In X11 they are WM_CLASS. Note that neither of
these are present in @ ls output currently but are easy to add if
needed.
3. My select implementation integrates heavily with existing `kittens.tui`. I'm starting to think that it was a terrible idea and I should probably craft a less coupled implementation. Am I correct in thinking is `kittens.tui` should not be considered a public api?
Like pretty much all undocumented kitty code, you can use it, in the knowledge
that:
1) It may change in the future
2) I dont make it a habit to break things without good reason, so it is
unlikely to change.
It's up to you what tradeoff you prefer.
|
Beta Was this translation helpful? Give feedback.
-
Oh and if you wish to avoid runnigng a subprocess in your kitten, you can use the create_basic_command and encode_send functions from kitty.remote_control. For an example of their use, see the broadcast kitten. Note that you have to do more than send, you will need to read the response as wel.., but that should not be hard. |
Beta Was this translation helpful? Give feedback.
-
And I committed code to make the class/name for os windows available in the @ ls output |
Beta Was this translation helpful? Give feedback.
-
On Sat, Dec 26, 2020 at 02:09:24AM -0800, Bartek Mucha wrote:
Out of curiosity, why is remote control optional as a setting?
It's a security risk, any program running inside kitty has full access
to everything else.
|
Beta Was this translation helpful? Give feedback.
-
On Sat, Dec 26, 2020 at 03:25:54AM -0800, Bartek Mucha wrote:
> It's a security risk, any program running inside kitty has full access to everything else.
Pardon my ignorance and getting slightly off topic, but isn't that the case for any software you run on your machine? Could you give a concrete example? Is it because a _trusted_ program can read/output escape sequences that'd cause remote control command execution?
Progarms running sure su as another ser, programs running over ssh, etc
etc etc.
|
Beta Was this translation helpful? Give feedback.
-
Hi,
First of all thanks for a blazing fast terminal emulator! Kitty is lovely. 😍
I'm trying to replicate tmux(inator) session management and switching. I've found an old issue, which contains suggestions that I'm trying to follow.
The general idea is:
find
-like command passed to the kitten as an arg, such command should return a list of session files to select (imagine~/Projects/foo/kitty-session.conf
,~/Projects/nested/bar/kitty-session.conf
)kitty @ ls
and present a tui to select os window by nameSo far I've hacked together a find+select for kitty session files.
Now I'm struggling to figure out a nice way to read the list of kitty os windows. The only this I've managed to decipher in existing kittens is a combination of
command_for_name
andencode_send
in aHandler
.kitty @ ls
equivalent inmain()
of a kitten, so that a tui can be provided to select one of the windows to focus?wname
arg toadd_os_window
, is this correct?kittens.tui
. I'm starting to think that it was a terrible idea and I should probably craft a less coupled solution. Am I correct in thinking iskittens.tui
should not be considered a public api?edit: For posterity https://github.com/muchzill4/kitty-session (decided to stick with os builtin window switching for now)
Beta Was this translation helpful? Give feedback.
All reactions