changeset 2363:e38429c283bc

make service namaes more visible in terminal titles
author drewp@bigasterisk.com
date Sat, 03 Jun 2023 18:30:58 -0700
parents 8fc5da221688
children 1d9a0a304dc7
files light9/run_local.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/light9/run_local.py	Sat Jun 03 18:30:21 2023 -0700
+++ b/light9/run_local.py	Sat Jun 03 18:30:58 2023 -0700
@@ -1,5 +1,6 @@
 # bootstrap
 
+import re
 import logging
 import os
 import socket
@@ -45,6 +46,10 @@
 
 def setTerminalTitle(s):
     if os.environ.get('TERM', '') in ['xterm', 'rxvt', 'rxvt-unicode-256color']:
+        m = re.search(r'(light9\..*):', s)
+        if m is not None:
+            s = m.group(1)
+        s = s.replace('/home/drewp/own/proj/','')
         print("\033]0;%s\007" % s)  # not escaped/protected correctly
         hue = (hash(progName) % 255) / 255
         r, g, b = [int(x * 255) for x in hsv_to_rgb(hue, s=.2, v=.1)]