Replies: 2 comments
-
If I got you right, you're saying to introduce a new [opener]
play = [
- { run = 'setsid mpv "$@"', desc = "Play video in a new window", for = "unix" },
+ { run = 'mpv "$@"', desc = "Play video in a new window", for = "unix", setsid = true },
[ But it seems there's not much advantage over adding it directly to Apart from Linux (like macOS, Windows, and Android), is |
Beta Was this translation helpful? Give feedback.
-
Yeah, pretty much. Something that exists alongside orphan and block as another option that can safely be omitted entirely. I was thinking something like I am not aware of a setsid equivalent for windows, and digging a little bit, it seems that It's certainly no big deal prepending That said, I did some digging into the source yesterday while looking for solutions to a different problem I had, and now I'm not sure if I understand entirely how orphan and block are implemented; are these simply just the same subshell arguments that can be added to commands defined in the key map? |
Beta Was this translation helpful? Give feedback.
-
I would imagine that many users of yazi are likely familiar with other terminal file managers. Perhaps the most popular among these is
ranger
, which is very mature by comparison.Arguably, the biggest advantage yazi has over something like ranger is asynchronous operations, which makes working with large directories over network shares a lot nicer -- ranger can get rather slow in situations like this, until all of the directory contents have been temprarily cached, especially when previews are enabled.
For those unfamiliar, ranger ships with
rifle.conf
as it's opener and includes helpful flags to indicate how a program should open files from it's interface, ie:For example -- focusing on the
f
flag -- let's say you wanted to play a video file from within ranger withmpv
, you would have a line in ranger's rifle.conf like this:This translates to: "If the selected file is a video mimetype, play it in
mpv
and fork the process withsetsid
"; This lets the user continue to use the file manager while the video appears in a new window, and will remain running after the parent process has exited.To do the same on yazi would probably look like this (not tested):
*NOTE:
for = "unix"
is specified here because I do not know of an equivalent tosetsid
for Windows, but I'm sure one exists.Yazi already has
orphan
which effectively already does what I'm referring to in the example provided, but the key difference here with usingsetsid
to fork the process allows for more user control over the process tree in their preferred environment.Example use case: window swallowing
Window "swallowing" is a concept familair to many users of tiling window mangers on X11. When available, this allows GUI applications invoked from a command line to take the place of the terminal window it was called with. Otherwise, starting a GUI application from a terminal emulator will open the GUI application in a separate window and leave the terminal in a "useless" state until the child process exits.
Of course, it is trivial to prepend
setsid
to commands in the [opener] should the user want it, and those who do are very likely to already know how to do this. Purely from a convenience/familiarity standpoint though, I was thinking an additional option in the Opener struct could make for a cleaner and more uniform syntax for yazi.toml.Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions