From 799ef63b813066e7fd9b13ccf1339ac416c40cdf Mon Sep 17 00:00:00 2001 From: Christiano Haesbaert Date: Sat, 6 Jan 2018 20:17:28 +0100 Subject: [PATCH] Add a -T option that sets window title. `cool-retro-term -T myretrosession` sets window name to 'myretrosession' This is useful especially for people who rely on wmctrl to change windows, now I can do `wmctrl -a myretrocession` to focus on cool-retro-term. -T was chosen since it matches classic xterm(1) and other terminal emulators --- app/main.cpp | 1 + app/qml/ApplicationSettings.qml | 6 ++++++ app/qml/main.qml | 4 +++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/main.cpp b/app/main.cpp index 7c0bb51..55df439 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -54,6 +54,7 @@ int main(int argc, char *argv[]) qDebug() << " --default-settings Run cool-retro-term with the default settings"; qDebug() << " --workdir Change working directory to 'dir'"; qDebug() << " -e Command to execute. This option will catch all following arguments, so use it as the last option."; + qDebug() << " -T Set window title to 'title'."; qDebug() << " --fullscreen Run cool-retro-term in fullscreen."; qDebug() << " -p|--profile <prof> Run cool-retro-term with the given profile."; qDebug() << " -h|--help Print this help."; diff --git a/app/qml/ApplicationSettings.qml b/app/qml/ApplicationSettings.qml index 3d20687..c786de3 100644 --- a/app/qml/ApplicationSettings.qml +++ b/app/qml/ApplicationSettings.qml @@ -41,6 +41,8 @@ QtObject{ property bool fullscreen: false property bool showMenubar: true + property string wintitle: "cool-retro-term" + property real windowOpacity: 1.0 property real ambientLight: 0.2 property real contrast: 0.85 @@ -480,6 +482,10 @@ QtObject{ showMenubar = false; } + if (args.indexOf("-T") !== -1) { + wintitle = args[args.indexOf("-T") + 1] + } + initializedSettings(); } Component.onDestruction: { diff --git a/app/qml/main.qml b/app/qml/main.qml index ed0801c..11f836e 100644 --- a/app/qml/main.qml +++ b/app/qml/main.qml @@ -62,8 +62,10 @@ ApplicationWindow{ __contentItem.visible: mainMenu.visible } + property string wintitle: appSettings.wintitle + color: "#00000000" - title: terminalContainer.title || qsTr("cool-retro-term") + title: terminalContainer.title || qsTr(appSettings.wintitle) Action { id: showMenubarAction