top | item 29505183

(no title)

junkblocker | 4 years ago

Oh, you are right! This works by looking at /proc/$ppid/fd/1

    format = """$all\
    ${custom.tty}"""

    [custom.tty]
    description = "tty"
    when = 'true'
    command = """
    tpid=$(ps -o pid= -p "$(($(ps -o sid= -p "$$")))")
    tpid=$(( tpid + 0 ))
    readlink /proc/$tpid/fd/1 | sed -e 's|/dev/||'
    """
    format = ' [$output]($style)'
    shell = ["bash", "--noprofile", "--norc"]
    style = 'blue'

discuss

order

No comments yet.