TOPIC: X WINDOW SYSTEM
Changing tab titles in the macOS Terminal app using the command line
25th December 2024One thing that I have noticed with the macOS terminal app that I have not seen with its Linux counterparts is that the tab titles can get stuck after an SSH session to a remote server. Thus, I decided to see if they could be changed or reset. Handily, a single command will do just that:
echo -ne "\033]1;New Tab Title\007"
In a UNIX shell (BASH, ZSH, etc.), the echo
command outputs text, and it is the text that changes a tab title. Here, the -ne
options both negate the generation of a newline (which would be the function of the -n
switch if used on its own) and interprets the escape characters included in the text (which would be the function of the -e
switch if used on its own).
Within the text string \033
is the octal representation of the escape character that initiates the control sequence that follows it. This is ]1;
, the Operating System Sequence (OSC) for setting the tab title in this case, more generally the icon and window title in other circumstances. The text New Tab Title should be self-explanatory, while \007
is the octal representation of the bell character (BEL) that terminates the OSC.
Because I wanted to have the current working directory path as the title, I made a small modification to do this dynamically:
echo -ne "\033]1;$(pwd)\007"
It is the $(pwd)
portion that does just that, taking the output of the pwd
command and adding it into the string. Thus, I see what is open in each tab. That stopped me ending up in the wrong one, and I even added an alias into the .zshrc
file to make it easier to invoke. The functionality may be a more general UNIX or Linux feature, though I have not had opportunity or reason to try it just yet.
All Change?
19th September 2011Could 2011 be remembered as the year when the desktop computing interface got a major overhaul? One part of this, Windows 8, won't be with us until next year, but there has been enough happening so far this year that has resulted in a lot of comment. With many if not all the changes, it is possible to detect the influence of interfaces used on smartphones. After all, the carry-over from Windows Phone 7 to the new Metro interface is unmistakeable.
Two developments in the Linux world have spawned a hell of an amount of comment: Canonical's decision to develop Unity for Ubuntu and the arrival of GNOME 3. While there have been many complaints about the changes made in both, there must be a fair few folk who are just getting on with using them without complaint. Maybe there are many who even quietly like the new interfaces. While I am not so sure about Unity, I surprised myself by taking to GNOME Shell so much that I installed it on Linux Mint. It remains a work in progress, as does Unity, but it'll be very interesting to see it mature. Perhaps a good number of the growing collection of GNOME Shell plugins could make it into the main codebase. If that were to happen, I could see it being welcomed by a good few folk.
There was little doubt that the changes in GNOME 3 looked daunting, so Ubuntu's taking a different approach is understandable until you come to realise how change that involves anyway. With GNOME 3 working so well for me, I feel disinclined to dally very much with Unity at all. In fact, I am writing these words on a Toshiba laptop running UGR, effectively Ubuntu running GNOME 3, and that could become my main home computing operating system in time.
For those who find these changes not to their taste, there are alternatives. Some Linux distributions are sticking with GNOME 2 as long as they can, and there apparently has been some mention of a fork to keep a GNOME 2 interface available indefinitely. However, there are other possibilities such as LXDE and XFCE out there too. In fact, until GNOME 3 won me over, LXDE was coming to mind as a place of safety until I learned that Linux Mint was retaining its desktop identity. As always, there's KDE too, but I have never warmed to that for some reason.
The latest version of OS X, Lion, also included some changes inspired by iOS, the operating system that powers both the iPhone and iPad. However, while the current edition of PC Pro highlights some disgruntlement in professional circles regarding Apple's direction, this does not seem to have aroused the kind of ire that has been abroad in the world of Linux. Is it because Linux users want to feel that they are in charge and that iMac and MacBook users are content to have decisions made for them so long as everything just works? Speaking for myself, the former description seems to fit me, though having choices means that I can reject decisions that I do not like so much.
At the time of writing, the release of a developer preview of the next version of Windows has been generating a lot of attention. It also appears that changes are headed for Windows users too. However, I get the sense that a more conservative interface option will be retained and that could be essential for avoiding the alienation of corporate users. After all, I cannot see the Metro interface gaining much favour in the working environment when so many of us have so much to do. Nevertheless, I plan to get my hands on the developer preview to have a look (the weekend proved too short for this). It will be very interesting to see how the next version of Windows develops, and I plan to keep an eye on it as it does so.
It now looks as if many will have their work cut out if they are to avoid where desktop computing interfaces are going. Established paradigms are being questioned, particularly as a result of touch interfaces on smartphones and tablets. Wii and Kinect have involved other ways of interacting with computers, too, so there's a lot of mileage in rethinking how we work with computers. So far, I have been able to deal with the changes in the world of Linux, but I am left wondering about the changes that Microsoft is making. After Vista, they need to be careful and they know that. Maybe, they'll be better at getting users through changes in computing interfaces than others, but it'll be very interesting to see what happens. Unlike open source community projects, they have the survival of a massive multinational at stake.