{"id":21,"date":"2012-03-06T13:20:21","date_gmt":"2012-03-06T09:20:21","guid":{"rendered":"http:\/\/pavlenko.net\/antony\/?p=21"},"modified":"2020-05-07T00:53:59","modified_gmt":"2020-05-06T20:53:59","slug":"konsole-tab-names-by-script-ssh-wrapper","status":"publish","type":"post","link":"http:\/\/pavlenko.net\/antony\/2012\/03\/06\/konsole-tab-names-by-script-ssh-wrapper\/","title":{"rendered":"Konsole tab names by script. Ssh wrapper"},"content":{"rendered":"<p>I have a lot of small scripts, which are very useful for me, but the famous one by my friends is ssh wrapper for Konsole.<br \/>\nAt work I usually have a lot of opened ssh sessions to different servers. My work system is linux notebook and <a href=\"http:\/\/konsole.kde.org\/\" title=\"Konsole\" target=\"_blank\" rel=\"noopener noreferrer\">Konsole<\/a> as default terminal emulator. So some years ago I wrote small ssh wrapper, which set name to Konsole tab by last argument to ssh (hostname).<\/p>\n<pre>\r\nantony@amaliya:$ cat \/usr\/local\/bin\/ssh\r\n#!\/bin\/bash\r\n# Kocsole wrapper around ssh to rename tabs\r\n# anton@pavlenko.net\r\n\r\nREAL_SSH=\/usr\/bin\/ssh\r\nDCOP=\/opt\/kde\/bin\/dcop\r\n\r\nif [ ! -z \"$KONSOLE_DCOP_SESSION\" ]\r\nthen\r\n\r\n # Use the last argument as the title\r\n for arg in $@; do\r\n NEW_TITLE=\"$arg\"\r\n done\r\n\r\n OLD_TITLE=`dcop \"$KONSOLE_DCOP_SESSION\" sessionName`\r\n $DCOP \"$KONSOLE_DCOP_SESSION\" renameSession \"$NEW_TITLE\"\r\n\r\n function restore_title() {\r\n $DCOP \"$KONSOLE_DCOP_SESSION\" renameSession \"$OLD_TITLE\"\r\n }\r\n\r\n # If SSH is interrupted (CTRL-C), restore the old title\r\n trap \"restore_title\" SIGINT\r\n $REAL_SSH $*\r\n restore_title\r\n\r\nelse\r\n $REAL_SSH $*\r\nfi\r\n<\/pre>\n<p>So if you have the same problems &#8211; use this wrapper!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have a lot of small scripts, which are very useful for me, but the famous one by my friends is ssh wrapper for Konsole. At work I usually have a lot of opened ssh sessions to different servers. My work system is linux notebook and Konsole as default terminal emulator. So some years ago [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/posts\/21"}],"collection":[{"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":2,"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":51,"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/posts\/21\/revisions\/51"}],"wp:attachment":[{"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pavlenko.net\/antony\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}