• Re: [ONTOPIC] Screen 5.x and hardstatus lines

    From jayjwa@jayjwa@atr2.ath.cx.invalid to comp.os.linux.misc on Fri Nov 13 15:43:37 2026
    From Newsgroup: comp.os.linux.misc

    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!"
    --- Synchronet 3.22a-Linux NewsLink 1.2