justjanne / powerline-go

A beautiful and useful low-latency prompt for your shell, written in go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Module for screen session

andrzejnovak opened this issue Β· comments

It would be very convenient to have :)

I have not tested this fully, but you can use the STY environment variable for this where the screen session name/id is stored.

function _update_ps1() {
    PS1="$($GOPATH/bin/powerline-go -error $? -jobs $(jobs -p | wc -l) \
         -cwd-mode plain \
         -colorize-hostname \
         -numeric-exit-codes \
         -shell-var STY \
         -shell-var-no-warn-empty \
         -modules time,venv,user,host,shell-var,cwd,perms,git,hg,jobs,exit )"
}
  • -shell-var STY displays the screen session name/id
  • -shell-var-no-warn-empty does show nothing if the variable does not exist
  • -modules [..] shell-var includes the variable in the output

Without screen:

image

see: #276

Inside a screen session:

image

@CWempe I've put a PR for this some time back, but nice to know it could also be solved without. The one downside for me is that including both id and name is fairly long

I agree. A dedicated module would be best.
I do not like the bright yellow either. πŸ˜†

Maybe you could add an option to your PR to show/hide the id?
I barely use screen, but maybe it would make sense for some users to also see the id if there are multiple screen sessions with the same name.
I don't know if anybody would need this. πŸ˜‰

Can you pass options to modules or would it have to be a separate module?

Admittedly I don't know if anyone uses screen with just the number id's,

Can you pass options to modules or would it have to be a separate module?

I don't know. I assumed so. πŸ˜„
Aren't there other powerline-go arguments that are specific to modules?

Admittedly I don't know if anyone uses screen with just the number id's,
No, but there might be cases where there are two sessions named 1234.test and 5678.test.
So you would need the id to differentiate there sessions.

But maybe nobody cares.
You can still implement this after somebody asks for this feature. πŸ˜‰