简体   繁体   English

使用交互式程序启动gnome-terminal

[英]Start gnome-terminal with interactive program

I'm trying to get fzf , an interactive fuzzy finder, running in a new terminal when calling a particular keyboard shortcut. 我正在尝试获取fzf (交互式模糊查找器),在调用特定的键盘快捷键时在新终端中运行。 In a traditional terminal window, I either call fzf or type Ctrl + T to launch it. 在传统的终端窗口中,我可以调用fzf或键入Ctrl + T来启动它。 My problem is that I'm unable to reproduce this programmatically (so that I can assign it to a Gnome keyboard shortcut). 我的问题是我无法以编程方式重现此内容(因此我可以将其分配给Gnome键盘快捷键)。 gnome-terminal --command="fzf" tells me it couldn't find a process named fzf . gnome-terminal --command="fzf"告诉我找不到名为fzf的进程。 gnome-terminal --command="xdotool key ctrl+t" doesn't do anything but does work if I call it from an open terminal window. gnome-terminal --command="xdotool key ctrl+t"不会做任何事情,但是如果我从打开的终端窗口中调用它,它将起作用。 Changing the profile preference that says the terminal should stay open after the command is run results in the terminal saying "the child process has ended with a 0 status". 更改配置文件首选项后,该配置文件首选项将在终端运行后保持打开状态,从而导致终端显示“子进程以0状态结束”。 Is there a way to do this? 有没有办法做到这一点?

fzf is a shell function. fzf是一个shell函数。 That's why you can't just run it directly. 这就是为什么您不能直接运行它。

You would need to run your shell (possibly in interactive mode) to get the function to exist. 您将需要运行外壳程序(可能以交互方式)以使该功能存在。

Alternatively find out (ie declare -f fzf in your shell) what command is actually being run and run that directly. 或者,找出(即在您的shell中声明-f fzf)实际正在运行的命令,然后直接运行该命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM