Concepts
Shell integration
Let desk change directories, show the current workspace in your prompt, and complete workspace names in zsh, oh-my-zsh, bash, and fish.
A program can't change its parent shell's directory, so desk new and desk cd need a small shell function. The same integration adds the current workspace to your prompt and completes commands and workspace names.
Set It Up#
Add one line to your shell's startup file, after any prompt or theme setup:
Terminal
# ~/.zshrc
eval "$(desk init zsh)"Install desk as a custom plugin:
Terminal
mkdir -p "$ZSH_CUSTOM/plugins/desk"
echo 'eval "$(desk init zsh)"' > "$ZSH_CUSTOM/plugins/desk/desk.plugin.zsh"Then add desk to plugins=(...) in ~/.zshrc.
Terminal
# ~/.bashrc
eval "$(desk init bash)"Terminal
# ~/.config/fish/config.fish
desk init fish | sourceOpen a new terminal to load it.
What Your Prompt Shows#
Inside a workspace, your prompt starts with the workspace name and your directory relative to it:
Output
(misty-ember/src/api) ➜ apiOutside workspaces nothing changes. The prefix is added in front of your existing prompt, so it works with oh-my-zsh themes and fish's default prompt.
Placing It Yourself#
Set DESK_PROMPT_DISABLE=1 before loading the integration and use desk_prompt_info, which prints misty-ember/src/api inside a workspace and nothing elsewhere:
Terminal
setopt prompt_subst # oh-my-zsh enables this already
PROMPT='$(desk_prompt_info) '$PROMPTTerminal
PS1='$(desk_prompt_info) '$PS1Call desk_prompt_info from your fish_prompt function.
What the Function Does#
desk newanddesk cdmove you to the workspace desk prints.desk rmmoves you to your home directory if you deleted the workspace you were in.- Every other command runs the
deskexecutable unchanged.
Without integration, desk new still works and prints the new workspace's path. Use cd "$(desk path NAME)" in place of desk cd.