forked from JetBrains/jediterm
-
Notifications
You must be signed in to change notification settings - Fork 1
Shell Integration
Shivang edited this page Dec 25, 2025
·
1 revision
Shell integration enables advanced BossTerm features like working directory tracking and command completion notifications.
Add the following to your shell configuration file.
# BossTerm Shell Integration
# OSC 7 (directory tracking) + OSC 133 (command notifications)
__bossterm_prompt_command() {
local exit_code=$?
# D: Command finished with exit code
echo -ne "\033]133;D;${exit_code}\007"
# A: Prompt starting
echo -ne "\033]133;A\007"
# OSC 7: Working directory
echo -ne "\033]7;file://${HOSTNAME}${PWD}\007"
}
PROMPT_COMMAND='__bossterm_prompt_command'
# B: Command starting (before command execution)
trap 'echo -ne "\033]133;B\007"' DEBUG# BossTerm Shell Integration
# OSC 7 (directory tracking) + OSC 133 (command notifications)
precmd() {
local exit_code=$?
# D: Command finished with exit code
print -Pn "\e]133;D;${exit_code}\a"
# A: Prompt starting
print -Pn "\e]133;A\a"
# OSC 7: Working directory
print -Pn "\e]7;file://${HOST}${PWD}\a"
}
preexec() {
# B: Command starting (before command execution)
print -Pn "\e]133;B\a"
}# BossTerm Shell Integration
function __bossterm_postexec --on-event fish_postexec
printf "\033]133;D;%d\007" $status
end
function __bossterm_preexec --on-event fish_preexec
printf "\033]133;B\007"
end
function __bossterm_prompt --on-event fish_prompt
printf "\033]133;A\007"
printf "\033]7;file://%s%s\007" (hostname) (pwd)
endWhen configured, BossTerm tracks your current working directory:
- New tabs inherit directory - New tabs open in the same directory as the active tab
- New splits inherit directory - Split panes start in the parent's directory
- Tab titles - Tab titles can show the current directory
When configured, BossTerm can notify you when commands complete:
- System notifications - Get notified when long-running commands finish
- Exit code display - See whether the command succeeded or failed
- Duration tracking - Only notifies for commands longer than threshold (default 5 seconds)
Requirements for notifications:
- Shell integration configured (OSC 133)
- Window must be unfocused when command completes
- Command must run longer than
notifyMinDurationSeconds(default: 5)
ESC ] 7 ; file://hostname/path BEL
Tells the terminal the current working directory.
| Sequence | Meaning |
|---|---|
ESC ] 133 ; A BEL |
Prompt started |
ESC ] 133 ; B BEL |
Command started |
ESC ] 133 ; C BEL |
Command output started |
ESC ] 133 ; D ; exitcode BEL |
Command finished |
To verify shell integration is working:
-
Test OSC 7:
cd /tmp && echo "Check if tab title changed"
-
Test OSC 133:
- Run a command that takes more than 5 seconds:
sleep 6 - Switch to another application
- You should receive a notification when the command completes
- Run a command that takes more than 5 seconds:
-
Debug mode: Press Ctrl/Cmd+Shift+D to open the debug panel and inspect incoming escape sequences
- Ensure OSC 133 is configured in your shell
- Check that
notifyOnCommandCompleteistruein settings - Verify the window was unfocused when command completed
- Check that command ran longer than
notifyMinDurationSeconds
- Ensure OSC 7 is configured in your shell
- Check that the shell is actually emitting the sequence (use debug panel)
- Some remote SSH sessions may not pass through OSC sequences
On first run, BossTerm requests notification permission. If denied:
- Open System Settings > Notifications
- Find BossTerm and enable notifications
- Configuration - Notification settings
- Troubleshooting - More troubleshooting tips