;; xterm.tf - Change *term title on world change. ;; Copyright (C)2000 Sander Klein Lebbink ;; Also does changing the window-title back to what it was ;; before running tf. (when quitting with /q) ;; requirements for this to work: ;; - Have your DISPLAY set (default if running tf from a *term) ;; - Have your TERM set to 'xterm' (or something alike, like 'xterm-color') ;; Beware that changing the window-title back works only when calling ;; /xtitle_back or quitting tf with /q (instead of /quit). ;; Works ONLY well when running tf DIRECTLY from a *term! ;; I have tested this only with [x|a|E]term on a linux-system, so I don't know ;; if it's suitable for your system. ;; NEW since v0.3: support for my mcp21_status package. ;; Set program name; defaults to TinyFugue /set program_name=TinyFugue /def -hWORLD world_xtitle = \ /if ((DISPLAY !~ "") & (TERM =/ "xterm*")) \ /if (old_term_name =~ "") \ /quote -dexec -S /set old_term_name=!xprop -id %{WINDOWID} | grep WM_NAME | awk -F'"' '{ print $$2 }' %; \ /if ((old_term_name =/ "xprop: error: ") | (old_term_name =/ "command not found")) \ /set old_term_name=undefined %; \ /endif %; \ /endif %; \ /eval /set temp_world_name=${world_name} %; \ /eval /set temp_mcp_world_name=\%{mcp_status_%{temp_world_name}} %; \ /if (temp_mcp_world_name !~ "") \ /xtitle %{temp_mcp_world_name} %; \ /else \ /if (temp_world_name !~ "") \ /xtitle %{program_name}: %{temp_world_name} %; \ /else \ /xtitle %{program_name} %; \ /endif %; \ /endif %; \ /unset temp_world_name %; \ /unset temp_mcp_world_name %; \ /endif /def -hSIGTERM xtitle_back = \ /if ((DISPLAY !~ "") & (TERM =/ "xterm*")) \ /if (old_term_name !~ "undefined") \ /xtitle %{old_term_name} %; \ /endif %; \ /unset old_term_name %; \ /endif /def q = \ /xtitle_back %; \ /quit ;; Call the world_xtitle hook to set title /world_xtitle