如何从命令行在 GNOME 终端中打开一个新选项卡? [英] How to open a new tab in GNOME Terminal from command line?

查看:34
本文介绍了如何从命令行在 GNOME 终端中打开一个新选项卡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Ubuntu 9.04 x64,当我编写时:

I'm using Ubuntu 9.04 x64 and when I write:

gnome-terminal --tab

在终端,我希望它在同一个终端窗口中打开一个新选项卡.但它会打开一个新窗口.

At the terminal, I expect it to open a new tab in the same terminal window. But it opens a new window instead.

我发现它的意图是在新窗口中打开一个新标签,即如果我写:

I found out that its intention is to open a new tab in a new window, i.e., if I write:

gnome-terminal --tab --tab

它将打开一个带有两个选项卡的新窗口.

It will open a new window with two tabs.

那么,问题是,如何使用 gnome-terminal 中的命令在 current 窗口中打开一个新选项卡?

So, the question is, how can I open a new tab in the current window using a command in gnome-terminal?

推荐答案

#!/bin/sh

WID=$(xprop -root | grep "_NET_ACTIVE_WINDOW(WINDOW)"| awk '{print $5}')
xdotool windowfocus $WID
xdotool key ctrl+shift+t
wmctrl -i -a $WID

这将自动确定相应的终端并相应地打开选项卡.

This will auto determine the corresponding terminal and opens the tab accordingly.

这篇关于如何从命令行在 GNOME 终端中打开一个新选项卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