Skip to content

Instantly share code, notes, and snippets.

@Madh93
Forked from w568w/antigravity.sh
Last active January 8, 2026 11:42
Show Gist options
  • Select an option

  • Save Madh93/8eac85df1d44d0b48c575dfc4b5accfc to your computer and use it in GitHub Desktop.

Select an option

Save Madh93/8eac85df1d44d0b48c575dfc4b5accfc to your computer and use it in GitHub Desktop.
Antigravity workaround (unit per project and run quietly)
#!/bin/bash
readonly UNIT_NAME="antigravity-$(basename "$1")-$(date +%s)"
readonly APP_BIN="/usr/bin/antigravity --verbose"
readonly TRIGGER="Lifecycle#onWillShutdown - end 'antigravityAnalytics'"
# Run the application using systemd-run in the background
systemd-run --user \
--scope \
--unit="$UNIT_NAME" \
--property=KillMode=control-group \
/bin/bash -c "exec prlimit --core=0 $APP_BIN $1 2>&1 | systemd-cat --identifier=$UNIT_NAME" &>/dev/null &
# Monitor logs and kill the scope when the trigger is found (wrapped in a background subshell)
{
journalctl --user --identifier="$UNIT_NAME" --follow | \
grep --line-buffered --max-count=1 "$TRIGGER" && \
systemctl --user kill --signal=SIGKILL "$UNIT_NAME.scope"
} &>/dev/null &
# Disown the background job so it doesn't close if the terminal closes
disown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment