summarylogtreecommitdiffstats
path: root/forge-code.sh
blob: bb0358cd6e5ae8e59b3c2e48a0da93bc8f8191b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash
# Forge-Code launcher — handles TTY detection and session wrapping
# Detaches from terminal if invoked from a non-TTY context (desktop shortcut, etc.)
# while preserving ZSH plugin integration for interactive sessions.

FORGE_BIN="/usr/bin/forge"
FORGE_LAUNCHER_VERSION="1"

# If no TTY is attached and FORGE_IN_SESSION is not set, detach cleanly.
# This prevents terminal-reserved xterms when launched from desktop files.
if [ ! -t 0 ] && [ -z "$FORGE_IN_SESSION" ]; then
    exec setsid -w "$FORGE_BIN" "$@" </dev/null >/dev/null 2>&1
else
    exec "$FORGE_BIN" "$@"
fi