{"id":1959,"date":"2012-05-23T15:00:49","date_gmt":"2012-05-23T22:00:49","guid":{"rendered":"http:\/\/arcanius.silverfir.net\/blog\/?p=1959"},"modified":"2012-05-23T15:22:06","modified_gmt":"2012-05-23T22:22:06","slug":"auto-updating-gnu-screen-window-names","status":"publish","type":"post","link":"https:\/\/arcanius.silverfir.net\/blog\/auto-updating-gnu-screen-window-names\/","title":{"rendered":"Auto-Updating GNU Screen Window Names"},"content":{"rendered":"<p>It took a bunch of searching a testing, but I got something that works for me and I like well. Instead of every screen window being called &#8220;bash&#8221; or being named manually, I now have them all named after the working directory. This is the magic:<\/p>\n<p><code>PROMPT_COMMAND='echo -ne \"\\033k$(basename $PWD)\\033\\\\\"'<\/code><\/p>\n<p><tt>PROMPT_COMMAND<\/tt> gets run every time bash displays a prompt, and those particular escape characters do the magic.<\/p>\n<p>To avoid crap outside of screen, I did this:<\/p>\n<p><code>case ${TERM} in<br \/>\n  screen)<br \/>\n    export PROMPT_COMMAND='echo -ne \"\\033k$(basename $PWD)\\033\\\\\"'<br \/>\n  ;;<br \/>\nesac<\/code><\/p>\n<p>Which is more general than it needs to be, but maybe I&#8217;ll expand it in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It took a bunch of searching a testing, but I got something that works for me and I like well. Instead of every screen window being called &#8220;bash&#8221; or being named manually, I now have them all named after the working directory. This is the magic: PROMPT_COMMAND=&#8217;echo -ne &#8220;\\033k$(basename $PWD)\\033\\\\&#8221;&#8216; PROMPT_COMMAND gets run every time [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[79,29],"class_list":["post-1959","post","type-post","status-publish","format-standard","hentry","category-everything","tag-computers","tag-linux"],"_links":{"self":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/1959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/comments?post=1959"}],"version-history":[{"count":8,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/1959\/revisions"}],"predecessor-version":[{"id":1967,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/posts\/1959\/revisions\/1967"}],"wp:attachment":[{"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/media?parent=1959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/categories?post=1959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arcanius.silverfir.net\/blog\/wp-json\/wp\/v2\/tags?post=1959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}