0

I've created a ~/.screenrc file based on another question here:

autodetach on startup_message off hardstatus alwayslastline shelltitle 'bash' hardstatus string '%{gk}[%{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= w}%?%+Lw%?%? %{g}][%{d}%l%{g}][ %{= w}%Y/%m/%d %0C:%s%a%{g} ]%{W}' 

Which is great, except that it doesn't contain anything that's useful to me! What I would like the hardstatus string to display is the "name" I give when I started screen.

For example, if I start a screen session as follows:

$ screen -S bluetoothctl bluetoothctl 

I would like the string "bluetoothctl" displayed in the status line/hardstatus string.

How do I do that?

1 Answer 1

3

Assuming you're looking for the session name (the parameter after -S) then the escape sequence %S would show this.

So with a ~/.screenrc file reading

hardstatus alwayslastline hardstatus string %S 

Now if I do screen -S foo the bottom line of my display shows the word "foo"

3
  • Brilliant! Thanks a million :) Seems incredible to me this isn't set up by default. How does anyone keep up with all those screens? I suppose that has something to do with how one uses screen - I am probably different than most. Commented May 15 at 1:58
  • 1
    @Seamus A popular addon was Byobu, which is a config template/wrapper for Screen that adds a fancy status line by default. The modern answer is to switch to tmux, which has all this by default. (And fewer security holes.) Zellij seems to be another fancy option. (Befure tmux I used to configure screen to use the Xterm titlebar as the 'hardstatus', with just the inner terminal's title plus a screen/window ID e.g. "irssi (star.irc.1)".) Commented May 15 at 4:44
  • @grawity: I suppose there's a certain amount of inertia involved, but frankly, I've tried tmux & didn't care for it. Commented May 15 at 22:05

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.