Skip to content

Commit 2dfc38a

Browse files
authored
Merge pull request #20 from ElcanoTek/codex/fix-app-bundling-in-mac-os
Ignore VICTORIA_DEV in packaged app
2 parents 5938ea0 + afa26ac commit 2dfc38a

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ To refresh the bundled `VICTORIA.md` knowledge base during development, run:
9999
python3 victoria.py --dev
100100
```
101101

102+
You can also enable developer mode by setting `VICTORIA_DEV=1` in your
103+
environment. Packaged builds ignore this variable to avoid shipping in
104+
developer mode; use the `--dev` flag explicitly if needed.
105+
102106
#### Customizing the launch tool
103107

104108
Victoria uses the `crush` CLI by default. Set the following environment variables to swap in a different tool or config files:
@@ -111,7 +115,8 @@ export VICTORIA_OUTPUT="your_cli.json"
111115

112116
## 📦 Packaging for macOS and Windows
113117

114-
You can build standalone packages so Victoria can be launched from Finder. The macOS app opens a terminal window for interaction.
118+
You can build standalone packages so Victoria can be launched from Finder. The macOS app opens a terminal window for interaction
119+
and detects existing sessions to avoid spawning extra Terminal windows.
115120

116121
### macOS `.app`
117122

package_mac.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ chmod +x "$MACOS/launch.command"
2727
cat > "$MACOS/Victoria" <<'EOF'
2828
#!/bin/bash
2929
DIR="$(cd "$(dirname "$0")" && pwd)"
30-
open -a Terminal "$DIR/launch.command"
30+
if [ -n "$TERM_PROGRAM" ]; then
31+
"$DIR/launch.command"
32+
else
33+
open -a Terminal "$DIR/launch.command"
34+
fi
3135
EOF
3236
chmod +x "$MACOS/Victoria"

victoria.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,9 @@ def open_victoria_folder():
712712

713713
def main():
714714
args = parse_args()
715-
dev_mode = args.dev or os.environ.get("VICTORIA_DEV") == "1"
715+
dev_mode = args.dev or (
716+
os.environ.get("VICTORIA_DEV") == "1" and not getattr(sys, "frozen", False)
717+
)
716718

717719
ensure_default_files()
718720
clear_screen()

0 commit comments

Comments
 (0)