从命令行更改konsole选项卡标题并使其持久化? [英] Change konsole tab title from command line and make it persistent?

查看:418
本文介绍了从命令行更改konsole选项卡标题并使其持久化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改konsole标签标题?默认情况下,它设置为%u : %n,因此它始终会自动更改.

How can I change the konsole tab title? By default, it's set to %u : %n, so it always changes automatically.

我可以设置:

qdbus org.kde.konsole $KONSOLE_DBUS_SESSION setTitle 1 "My Title"

但是,一旦您在控制台中运行某些内容,它就会变回%u : %n.当然.我可以将其设置为%w来告诉它将标题设置为"shell设置的窗口标题",但是稍后(如果我未明确设置),它将为空. (除非我进行了设置,否则每个新标签都将为空.)

But as soon as you run something in the console, it changes back to %u : %n. Of course. I can set it to %w to tell it to set the title to "Window Title set by shell", but later (if I don't explicitly set it), it will be empty. (Every new tab will be empty, unless I set it.)

问题是如何使其持久(或如何通过命令行切换配置文件)?我可以创建另一个配置文件,其中标题格式设置为%w,然后在设置自定义标题之前,切换到该配置文件.

The question is how to make it persistent (or how to switch profile via command line)? I can make another profile in which the title format is set to %w, and before I set my custom title, switch to that profile.

我想我已经找到了答案

qdbus org.kde.konsole $ KONSOLE_DBUS_SESSION setTabTitleFormat 0" qdbus org.kde.konsole $ KONSOLE_DBUS_SESSION setTitle 0我的标题"

qdbus org.kde.konsole $KONSOLE_DBUS_SESSION setTabTitleFormat 0 "" qdbus org.kde.konsole $KONSOLE_DBUS_SESSION setTitle 0 "My Title"

推荐答案

您可能需要使用以下变体:

You may need to use this variant:

echo -ne "\033]30;test change title\007"

$ konsole -v
Qt: 4.8.6
KDE Development Platform: 4.13.3
Konsole: 2.13.2

这篇关于从命令行更改konsole选项卡标题并使其持久化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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