Closed jeffreyzhen closed 5 years ago
The refresh interval is controlled in the BetterTouchTool settings. If you open BetterTouchTool and double-click the "Loading workspace…" preset, make sure that the "Execute this script every x seconds:" is set to some value, or try changing it to some arbitrary low value to see if that fixes it. If not, try adding date
as a new line to the end of the script source in BetterTouchTool and see what that shows.
Thank you! Setting the interval at the bottom worked for me.
Is there a way to have this widget work within all of my projects in a certain directory? For example: ~/Projects/Project1
, ~/Projects/Project2
, etc could be tracked individually? Currently, it seems like the widget works by manually changing the BTT_GIT_WORKING_DIR
to the project I'm working on every time.
Am I missing something?
Would you have a separate widget for each project, or would it auto-switch? And if auto-switching, what would be the detection mechanism?
At least for my workflow, I’m looking into having it auto-switch based on currently focused Xcode window, but obviously this won’t work for everyone.
Preferably one widget that auto switches based on the directory that my currently focused terminal is at.
I'm not very experienced in shell but do you think it's possible to implement something like that? (Not asking you to do this; just bouncing ideas)
Closing the issue just to keep things tidy.
But yes, it should be possible. There's a few approaches that'd work such as using AppleScript to poll for the path of the currently focused Terminal window:
tell application "Terminal"
do shell script "lsof -a -p `lsof -a -c bash -u $USER -d 0 -n | tail -n +2 | awk '{if($NF==\"" & (tty of front tab of front window) & "\"){print $2}}'` -d cwd -n | tail -n +2 | awk '{print $NF}'"
end tell
(https://stackoverflow.com/a/16073987)
As a hack until it's more integrated, you could then modify the BTT_GIT_WORKING_DIR
env var in your ~/.bash_profile
to that path and it should work as expected.
Hey @andrewchidden 👋🏼
Thanks for this gem, this is golden!
Unfortunately, I'm facing the same issue. I would like to inject BTT_GIT_WORKING_DIR
variable automatically based on my active iTerm tab. I tried to implement your AppleScript code in a parallel AS BTT widget and export the BTT_GIT_WORKING_DIR
var in my ~/.zshrc containing the path on my projects root folder but It keeps displaying Working tree is clean
.
Here's the .zshrc export line :
export BTT_GIT_WORKING_DIR=/Applications/MAMP/htdocs
The only way to make it work is to paste the pwd of my project manually in the BTT_GIT_WORKING_DIR
variable
Any ideas? 🙂
Thanks!
Just wanted to say that this is an amazing and clean preset!
On initial launch of the touchbar, it loads the git diff correctly, but when I change things in my project, the git diff does not refresh, but manually running the script does show correct values.
BTT 2.689