我希望能够从 gnome-pie 或类似的东西向终结者添加框架(而不是选项卡)。“--help”似乎没有什么,但是你们有吗?
为了模拟任何按键组合,我想到的是使用xdotool工具。
安装$ sudo apt-get install xdotool
用法:
$ xdotool key [key]+[key]
Run Code Online (Sandbox Code Playgroud)
例如
$ xdotool key ctrl+shift+o # To split horizontal
$ xdotool key ctrl+shift+e # To split vertical
Run Code Online (Sandbox Code Playgroud)
有了这个,您可以更轻松地创建一些别名。
$ alias splith='xdotool key ctrl+shift+o'
$ alias splitv='xdotool key ctrl+shift+e'
Run Code Online (Sandbox Code Playgroud)
试一下。
更新
好的,让我们找到解决方案。
我在这里找到了一个从其他终端执行命令的实用程序。
创建一个文件$ vim ttyecho.c,复制这段代码
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <string.h>
#include <unistd.h>
void print_help(char *prog_name) {
printf("Usage: %s [-n] DEVNAME COMMAND\n", prog_name);
printf("Usage: '-n' is an optional argument if you want to push a new line at the end of the text\n");
printf("Usage: Will require 'sudo' to run if the executable is not setuid root\n");
exit(1);
}
int main (int argc, char *argv[]) {
char *cmd, *nl = "\n";
int i, fd;
int devno, commandno, newline;
int mem_len;
devno = 1; commandno = 2; newline = 0;
if (argc < 3) {
print_help(argv[0]);
}
if (argc > 3 && argv[1][0] == '-' && argv[1][1] == 'n') {
devno = 2; commandno = 3; newline=1;
} else if (argc > 3 && argv[1][0] == '-' && argv[1][1] != 'n') {
printf("Invalid Option\n");
print_help(argv[0]);
}
fd = open(argv[devno],O_RDWR);
if(fd == -1) {
perror("open DEVICE");
exit(1);
}
mem_len = 0;
for ( i = commandno; i < argc; i++ ) {
mem_len += strlen(argv[i]) + 2;
if ( i > commandno ) {
cmd = (char *)realloc((void *)cmd, mem_len);
} else { //i == commandno
cmd = (char *)malloc(mem_len);
}
strcat(cmd, argv[i]);
strcat(cmd, " ");
}
if (newline == 0)
usleep(225000);
for (i = 0; cmd[i]; i++)
ioctl (fd, TIOCSTI, cmd+i);
if (newline == 1)
ioctl (fd, TIOCSTI, nl);
close(fd);
free((void *)cmd);
exit (0);
}
Run Code Online (Sandbox Code Playgroud)
然后执行make+文件
$ make ttyecho
$ sudo chown root:root ttyecho
$ sudo cp ttyecho /usr/bin
Run Code Online (Sandbox Code Playgroud)
现在尝试一下,检查终结者终端tty
$ tty
/dev/pts/0
Run Code Online (Sandbox Code Playgroud)
在其他终端执行以下命令
$ ttyecho -n /dev/pts/0 splith
Run Code Online (Sandbox Code Playgroud)