jamesob / desk

A lightweight workspace manager for the shell
MIT License
2.53k stars 110 forks source link

Give a way to add current desk in the zsh prompt #45

Open martylamoureux opened 8 years ago

martylamoureux commented 8 years ago

Hi ! Desk is great, but it would be even better if it's possible to show the current desk into the zsh (for instance) prompt, in order to know where we are.

I see in the demo gif in the readme that you have a "(venv)" prepending your prompt, is there anyway to have the something but with the name of the current desk ?

jamesob commented 8 years ago

Hey Marty, thanks for the issue. Thanks to @rnewton and https://github.com/jamesob/desk/pull/14, this is pretty easy -- just include ${DESK_NAME} somewhere in your prompt.

For example (using oh-my-zsh), I do

PROMPT=' [%w %T] %B%{$fg[blue]%}%3d%{$reset_color%} $(git_prompt_info) $(git_prompt_status)$(git_prompt_ahead)%{$reset_color%}${DESK_NAME}
 $ '

Does that help?

Maybe we should update the README with some of this info.

martylamoureux commented 8 years ago

Okay ! it works ! I'm using iTerm + zsh + oh-my-zsh + Agnoster, and I found a way to add a "segment" in the prompt when we are in a desk.

If anybody is interested in it, I can give the instructions to get it.

Example

jamesob commented 8 years ago

Nice @martylamoureux! Maybe we can spin up a wiki page or something.

vaibhavguptaIITD commented 8 years ago

This is great @martylamoureux! Please share the instructions for this.

lvancrayelynghe commented 8 years ago

If anybody need this, here is my Agnoster modified theme with Desk integration (and some more goodies)

desk

mosic commented 8 years ago

I also played around with this today and made a simple zsh theme (based on robbyrussell), you can see it here: https://github.com/mosic/dotfiles/blob/master/zsh/themes/mosic.zsh-theme

It looks like this:

image

Using ◲ in the prompt looks great, thanks for the idea.

McKean commented 8 years ago

@mosic beautiful, thanks.

melMass commented 6 years ago

For anyone using powerline9k this is the correct way to use it:

# DESK INTEGRATION
prompt_desk() {
    if [ ! -z "${DESK_NAME// }" ]; then
        "$1_prompt_segment" "$0" "$2" "red" "grey" "$POWERLEVEL9K_DESK_ICON $DESK_NAME" "#"
    fi
}

POWERLEVEL9K_DESK_BACKGROUND="black"
POWERLEVEL9K_DESK_FOREGROUND="white"
POWERLEVEL9K_DESK_ICON='\uf1d8'