Jump to content
Forums in Read-Only Mode - Please use Reddit ×
  • 0

window title


uudruid74

Question

Am I imagining things, or was there a flag to pass to emerge that makes it set your window title to the currently building package along with the [x of y] style designation?  Like changing the window title to "[3/5] apache"

 

If it doesn't exist, would anyone but me find it useful?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

OK - my mistake.  Apparently, this is supposed to be automatic, but its not working with my setup.  My TERM is "screen" which is supposed to work, but the terminal is running tmux.  I assume screen and tmux are compatible, but setting the window title can be done two different ways.   There is also the issue that window titles should be kept small when running a terminal multiplexer, so I hacked the right escape sequence in and added a regex to shorten the information (turned "Compile" ->C, "1 of 2" -> "1/2", removed the version from the package, and chopped up the rest).

 

If anyone else finds this useful, modify /usr/lib/portage/pym/portage/output.py starting at line 257:

                if not raw :
                        if os.environ.get('TERM') != "screen":
                                mystr = '\x1b]0;%s\x07' % mystr
                        else:
                                mystr = re.sub(r'.*?\((\d+) of (\d+)\).*?/(.*?)[-0-9\.ra]+\s(\w).*', r'\4-\1/\2 \3', mystr)
                                mystr = '\033k%s\033\\' % mystr

                # avoid potential UnicodeEncodeError

I'm not terribly familiar with python, so that could be a horrible hack, probably is, but it works.  Now works in all my terminals, with very small "tabs" in my tmux/byobu screen.

Link to comment
Share on other sites

  • 0

I'm glad you figured out something that works for you. I don't use the same terminal you do, so I'm unfamiliar with it. I use KDE's konsole for my terminal. I only know that in konsole you'd go to Settings -> Edit Current Profile... then put the desired variables into the "Tab Title Format" area. I use "%D : %w" which shows the full path of the current directory and the window title as set by the shell.

Link to comment
Share on other sites

  • 0

Oh yeah, I don't mean manually changing the title.  I mean having emerge show what its emerging automatically in the title.   I actually edited it (slight bug if package name ends in an r or a).  Portage/Emerge also does this, but uses the wrong escape sequence for the "screen" terminal type.   Its done through an ANSI escape sequence, the same way it does colors, but in this case its not portable to all terminal types.  I actually plan on making another change.  Both Compiling and Cleaning start with the same letter, so just having C isn't descriptive and I don't have enough room for the whole word.  I'll have to make the hack a little more involved.

 

Speaking of neat hacks.  Open a terminal and type

emerge --moo

I'm sure a lot of people have seen it, but perhaps you haven't.  Little Easter Egg.

 

My terminal set-up:

I'm actually using a dual layered approach.  I use byobu which is a layer over tmux which is based on screen.  This is a standard text application, not graphical.  Yeah, sounds complicated, but this has a number of features:

  1. It can multiplex your terminal, so that you can have multiple shells running on the same screen.  Yes you can do this with your GUI terminal, but this works even over SSH and can do split screens and such.  There is a lot of flexibility - you can even cut-n-paste without a mouse (mouse is still optional).
  2. It does session management.  If I log in to SSH, I get the same shells that are on my desktop.  I can even log in with my phone and the byobu terminal size will change as I rotate the phone.  Session management means I can log in remotely (by phone) to check on the status of a long compile, or log out of my desktop and log in to a new one ... and my shells are uninterrupted - compile still running.
  3. The status line tells me system information such as how hot my CPU is, CPU speed, etc.
  4. For some odd reason, the termcap entry is "screen", not "xterm"

And since I do a lot of work in the shell I need access to it instantly, but I don't want to open a new window since I really only need a single window.  Byobu is multiplexing the contents of the window, so I don't need tabs.  In fact, most terminals have a tendency to take up too much space and its easy to lose a couple of them.

 

Enter tilda:

Tilda is a pop-up terminal.  I configure it to get rid of all the things I don't use.  No tabs, no title, no scrollbar.  You hit a hot key and it appears (all workspaces).  Hit the key again, and its gone.  And you can configure what "shell" it runs, so I have it running byobu.  ssh runs a "login shell", so it gets byobu.  All other terminals (if I run on) are normal bash (bypassing byobu).

Link to comment
Share on other sites

×
×
  • Create New...