This post is to demonstrate the concept of conditional buttons, the visibility of which depends on the content of the current folder.
This requirement has been discussed many times on this forum. Yet I don't see a complete working example.
The gist is that, the button "Remote Origin" shows if the current folder is managed by git, i.e., there is a sub folder named .git. The button disappears elsewhere to avoid cluttering the toobar.
As suggested in some places, the visibility of the button is controlled by reading a variable isInGit; another script git-repo-detector.js runs the dirty content detection and sets the variable.
The button XML code was not working when the path contained spaces: you get the error fatal: cannot change to 'C:\Users\xxx\xs ds zez\\qsd\zaz" remote get-url origin': Invalid argument
To fix this, I have added quotes around the path and explicitly said no quote for the path with !noterm to avoid double double quotes. You just have to replace the corresponding line with: <instruction>for /f "tokens=*" %%a in ('git -C "{sourcepath|noterm}" remote get-url origin') do set url=%%a</instruction>
I would really like to have overlay icons in Directory Opus as well. How can I get them?
In Windows File Explorer, the total number of icon overlays that can be registered is 15, but only 11 are available to third-party applications. Is Directory Opus also limited in the number of icon overlays like Windows File Explorer ?
We have Preferences / File Display Columns / Icons / Show TortoiseSVN icons in the Status column to partially work around the limitation, but I don't know if it works with TortoiseGit as well.
In 'File Display Columns/Icon', the option TortoiseSVN is greyed out. I do not have TortoiseSVN, which might be the reason. I use TortoiseGit.
Is there a way to use a Directory Opus column status for TortoiseGit?