alacritty icon indicating copy to clipboard operation
alacritty copied to clipboard

Is it possible to have a hybrid title?

Open MostHated opened this issue 5 years ago • 10 comments

Hey there, I was wondering if it's possible to have a mixture of the dynamic and fixed title. Example being:

___________________________
| Directory - Alacritty    |
---------------------------

Where the first part of the title remains dynamic but has a fixed "- Alacritty" at the end.

The reason being is I have scripts and launchers that look for the text in the title bar for different things, such as I use AutoHotKey to use Windows Key + f12 for terminal, if it's already launched but not visible it restores the window to view, if it is currently in view, it will minimize it, if it doesn't detect one at all, it launches a new one. I wanted to extend this a bit based on the directory the terminal is currently in, but with the current settings (as far as I can tell) I can only do directory or fixed title and not both. Is there a way to accomplish this already built in that I am just not seeing by chance?

Thanks, -MH

MostHated avatar Nov 16 '20 19:11 MostHated

Using scripts to detect application based on the window title is the problem here, not the inability of Alacritty to have its name in the title.

If your terminal applications change Alacritty's title to something you don't like, you should be able to just disable the dynamic title feature and it would work just fine?

Is it correct that you're running Windows?

chrisduerr avatar Nov 16 '20 20:11 chrisduerr

Well, we may provide a format string for title, but I'm not sure if there's a huge demand for it. Could look like

window.title_format: "Alacritty - {}"

kchibisov avatar Nov 16 '20 20:11 kchibisov

Is there any other terminal doing that? A format string just seems pointlessly complicated. And there should be no need for Alacritty to keep Alacritty in its title.

Every desktop environment should be aware that Alacritty is Alacritty. The window icon is there, it should be very clear to the user, every interaction should be based on the application itself, not the title. I see no necessity to keep the name of the application in the title?

And even then dynamic_title can still be disabled if you're out for some kind of hack. But a hack isn't a good reason to implement a feature.

chrisduerr avatar Nov 16 '20 20:11 chrisduerr

I was/have been using Terminus, which had this type of functionality, but I have been having a decent enough amount of issues with it displaying things properly, and in general just like Alacritty a lot more, so I was hoping to be able to reuse my current setup for the most part if possible. There were a few others that had a way to simply have the application name appended to the title, but not nearly as configurable as that, and really, I don't need it to be. I was just hoping to have the current directory followed by - Allacrity.

Seen here, near the bottom has the fixed suffix which could be appended to the end of the title at all times, which is what I was using to detect the windows.

MostHated avatar Nov 16 '20 20:11 MostHated

I'm going to keep this open, but generally I don't like the argument that this is required for an AutoHotKey script. That's no justification to add this.

If there are any genuine arguments why this would be necessary or beneficial, I'd be happy to hear them though.

chrisduerr avatar Nov 16 '20 21:11 chrisduerr

Just a quick possibly related question, is there currently any way to differentiate a terminal open as a user and one open with elevated privileges?

MostHated avatar Nov 22 '20 21:11 MostHated

Terminal, or a shell? Either way that is completely unrelated to this, so please open a different issue if you're looking for help. But we have nothing to do with the shell.

chrisduerr avatar Nov 22 '20 21:11 chrisduerr

I meant terminal, wasn't sure if there was a way to tell aside from it actually saying so in the title. No worries though if there isn't. Was just checking.

MostHated avatar Nov 22 '20 21:11 MostHated

Well, we may provide a format string for title, but I'm not sure if there's a huge demand for it. Could look like

window.title_format: "Alacritty - {}"

Another use case for this functionality might be using Alacritty with time tracker software like ActivityWatch which track usage of applications by window title.

Samgarr avatar Sep 26 '21 16:09 Samgarr

hi, so, why not do it with bash shell's PS1 environment variable? so:

  • the "\[\e]0;\w\a\]" is for setting title, here \w stands for current directory
  • so, you can put whatever text you want to be there
  • but yeah, this method works only with bash (& compliant others)
PS1="\[\e]0;\w - TEXTGOESHERE\a\]"
PS1+=
...

Play the foll vid @2X 😅 (yes, it's supported right here in browser)

https://user-images.githubusercontent.com/19423063/155855527-9893e6e5-121e-4ddf-83c9-2da84edcd1b8.mp4


for personal reference: ^⇧c for copying in alacritty , ref: https://github.com/alacritty/alacritty/issues/5202

goyalyashpal avatar Feb 26 '22 18:02 goyalyashpal