Update window title in terminal #120
Labels
No Label
blocked
bug
build
documentation
duplicate
enhancement
finger
gemini
gopher
help wanted
http
in progress
invalid
local
needs-info
non-code
non-functional
non-urgent
question
release
rendering
suggestion
telnet
terminal
urgent
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sloum/bombadillo#120
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This one is maybe ill-advised maybe not. What I want to happen is that when a user launches bombadillo the window title (which would include tab title for tab aware applications) is changed to
Bombadillo
. This is very doable for all xterm based systems:That will set the title pretty effectively. I have tested this as working in both
st
and ingnome-term
(the two terminals I have on my system). The issues come when exiting. When I quit Bombadillognome-term
returns the title to whatever it was prior to starting Bombadillo. However,st
just keeps the title as Bombadillo.I read a little bit online and found that there are escape codes to get this value and push it onto an xterm stack and later take it off. However, this did not end up changing the behavior of either terminal.
I know the behavior I want is doable because
cmus
does it. They use curses though... which means there may be a lot of code behind it.I do not think this is in any way an urgent story. As such, I have not added it to the
2.1.0
milestone (yet). However, adding the title to the window does provide a certain amount of polish that would be nice to have. It also helps when visually grepping tabs or the like.I would love more tests in other terminals.
Additionally, youtube-dl seems to be using the same solution (implying theirs would fail in st as well):
824fa51165/youtube_dl/YoutubeDL.py (L528)
At present there is a branch called
window-title
that can be pulled to test this.I can confirm this behaviour in
st
on my system (installed from ubuntu repos, not built from source).rxvt-unicode
,gnome-terminal
,xfce4-terminal
do not have this issue.Interesting. So they must already be doing some kind of refresh on the title automagically. Leaving st...
What do you think? Is this:
If seems like this would be something that would fail gracefully in terms that did not support this... mostly. I think the st issue would be the worst of it. So it could be a nice thing to add... but I'm not sure if the st issue will be easily fixable or not, nor if it is limited to st (my guess is that it isnt, but given the sample size of 4 terms we are at 25%).
I tested two other terminals -
kitty
andxterm
- both worked as expected.st
provides some useful error information to stdout/error - startingst
from a terminal implies there are several escape sequences it can't interpret. This might help?To answer your question:
st
seems like an outlier hereI tested lynx, w3m, elinks, top, alsamixer and ranger, and none of these applications change the window title. A question for thought: is it rare for applications to do this, and if so, why?
At worst, this change could overwrite some status information the user might expect. For example, if I connect to rawtext club the title shows that I'm connected to a remote system. Bombadillo would change this information.
There is an example of someone disliking this feature in cmus here. It seems they built an option to disable this function.
Despite this, I don't see that the change could be an problem when Bombadillo is started from the desktop shortcut. A conservative approach might see the change limited to this situation.
Sorry for the wall of text, it's an interesting topic and an interesting idea - I agree with the 'polish' aspect and it makes sense for a GUI.
You bring up good questions. I, personally, like the title to reflect the application that is running. However, I do not necessarily feel that should be pushed onto users.
I do know from a bit of research that it seems like OSX's
terminal.app
does not support the escape codes to use the stack to pop on and off application names. This seems to be true ofst
as well. As a result, both allow the title to be changed, but do not automatically change it back.It is good to know that those are outliers... but does leave the question of expectations by users. I do know that it is easy to write a script that will always update the x title when an application is launched using args[0] as the title. But that leaves it to the user, which I suppose it probably the right place for it to be. It is their system after all.
I dont believe there is a way for me to know that Bombadillo is started from a desktop shortcut. However, we could add a flag (
-t
or the like) and have that be a part of theExec
line in thebombadillo.desktop
file. It would also be available to users that wanted to use it at their whim without forcing things or adding more parsing to the config...What do you think about that as an approach?
Yeah I don't disagree with this change, I just don't know enough about it to state the impact.
A command-line option for bombadillo would be a simple way to enable it. Alternatively, can the desktop file be configured to run a command that echos the escape sequence and then starts bombadillo?
Yeah, I'm not sure about the impact either :-/
If we do it as a command line option I can make the
bombadillo.desktop
file call it with the-t
like so:Exec=/usr/local/bin/bombadillo -t
. That could more or less achieve what you mentioned and allow users to run it that way if they want.Ok. I updated the branch to use the flag. If you dont mind pulling and trying it out, I would appreciate it!
I also updated the documentation (-h and man page). I'm not too happy with my wording for either. I also updated the syntax descriptions in ways I do not love, but was unsure how else to do so... any advice would be appreciated. It might be easier to see the changes by making a pull request. Let me know if you'd prefer that and I can make one, or feel free to do so yourself as well. Either way.
Oh there is a whole thing about writing the program synopsis that I did not know about...
I've set it to a single line:
bombadillo [options] [url]
, with the binary name in bold and the other two items in italic because:Another options if you prefer a longer, more detailed synopsis, is to do it similar to the man page for less.
I've pushed changes for the man page and main.go, so take a look at your convenience.
Oh! That is awesome. I feel like I intuitively knew that sort of... but was unsure and never quite sure how to write it. That less synopsis is intense.
I have created a pr ( #121 ) so that we can more easily comment on code. I looked for changes to what I had pushed (relating to your description) but did not find any. Did they go to this branch?
I pushed but did not commit...they are there now.
This has been implemented in #121 (we can reopen if any outstanding work is required).