Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 75670 - [PATCH] emerge, screen & status in Title - Improvements
Summary: [PATCH] emerge, screen & status in Title - Improvements
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Portage team
URL: http://forums.gentoo.org/viewtopic.ph...
Whiteboard:
Keywords:
: 100075 (view as bug list)
Depends on:
Blocks: 100075
  Show dependency tree
 
Reported: 2004-12-25 19:27 UTC by Bernhard T
Modified: 2011-01-01 10:36 UTC (History)
11 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
setting the screen title gets controlled by environement variable (portage_screen_env.patch,643 bytes, patch)
2005-03-25 16:50 UTC, Bernhard T
Details | Diff
setting the screen title gets controlled by FEATURE (portage_screen_feature.patch,13.19 KB, patch)
2005-03-26 10:25 UTC, Bernhard T
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard T 2004-12-25 19:27:03 UTC
in File: /usr/lib/portage/pym/output.py
in Function: def xtermTitle(mystr):

1. Bug: Screen appends stuff to it's TERM Env-Var (i.e. "screen.linux"), meaning that matching myt with only "screen" won't work.

2. Improvement: Why not display the emerge-status in the Screen-Window-Title (previoulsy known as "aka") as well, so we would have a progress-indicator even without X.

Reproducible: Always
Steps to Reproduce:
1. start screen
2. emerge something

Actual Results:  
everythink ok, but no <some X-Term>-Title was set

Expected Results:  
see Details

proposed patch:
+++ /usr/lib/portage/pym/output.py
--- /var/tmp/portage/portage-2.0.51-r3/work/portage-2.0.51-r3/pym/output.py
@@ -37,13 +37,9 @@
        if havecolor and dotitles and os.environ.has_key("TERM"):
                myt=os.environ["TERM"]
                legal_terms =
["xterm","Eterm","aterm","rxvt","screen","kterm","rxvt-unicode"]
+               if (myt in legal_terms) or myt.startswith("xterm") or
myt.startswith("screen"):
-               if (myt in legal_terms) or myt.startswith("xterm"):
                        sys.stderr.write("\x1b]2;"+str(mystr)+"\x07")
                        sys.stderr.flush()
+               if (myt.startswith("screen")):
+                       sys.stderr.write("\x1bk"+str(mystr)+"\x1b\\")
+                       sys.stderr.flush()
+                       
 
 def xtermTitleReset():
        if havecolor and dotitles and os.environ.has_key("TERM"):
Comment 1 Emil Beinroth 2005-01-12 15:28:05 UTC
My screen-tabs with root-shells are named "root" (the name is also displayed in the caption-thingy). If I emerge something, the tab is renamed to "emerge ..." and after the emerge the tabs name is "screen". Probably because the aterm's title is "screen".

