AnyBot/box/terminal

16 lines
882 B
Bash

#!/bin/bash
# The box's terminal (after LazyBoy2's box-terminal): xfce4-terminal, one process per window
# (--disable-server), on the desktop's session bus. 工作列和選單的「終端機」, and what the bots
# open as 終端機 (computer_use_open_app).
export DISPLAY="${DISPLAY:-:1}" HOME=/home/bot
export TERM="${TERM:-xterm-256color}" COLORTERM="${COLORTERM:-truecolor}"
if [[ -z "${DBUS_SESSION_BUS_ADDRESS:-}" && -r /tmp/anybot-dbus.env ]]; then
# shellcheck disable=SC1091
source /tmp/anybot-dbus.env
export DBUS_SESSION_BUS_ADDRESS
fi
# From the panel or `docker exec` (at /): the home folder. From 檔案管理員's 「在此開啟終端機」:
# the folder that was open there.
[[ "$PWD" = / || ! -d "$PWD" ]] && { cd /home/bot 2>/dev/null || cd /; }
exec xfce4-terminal --disable-server --geometry=100x28+40+40 --title=終端機 --working-directory="$PWD" "$@"