Can status bar codes call external programs?

I want to show which git branch I'm on on the staus bar. I have figured out

{h!{ifexists:.\.git}} It's a Git repo {h!}

will show my section if there is .git folder.

Then the content of my section should be the result of command line "git rev-parse --abbrev-ref HEAD".

Can status bar codes run this command?

Not directly, but you could run a script on folder change which puts that information in a variable, and then display the variable on the status bar.

That will be better since the status bar is updated very often and you wouldn't need/want the command to run every time when it only needs to run once on folder change.

Shout if you need pointers to scripting events or any other details.

Information like git status may change over time as user edits the files. While the current branch only changes when the user switches the git branch, the status is changed as soon as any file is changed. It would be great to be able to display some info like git status in status bar. It would provide the best interaction only if the information is automatically updated instead of changing folders. So, we could either run a command every time status bar is updated or if we could run a command periodically in Opus (to update the variables), and both seem like new feature requests. :slight_smile:

I created another discussion for periodic events at: Periodic events

You could do it on F5 refresh, which might be enough.

Of have your git tool run a post-change hook/script which tells Opus to run a script after a change, so it only runs when it needs to. (Scripts can add commands which can then be run from outside of Opus via dopusrt.exe.)

Both would be better than having scripts firing 24/7 on the off chance something changed.

Hi Leo,

Thanks for the pointer.. I was wondering myself if there is a way for dopus to communicate with an external application and forgot about dopusrt :slight_smile:

1 Like