I made some screenshot:
befor (http://www.fh-rosenheim.de/~emil.beinroth/befor_emerge.png),
during (http://www.fh-rosenheim.de/~emil.beinroth/during_emerge.png) and
after (http://www.fh-rosenheim.de/~emil.beinroth/after_emerge.png) the emerge.
Comment 2 Evan Langlois 2005-01-12 23:48:04 UTC
Actually, you can use the same escape sequence currently used to set the window title to set the screen status.  However, the screen term change does have to be done, so you wouldn't need quite as much redundant code.  It would be nice if screen didn't put the platform and just used "screen" like it used to - as then the current portage code would work (likely working when written).

I do think that screen should have the caption turned on by default in /etc/screenrc as many people want this feature and don't have it (I added a CPU temp output from /proc/acpi as well as emerging can show temp problems if you have them).

Resetting the title to "screen" in the examples by Emil, has to do with the reset, xtermTitleReset .. expected behavior.

Comment 3 David 2005-01-24 01:59:57 UTC
Personally I do not like this enhancement.  I use the following in my .screenrc which gives me a 1 line caption and a 1 line "tab bar".

caption always "%{= bb}%{+b w}Screen: %n | %h %=%t %c"
hardstatus alwayslastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"

This enhancement simply gives me a 50+ character tab and I have no way of turning it off, example: http://dev.edeca.net/screen.png 

Perhaps a USE flag of "screen" could be used to turn this feature on or off?  Or even a setting in ~/.portage or similar.
Comment 4 barefootcoder 2005-02-09 13:25:57 UTC
This is not an "enhancement" or an "improvement"; it is a bug, plain and simple.  If I set my screen window's title to something, and some rogue program comes along and changes that so that I have to reset it again, that program has a bug which needs to be corrected.

Please fix this bug in emerge.  I'm tired of constantly having the change the screen title for the window that I run emerge in.
Comment 5 Jason Stubbs (RETIRED) gentoo-dev 2005-02-09 15:22:34 UTC
FEATURES="notitles" ?
Comment 6 Thomas Eckert 2005-02-20 02:50:58 UTC
100% agreed with comment #4
_if_ someone want's the "emerge-status" shown in it's screen status-line he can
mess with the hardstatus herself.

in general it's always difficult to enable features (like suggested in comment #2
"caption by default") as you can _never_ please all users; _if_ you disappoint
users anyway it's best to leave the upstream-defaults of the package as the
official documentation for that package (faqs, mailing-lists, ...) will provide
answers for the common problems. 
Comment 7 Richard Kilgore 2005-03-18 09:03:00 UTC
Please provide a method to disable this emerge behavior. I've been manually
editing output.py everytime I get a new version of portage, and it's a pain!

I can still see all that emerge info in the xterm title, but I don't want
it in my screen titles.  I have carefully picked my screen titles to be able
to quickly tell what windows I have open and where they are.  They are meant
to be _short_ descriptive titles.
Comment 8 Bernhard T 2005-03-25 16:50:21 UTC
Created attachment 54484 [details, diff]
setting the screen title gets controlled by environement variable

The patch introduces an environment variable "SCREEN_PORTAGE". If set to
"set_title" the Screen Title will be set to the Portage hardstatus. Otherwise
the screen stays as it is.
Comment 9 Bernhard T 2005-03-25 16:56:08 UTC
The above patch is my attemt of fix my mess. I tought an environement variable would work best, because 1. it can be set from either the profile or the screenrc itself, 2. its very easy to implement in output.py and 3. I didn't think yet another USE Flag or Option in make.conf would be warranted.

Happy Eastern Everyone
Comment 10 Jason Stubbs (RETIRED) gentoo-dev 2005-03-25 19:10:05 UTC
What's wrong with FEATURES="notitles" ?
Comment 11 Emil Beinroth 2005-03-26 09:18:12 UTC
FEATURES="notitles" would also turn of xterm-titles .. but we want them.
What we don't want are messed up screen-titles!
Comment 12 Bernhard T 2005-03-26 10:25:46 UTC
Created attachment 54537 [details, diff]
setting the screen title gets controlled by FEATURE

Additionally to what has already been said, from what I have read, I now
believe the setting of the screen-title should be optional, not default.
FEATURES=notitles however, is not set on default.

The above patch works on the portage work-image directory and introduces a
Feature "screentitle", that if set, enables updates of the screen-title.

As this might be more tidy than the environement variable, I'm marking the
previous patch as obsolete. However now we have an additional import statemant
that I would have liked to avoid, but never mind ...
Comment 13 Jason Stubbs (RETIRED) gentoo-dev 2005-04-15 05:43:09 UTC
Reverting this for the next release. Will bring it back later on when it can be done not so messily.
Comment 14 Jason Stubbs (RETIRED) gentoo-dev 2005-07-24 06:11:50 UTC
*** Bug 100075 has been marked as a duplicate of this bug. ***
Comment 15 Jason Stubbs (RETIRED) gentoo-dev 2005-07-24 06:12:15 UTC
People complaining 
Comment 16 Pietro Franchi 2005-08-07 07:17:51 UTC
Yes, I was wandering why I dind't have anymore that wonderful feature...I'd like
to have it back, possibly enabled by FEATURE. :)
Comment 17 Thomas Eckert 2005-08-07 13:35:37 UTC
i have the impression that re-inventing the wheel is very popular nowadays:
comment #3 suggests a way how to use the perfectly well working xterm-title with
screen. a minimalistic example for the "comment #3 way" is:
  caption string "%n %t [%h]"
the "[%h]"-part is exactly what is shown in the xterm-title.

so no need for a new FEATURE.
Comment 18 Gherald 2005-09-17 22:21:31 UTC
(in reply to comment #17)

I already have a windowlist status line as seen in comment #1.  I have no use
for additionally duplicating the xterm's window title display inside screen.

I do, however, want portage to update my SCREEN window title, as it used to.

I should not have to continue maintaining a personal output.py patch for this.

I vote for the FEATURES solution.
Comment 19 Jason Stubbs (RETIRED) gentoo-dev 2005-10-16 07:37:57 UTC
So, what is required here? 
FEATURES="-xtermtitles screentitles" ? 
 
 
Comment 20 MAL 2006-01-05 08:28:50 UTC
Sounds perfect.
Comment 21 Dietrich Moerman 2007-04-25 14:36:11 UTC
I guess sthis still isn't in Portage. Any updates...?
Comment 22 Alec Warner archtester Gentoo Infrastructure gentoo-dev Security 2007-04-25 16:05:55 UTC
I somehow doubt this patch still applies; I know the make.conf stuff will fail, and there is probably a better way to do titles overall.

-Alec
Comment 23 Zac Medico gentoo-dev 2007-04-25 16:42:36 UTC
I think we should make this controlled via and emerge command line option.  You'll be able to put the option in EMERGE_DEFAULT_OPTS to enable it by default.  I don't think FEATURES should be used for simple changes in the emerge UI like this.  For example, color output is controlled by the --color option rather than a FEATURE.