Set the title to \(user.doingNow), and the Action to Run Coprocess. To use a Custom Action, add the component to the status bar and click Configure Component, then click Configure Action. I’m using this to complete the displayed entry. You can alternatively use a Custom Action component, which allows you to perform an action when you click it. iTerm 2 Custom Action component configuration Now you have your current doing entry in your status bar, updating every time the prompt displays. Set a background color and minimum width of 0. Click Configure Component and set it to display \(user.doingNow). Drag an interpolated string component into the status bar. In iTerm, go to Preferences->Profiles, select the profile to edit (probably the default), switch to the Session tab, and click Configure Status Bar at the bottom. Lastly, we set up the iTerm status bar to make use of the variable we’ve populated. I’m not good enough with zsh to offer a proper example, but the same thing should be doable in precmd. Iterm2_set_user_var doingNow "$(command cat ~/.doing_cache)" If you haven’t already, go to iTerm->Install Shell Integration to add the tools to your current shell. These examples use functions created by the iTerm shell integration. I suppose you could set up some kind of polling, but this seems like the best solution. Since all it’s going to do is cat a tiny text file, there’s no performance hit. I chose to do it with a prompt command, running every time the prompt displays. Now we need a way to refresh the variable. If you wanted to pare it down, only the doing view line is really needed. The setting of the variable is actually optional, as we’re going to be doing that again every time the prompt is displayed. Then the script sets the initial value of the variable. If there’s no current unfinished entry, this will be blank. So when doing has made a change and runs the script, it first outputs the doing view result to a hidden cache file. Set_user_var doingNow "$(command cat ~/.doing_cache)" It should be the most recent entry not marked I’m using the same view I set up for my Touch Bar with BetterTouchTool: I set up a view for Doing to display just a single entry, title only, no color. Getting the Current Entryįirst we need to get the text to display. You just have to keep it updated, so some hooks are required. Once set, the variable can be used in status bars, window titles, session badges, etc. This whole thing is based around iTerm’s user variables and interpolated strings. The method I’m using might seem a bit convoluted, but it’s working great. It’s already in my Touch Bar, but having it right below my prompt in my terminal seemed super handy. I’ve been playing with incorporating Doing into my iTerm status bar. If you don’t know what Doing is and started reading this post anyway, go check it out first. First of all, there have been some major updates to Doing over the last few weeks ( changelog), so be sure to update to the latest version ( gem update doing).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |