• [ONTOPIC] Screen 5.x and hardstatus lines

    From jayjwa@3:633/10 to All on Thursday, October 29, 2026 12:25:58
    First, my apologies for posting about Linux in comp.os.linux.misc, but I
    need a senior GNU Screen 5.x .screenrc config file programmer to sort
    this mess out. When Screen 4.x jumped to Screen 5.x, it broke hardstatus strings and I've not gotten them to work correctly since. Last night I
    spent 60 minutes on this without results. We all love breaking config
    file changes, don't we?

    What I had before (the newsreader might wrap this) that I'd like to more
    or less emulate in Screen 5-ese:
    hardstatus alwaysfirstline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{=R}%n*%f %t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][ %{y}Load: %l%{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]'

    This places, in color, the hostname in brackets to the left, each new
    window with its title, in color, along the top, and then the load
    average in brackets along with the date/time achored to the right. All
    that breaks in 5 but I can still see the hostname and each new window
    title. Just subbing the new color codes does not work. I already tried
    that.

    My best attempts thus far:
    hardstatus string '%{ 1;0}[ %{12;15}%H %{1;0}][% %{ 0;7}%?%-Lw%?%{13}(%{15}%n*%f%t%?(%u)%?%{5})%{-b 7}%?%+Lw%?%?%= %{2}][%{6} %D %M %d %{2}%c %{2}]'

    This has colors, but it goes off the rails on the right side when you
    added more and more windows. I'm working off this: https://www.pingle.org/2026/04/26/screen-5-status-color-changes

    There's more descriptions in the 3990 line man page, but I'm already
    reading one epic poem (Dante's Divine Comedy) and there's only so much
    time in the day.

    Here's another attempt that doesn't work, either:
    hardstatus string '%{ 1;0}[ %{12;15}%H %{1;0}] (%X) %Y %M %d %c%a'

    The Arch and Gentoo examples don't work; at this point I'd be happy with something close to what I had. I don't really care what color(s) (I use
    dark terminals, btw). I could use Tmux but at this point it's personal.

    --
    PGP Key ID: 781C A3E2 C6ED 70A6 B356 7AF5 B510 542E D460 5CAE
    "The Internet should always be the Wild West!"

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Carlos E.R.@3:633/10 to All on Thursday, October 29, 2026 20:39:50
    On 2026-10-29 17:25, jayjwa wrote:
    First, my apologies for posting about Linux in comp.os.linux.misc, but I
    need a senior GNU Screen 5.x .screenrc config file programmer to sort
    this mess out. When Screen 4.x jumped to Screen 5.x, it broke hardstatus strings and I've not gotten them to work correctly since. Last night I
    spent 60 minutes on this without results. We all love breaking config
    file changes, don't we?

    Just posting so that you know that people read your post, even if we are engrossed in OT posts, but I'm not qualified to answer it. Sorry.

    Not familiar with Screen; I use Tmux myself, but I don't touch the
    status line.

    --
    Cheers, Carlos.
    ES??, EU??;

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Nuno Silva@3:633/10 to All on Friday, October 30, 2026 01:25:16
    On 2026-10-29, Carlos E.R. wrote:

    On 2026-10-29 17:25, jayjwa wrote:
    First, my apologies for posting about Linux in comp.os.linux.misc, but I
    need a senior GNU Screen 5.x .screenrc config file programmer to sort
    this mess out. When Screen 4.x jumped to Screen 5.x, it broke hardstatus
    strings and I've not gotten them to work correctly since. Last night I
    spent 60 minutes on this without results. We all love breaking config
    file changes, don't we?

    Just posting so that you know that people read your post, even if we
    are engrossed in OT posts, but I'm not qualified to answer it. Sorry.

    Not familiar with Screen; I use Tmux myself, but I don't touch the
    status line.

    (I was a bit confused as I expected this to be about a "hard" status
    line, but seems to be a repurposing of the hard status line for
    graphical terminal emulators?)

    --
    Nuno Silva

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Carlos E. R.@3:633/10 to All on Saturday, October 31, 2026 10:40:58
    On 2026-10-30 02:25, Nuno Silva wrote:
    On 2026-10-29, Carlos E.R. wrote:

    On 2026-10-29 17:25, jayjwa wrote:
    First, my apologies for posting about Linux in comp.os.linux.misc, but I >>> need a senior GNU Screen 5.x .screenrc config file programmer to sort
    this mess out. When Screen 4.x jumped to Screen 5.x, it broke hardstatus >>> strings and I've not gotten them to work correctly since. Last night I
    spent 60 minutes on this without results. We all love breaking config
    file changes, don't we?

    Just posting so that you know that people read your post, even if we
    are engrossed in OT posts, but I'm not qualified to answer it. Sorry.

    Not familiar with Screen; I use Tmux myself, but I don't touch the
    status line.

    (I was a bit confused as I expected this to be about a "hard" status
    line, but seems to be a repurposing of the hard status line for
    graphical terminal emulators?)


    Google AI: The screen command in Linux is a terminal multiplexer that
    allows you to start a terminal session and then completely detach from
    it. This leaves your processes running in the background, making it an invaluable tool for executing long-running tasks over SSH without
    worrying about network drops or accidental disconnections.

    Ie, similar to tmux. I gather you can customize the status line.

    --
    Cheers,
    Carlos E.R.
    ES??, EU??.

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Nuno Silva@3:633/10 to All on Saturday, October 31, 2026 10:33:05
    On 2026-10-31, Carlos E. R. wrote:

    On 2026-10-30 02:25, Nuno Silva wrote:
    On 2026-10-29, Carlos E.R. wrote:

    On 2026-10-29 17:25, jayjwa wrote:
    First, my apologies for posting about Linux in comp.os.linux.misc, but I >>>> need a senior GNU Screen 5.x .screenrc config file programmer to sort
    this mess out. When Screen 4.x jumped to Screen 5.x, it broke hardstatus >>>> strings and I've not gotten them to work correctly since. Last night I >>>> spent 60 minutes on this without results. We all love breaking config
    file changes, don't we?

    Just posting so that you know that people read your post, even if we
    are engrossed in OT posts, but I'm not qualified to answer it. Sorry.

    Not familiar with Screen; I use Tmux myself, but I don't touch the
    status line.

    (I was a bit confused as I expected this to be about a "hard" status
    line, but seems to be a repurposing of the hard status line for
    graphical terminal emulators?)


    Google AI: The screen command in Linux is a terminal multiplexer that
    allows you to start a terminal session and then completely detach from
    it. This leaves your processes running in the background, making it an invaluable tool for executing long-running tasks over SSH without
    worrying about network drops or accidental disconnections.

    Ie, similar to tmux. I gather you can customize the status line.

    Ask it what is a hard status line, to see if it gets that part right :-)

    --
    Nuno Silva

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From jayjwa@3:633/10 to All on Saturday, October 31, 2026 10:56:45
    Nuno Silva <nunojsilva@invalid.invalid> writes:

    Google AI: The screen command in Linux is a terminal multiplexer that
    allows you to start a terminal session and then completely detach from
    it. This leaves your processes running in the background, making it an
    invaluable tool for executing long-running tasks over SSH without
    worrying about network drops or accidental disconnections.

    Ie, similar to tmux. I gather you can customize the status line. Right...it's the *doing* part I'm having an issue with.

    Ask it what is a hard status line, to see if it gets that part right :-)
    /set nothink
    Set 'nothink' mode.
    What is a GNU Screen hardstatus line?
    A **GNU `screen` hardstatus** line is a special configuration
    string defined in the `.screenrc` file (or passed via command-line
    options) that controls the content displayed on the very last
    line of every visible screen window.


    qwen3.5:9b ends up in the dirt and never did spit out a hardstatus
    line. This is over 100+ lines but I'll give you a few highlights. It
    does notice the syntax change from 4 -> 5 but then says you don't need
    to change anything (this obviously is wrong).

    ollama run qwen3.5:9b
    """Convert this GNU Screen 4 hardstatus .screenrc line into GNU Screen 5 syntax:
    ... hardstatus alwaysfirstline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{= R}%n*%f %
    ... t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][ %{y}Load: %l %{g}][%{B}%Y-%m-%d %{W}%c:%s
    ... %{g}]
    ... """


    * Is there an actual syntax change?

    * Ah! In GNU Screen 5.0, there was a significant update regarding
    **color definitions**. They moved from using color names like `G`,
    `R` to expecting palette indices or terminfo capabilities if colors
    aren't pre-defined. But usually, you define them in `.screenrc`
    first.

    * Actually, the most common answer to this question (often found in
    Linux forums) is that **Screen 5 does not require syntax changes** for `hardstatus` variables themselves (`%H`, `%n`), but the color attribute
    flags like `%{= G}` are often simplified or standardized.

    * **Correction:** I need to check if there were breaking changes
    regarding the hardstatus line specifically between version 4 and 5.

    * According to the GNU Screen ChangeLog: "hardstatus" support has been
    present since early versions.

    * However, in version 4.03-4.09 (and subsequent), syntax evolved.


    Anyway, this is as close as I (the carbon-based life form) have been
    able to get it. It still has some issues when multiple windows open
    regarding color, but it's better than nothing, has color, shows the load
    avg, and the time across the top. You need to "program" the backticks
    first.

    # Program "backtick" number one. Use it like so: %1`
    # backtick (id num) (seconds in lifespan) (autorefresh in seconds)
    # (cmd) (args of command)
    backtick 1 10 10 awk -F' ' '{print $1, $2, $3}' /proc/loadavg # Find loadavg and print
    backtick 2 10 10 date '+%a %h %d %H:%M:%S' # Another way to print date
    hardstatus alwaysfirstline

    hardstatus string '%{ 1;7}[ %{12;15}%H %{1;7}][% %{0;7}%?%-Lw%?%{13}(%{15}%n*%f%t%?(%u)%?%{5})%{1}] %52= %{2}%1` %72= %{1;0}[%{12;15}%D %M %d %c%{1;0}]'


    --
    PGP Key ID: 781C A3E2 C6ED 70A6 B356 7AF5 B510 542E D460 5CAE
    "The Internet should always be the Wild West!"

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From Nuno Silva@3:633/10 to All on Sunday, November 01, 2026 00:50:39
    On 2026-10-31, jayjwa wrote:

    Nuno Silva <nunojsilva@invalid.invalid> writes:

    Google AI: The screen command in Linux is a terminal multiplexer that
    allows you to start a terminal session and then completely detach from
    it. This leaves your processes running in the background, making it an
    invaluable tool for executing long-running tasks over SSH without
    worrying about network drops or accidental disconnections.

    Ie, similar to tmux. I gather you can customize the status line.
    Right...it's the *doing* part I'm having an issue with.

    Ask it what is a hard status line, to see if it gets that part right :-) >>>> /set nothink
    Set 'nothink' mode.
    What is a GNU Screen hardstatus line?
    A **GNU `screen` hardstatus** line is a special configuration
    string defined in the `.screenrc` file (or passed via command-line
    options) that controls the content displayed on the very last
    line of every visible screen window.

    Showing on the last line of the "window" "content area" is a fallback
    in absence of a "harware status line". When it's present, unless
    configured otherwise, AFAIK GNU screen will make use of the actual
    status line of the terminal.

    --
    Nuno Silva

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)
  • From jayjwa@3:633/10 to All on Friday, November 13, 2026 15:43:37
    Got it. Where are the OOooo's and Aaaahh's? I basically slayed the
    config file equal of the Nemean Lion here. Which is more complex?

    Assembly language:
    mov rax, 1 ; write
    mov rdi, 1 ; stdout
    mov rsi, msg
    mov rdx, msg.len
    syscall

    TECO editor:
    * QB,ZFSsome text$other text$$

    GNU Screen 5.x hardstatus:

    hardstatus string '%{1}[%{12;15}%H %{1}][% %{0;7}%?%-Lw%?%{13}(%{15}%n*%f%t%?(%u)%?%{5})%{1}] %42=%S%58=%{2}%1`%75= %{1;0}[%{12;15}%D %M %d %c%{1;0}]'

    Right. Not even close. I added the Session tag towards the middle. Full .screenrc. I win; the impossible has been done on this Friday, the
    thirteeth day of November in the year 2026, and the Gnu Screen config
    file Sphinx has thrown itself into the river.

    ## GNU Screen Config file for v5.x
    ##
    ## Assumes dark terminal (adjust colors for others)
    ## Note that Screen 4.x has a different hardstatus line format from 5.x.
    ## For more ideas, see: https://wiki.archlinux.org/title/GNU_Screen
    ## https://www.pingle.org/2026/04/26/screen-5-status-color-changes
    ## The Screen novel itself, around line 2949.

    # Enable more colors by setting TERM correctly.
    term screen-256color
    #term screen-w

    # Shut off ultra-annoying XON/XOFF flow control that messes up Emacs
    # or Amis ability to save files when used with the DEC systems.
    defflow off

    # Visual bell. Just flash instead of beep.
    vbell on

    # Don't count new windows as a login
    deflogin off

    # Mouse tracking allows to switch regions by clicking.
    # Unforunately, this disables highlight copy/paste with
    # click-dragging.
    mousetrack off

    # Background color erase
    bce on

    # Detach on hangup
    autodetach on

    # Don't display the copyright page, just get down to business.
    startup_message off

    # Emulate .logout message
    pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."

    # Advertise hardstatus support to $TERMCAP
    termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'

    # Make the shell in every window a login shell
    #shell -$SHELL

    # Tell screen to treat the input characters between 128
    # and 159 as control functions
    c1 on
    # Or by default
    defc1 on

    # Set every new windows hardstatus line to something descriptive.
    defhstatus "screen: ^En (^Et)"

    # Set scrollback buffer size: good to see what's scrolled off
    # the screen.
    defscrollback 1000

    # Enable support for the "alternate screen" capability in all windows
    altscreen on

    # Various terminal tweaks. This stuff might not be needed anymore.
    # It's left in place because it works as-is.
    # Xterm understands both im/ic and doesn't have a status line.
    # Note: Do not specify im and ic in the real termcap/info file as
    # some programs (e.g. vi) will not work anymore.
    termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
    terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l

    # 80/132 column switching must be enabled for ^AW to work
    # Change init sequence to not switch width
    termcapinfo *term Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l termcapinfo rxvt Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l

    # Make the output buffer large for (fast) xterms.
    termcapinfo *term OL=1800
    termcapinfo *xvt OL=1800

    # Tell screen that xterm can switch to dark background and has function
    # keys.
    termcapinfo *term 'VR=\E[?5h:VN=\E[?5l'
    termcapinfo *term 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
    termcapinfo *term 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'

    termcapinfo *xvt 'VR=\E[?5h:VN=\E[?5l'
    termcapinfo *xvt 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
    termcapinfo *xvt 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'

    # Special xterm hardstatus: use the window title.
    termcapinfo *term 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
    termcapinfo *xvt 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'

    termcapinfo *term 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'
    termcapinfo rxvt 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'

    # emulate part of the 'K' charset
    termcapinfo *term 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337' termcapinfo rxvt 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'

    # xterm-52 tweaks:
    # - uses background color for delete operations
    termcapinfo * be

    # Wyse-75-42 must have flow control (xo = "terminal uses xon/xoff")
    # essential to have it here, as this is a slow terminal.
    termcapinfo wy75-42 xo:hs@

    # New termcap sequences for cursor application mode.
    termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J

    # make hp700 termcap/info better
    termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'

    # Extend the vt100 family desciption by some sequences.
    termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
    terminfo vt200* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
    termcapinfo linux C8
    termcapinfo rxvt C8

    # For Epic IRC client
    termcap vt102 'AF=\E[3%dm:AB=\E[4%dm'
    terminfo vt102 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'
    termcap linux 'AF=\E[3%dm:AB=\E[4%dm'
    terminfo linux 'AF=\E[3%p1%dm:AB=\E[4%p1%dm'

    # Keybindings
    # Prepend/append register [/] to the paste if ^a^] is pressed.
    register [ "\033:se noai\015a"
    register ] "\033:se ai\015a"
    bind ^] paste [.]

    # Send backspace when backarrow key pressed.
    bindkey "^H" stuff "^H"

    # Use UTF8 by default
    defutf8 on
    truecolors on

    # Method one, only for Screen 4.x:
    #backtick 0 5 5 "/bin/date" '+%Y-%m-%d'
    #backtick 1 5 5 "/bin/date" '+%H:%M'
    #hardstatus alwaysfirstline '%{#00ff00}[ %H ][%{#ffffff}%= %{7}%?%-Lw%?%{1;0}%{1}(%{15}%n%f%t%?(%u)%?%{1;0}%{1})%{7}%?%+Lw%?%? %=%{#00ff00}][ %{#00a5ff}%{6}%0` %{#ffffff}%{7}%1`%{#00ff00} ]'

    # Method two, only for Screen 4.x:
    #hardstatus alwaysfirstline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{= R}%n*%f %t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][ %{y}Load: %l %{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]'

    # Method three, only for Screen 5.x.
    # Program "backticks".
    # Use them like so: %1` <-- outputs backtick #1 result in your status line
    # backtick (id num) (seconds in lifespan) (autorefresh in seconds) (cmd) (args of command)

    # Find loadavg and print, assign to backtick number 1
    backtick 1 10 10 awk -F' ' '{print $1, $2, $3}' /proc/loadavg
    # Another way to print date, assign to backtick number 2
    backtick 2 10 10 date '+%a %h %d %H:%M:%S'

    # Location of hardstatus line.
    hardstatus alwaysfirstline

    # This hardstatus string makes TECO blush.
    # Hostname, tasks, session ID, loadavg, date (day-month-day digit-time) hardstatus string '%{1}[%{12;15}%H %{1}][% %{0;7}%?%-Lw%?%{13}(%{15}%n*%f%t%?(%u)%?%{5})%{1}] %42=%S%58=%{2}%1`%75= %{1;0}[%{12;15}%D %M %d %c%{1;0}]'

    ## EOF

    --
    PGP Key ID: 781C A3E2 C6ED 70A6 B356 7AF5 B510 542E D460 5CAE
    "The Internet should always be the Wild West!"

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)