Claude notifications: clicking one brings back the app Claude runs in
Ports CoreDesktop's 4fb3539. The hooks ran notify-send from inside Claude, so the desktop couldn't tell which app the notification came from and clicking it did nothing. system/claude-notify finds the terminal or editor among Claude's parent processes (or tmux's client, or the Flatpak) and names it in the desktop-entry hint. The title shows the project folder and the body Claude's own message. configure agents writes the hooks through it, and swaps the old notify-send ones for it, only where they're still the ones it wrote. update doesn't change settings, so old hooks make configure agents to do until it has swapped them. Smoketest: 35-claude-notify. TEST.md: click one on COSMIC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,7 +53,6 @@ Since `4a4a3bd`, to look at:
|
|||||||
and its later checks from `d5925fa` (what root runs is root's alone) and
|
and its later checks from `d5925fa` (what root runs is root's alone) and
|
||||||
`53c6c8b` (the install path). Hiding the connector's settings from
|
`53c6c8b` (the install path). Hiding the connector's settings from
|
||||||
agents is done.
|
agents is done.
|
||||||
- [ ] `4fb3539` Claude notifications: clicking one brings back the app Claude runs in
|
|
||||||
- [ ] `9dc5eb1` Upgrade safeguards, hardware setup, sign-in options and Taildrop.
|
- [ ] `9dc5eb1` Upgrade safeguards, hardware setup, sign-in options and Taildrop.
|
||||||
To port: `configure security-key` and `configure fingerprint` (through
|
To port: `configure security-key` and `configure fingerprint` (through
|
||||||
`pam-auth-update` and fprintd on Pop!_OS, not by editing PAM files),
|
`pam-auth-update` and fprintd on Pop!_OS, not by editing PAM files),
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ opencode, Hermes and Cline Desktop run in Anthropic's sandbox runtime (srt), whi
|
|||||||
- can't read your SSH keys, keyrings, password managers, browser profiles, Evolution's mail, calendars and contacts, Thunderbird, Element, cloud and Git credentials, the other agents' logins, or Federated Connector's settings (your Core's domain and user name, and what the sandbox allows)
|
- can't read your SSH keys, keyrings, password managers, browser profiles, Evolution's mail, calendars and contacts, Thunderbird, Element, cloud and Git credentials, the other agents' logins, or Federated Connector's settings (your Core's domain and user name, and what the sandbox allows)
|
||||||
- can reach only AI providers and common developer sites: GitHub, Gitea, npm, PyPI, crates.io, RubyGems, the Go module proxy, and Ubuntu's and Pop!_OS' sites
|
- can reach only AI providers and common developer sites: GitHub, Gitea, npm, PyPI, crates.io, RubyGems, the Go module proxy, and Ubuntu's and Pop!_OS' sites
|
||||||
|
|
||||||
Typing `opencode`, `hermes` or `hermes-agent` runs it in the sandbox: `configure agents` adds a block at the end of ~/.bashrc that puts `sandbox/bin` first on PATH. To run one without the sandbox, type `unsandboxed opencode`. Claude Code uses its own built-in sandbox, also on bubblewrap, for every command it runs, which `configure agents` turns on (see `/sandbox` inside Claude). If you had no Claude Code settings, it also adds notifications for when Claude needs you and when it's done.
|
Typing `opencode`, `hermes` or `hermes-agent` runs it in the sandbox: `configure agents` adds a block at the end of ~/.bashrc that puts `sandbox/bin` first on PATH. To run one without the sandbox, type `unsandboxed opencode`. Claude Code uses its own built-in sandbox, also on bubblewrap, for every command it runs, which `configure agents` turns on (see `/sandbox` inside Claude). If you had no Claude Code settings, it also adds notifications for when Claude needs you and when it's done. Clicking one brings back the app Claude runs in (COSMIC Terminal, VS Codium, or the terminal tmux is in); the title shows the project folder. Settings written by an earlier version, whose notifications did nothing when clicked, are changed to match the next time you run `configure agents`, and only those two hooks.
|
||||||
|
|
||||||
If Hermes' gateway is set up as a service, `configure agents` runs it in the sandbox too. Hermes can change its own settings from inside the sandbox, so the Matrix server they name isn't trusted on its own: `configure hermes` asks whether it's your server and may be reached, and keeps your answer in `~/.config/federated-connector/sandbox/hermes.json`, which no sandbox can read or write. For other messaging services, add their domains to that file as shown below. If Cline Desktop is installed, its entry in the app library opens it in the sandbox.
|
If Hermes' gateway is set up as a service, `configure agents` runs it in the sandbox too. Hermes can change its own settings from inside the sandbox, so the Matrix server they name isn't trusted on its own: `configure hermes` asks whether it's your server and may be reached, and keeps your answer in `~/.config/federated-connector/sandbox/hermes.json`, which no sandbox can read or write. For other messaging services, add their domains to that file as shown below. If Cline Desktop is installed, its entry in the app library opens it in the sandbox.
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ Once it's packaged for Pop!_OS (see [PLAN.md](PLAN.md)):
|
|||||||
### AI agents and the sandbox
|
### AI agents and the sandbox
|
||||||
|
|
||||||
- [ ] Each agent installs and signs in, and runs in the sandbox
|
- [ ] Each agent installs and signs in, and runs in the sandbox
|
||||||
|
- [ ] Claude Code's notification, from Claude in COSMIC Terminal, shows the
|
||||||
|
project folder, and clicking it brings COSMIC Terminal back
|
||||||
- [ ] If Pop!_OS restricts user namespaces, the AppArmor profile for
|
- [ ] If Pop!_OS restricts user namespaces, the AppArmor profile for
|
||||||
bubblewrap lets the sandbox start
|
bubblewrap lets the sandbox start
|
||||||
- [ ] An AI server on the network or tailnet is found by `configure ai-servers`
|
- [ ] An AI server on the network or tailnet is found by `configure ai-servers`
|
||||||
|
|||||||
+39
-12
@@ -104,18 +104,44 @@ turn_on_claude_sandbox() {
|
|||||||
echo "Claude Code runs the commands it starts in its own sandbox."
|
echo "Claude Code runs the commands it starts in its own sandbox."
|
||||||
}
|
}
|
||||||
|
|
||||||
# A desktop notification when Claude Code needs you or is done, if you have no
|
# A desktop notification when Claude Code needs you or is done, through
|
||||||
# settings of your own yet
|
# system/claude-notify so that clicking one brings back the app Claude runs in.
|
||||||
|
# The hook runs in a shell, which expands ~.
|
||||||
|
# shellcheck disable=SC2088
|
||||||
|
CLAUDE_NOTIFY="~/.local/share/federated-connector/connector/system/claude-notify"
|
||||||
|
OLD_NOTIFY_INPUT="notify-send 'Claude Code' 'Needs your input'"
|
||||||
|
OLD_NOTIFY_DONE="notify-send 'Claude Code' 'Task completed'"
|
||||||
|
|
||||||
|
# Settings written before claude-notify ran notify-send itself, so clicking
|
||||||
|
# did nothing: true while either of those two hooks is still there
|
||||||
|
old_claude_notifications() {
|
||||||
|
jq -e --arg input "$OLD_NOTIFY_INPUT" --arg done "$OLD_NOTIFY_DONE" \
|
||||||
|
'[.hooks.Notification[]?.hooks[]?, .hooks.Stop[]?.hooks[]? | objects | .command]
|
||||||
|
| any(. == $input or . == $done)' "$CLAUDE_SETTINGS" &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Your own settings are left alone: the hooks are added only if you have no
|
||||||
|
# settings yet, and changed only where they're still the ones written here
|
||||||
claude_notifications() {
|
claude_notifications() {
|
||||||
[ -f "$CLAUDE_SETTINGS" ] && return 0
|
if [ ! -f "$CLAUDE_SETTINGS" ]; then
|
||||||
edit_json "$CLAUDE_SETTINGS" '{}' \
|
edit_json "$CLAUDE_SETTINGS" '{}' \
|
||||||
--arg needs "notify-send 'Claude Code' 'Needs your input'" \
|
--arg needs "$CLAUDE_NOTIFY 'Needs your input'" \
|
||||||
--arg finished "notify-send 'Claude Code' 'Task completed'" \
|
--arg finished "$CLAUDE_NOTIFY 'Task completed'" \
|
||||||
'.hooks = {
|
'.hooks = {
|
||||||
Notification: [{matcher: "", hooks: [{type: "command", command: $needs}]}],
|
Notification: [{matcher: "", hooks: [{type: "command", command: $needs}]}],
|
||||||
Stop: [{matcher: "", hooks: [{type: "command", command: $finished}]}]
|
Stop: [{matcher: "", hooks: [{type: "command", command: $finished}]}]
|
||||||
}' || return 1
|
}' || return 1
|
||||||
echo "Claude Code shows a notification when it needs you and when it's done."
|
echo "Claude Code shows a notification when it needs you and when it's done."
|
||||||
|
elif old_claude_notifications; then
|
||||||
|
edit_json "$CLAUDE_SETTINGS" '{}' \
|
||||||
|
--arg old_input "$OLD_NOTIFY_INPUT" --arg new_input "$CLAUDE_NOTIFY 'Needs your input'" \
|
||||||
|
--arg old_done "$OLD_NOTIFY_DONE" --arg new_done "$CLAUDE_NOTIFY 'Task completed'" '
|
||||||
|
def swap(old; new):
|
||||||
|
if type == "object" and .command == old then .command = new else . end;
|
||||||
|
(.hooks.Notification[]?.hooks[]?) |= swap($old_input; $new_input)
|
||||||
|
| (.hooks.Stop[]?.hooks[]?) |= swap($old_done; $new_done)' || return 1
|
||||||
|
echo "Clicking Claude Code's notifications brings back the app it runs in."
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Hermes' gateway and Cline Desktop -----------------------------------------------
|
# --- Hermes' gateway and Cline Desktop -----------------------------------------------
|
||||||
@@ -189,7 +215,8 @@ sandbox_cline() {
|
|||||||
|
|
||||||
sandbox_ready() {
|
sandbox_ready() {
|
||||||
srt_path > /dev/null && on_path && pkg_installed "${SANDBOX_PACKAGES[@]}" && bwrap_works \
|
srt_path > /dev/null && on_path && pkg_installed "${SANDBOX_PACKAGES[@]}" && bwrap_works \
|
||||||
&& { ! agent_installed claude || claude_sandbox_on; } && gateway_ok && cline_ok
|
&& { ! agent_installed claude || { claude_sandbox_on && ! old_claude_notifications; }; } \
|
||||||
|
&& gateway_ok && cline_ok
|
||||||
}
|
}
|
||||||
|
|
||||||
is_configured() {
|
is_configured() {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ Each run writes its logs to `smoketest/results/<time>/`, one per scenario, and p
|
|||||||
| `10-configure` | `--help`, `--list` (nothing on stderr; agent sign-ins and the sandbox item hidden until they apply), the menu, an unknown item, the Core item's first question, and refusing to run as root |
|
| `10-configure` | `--help`, `--list` (nothing on stderr; agent sign-ins and the sandbox item hidden until they apply), the menu, an unknown item, the Core item's first question, and refusing to run as root |
|
||||||
| `20-goa` | `goa-account` with Online Accounts 3.50. It adds Nextcloud and email (quoting a name), adding again changes nothing, and it pauses email and ends the pause. Test a Core takes an unreachable mail server as a sign-in failure, not a wrong password. Removing leaves nothing in the keyring. |
|
| `20-goa` | `goa-account` with Online Accounts 3.50. It adds Nextcloud and email (quoting a name), adding again changes nothing, and it pauses email and ends the pause. Test a Core takes an unreachable mail server as a sign-in failure, not a wrong password. Removing leaves nothing in the keyring. |
|
||||||
| `30-core-local` | Superpanel's entry, Element's config (in ~/.config, or the Flatpak's folder), and the COSMIC Files sidebar. The sidebar check reads and writes ron's pretty format with network places and escaped names, keeps COSMIC Files' defaults, and leaves a file it can't read alone. Then davfs2's secret, read back. |
|
| `30-core-local` | Superpanel's entry, Element's config (in ~/.config, or the Flatpak's folder), and the COSMIC Files sidebar. The sidebar check reads and writes ron's pretty format with network places and escaped names, keeps COSMIC Files' defaults, and leaves a file it can't read alone. Then davfs2's secret, read back. |
|
||||||
|
| `35-claude-notify` | `system/claude-notify` with a fake /proc and a stand-in `notify-send`: it names COSMIC Terminal, found among Claude's parent processes, or the Flatpak it runs in, shows the project folder and Claude's message, and names no app it has no desktop entry for. `configure agents` writes its hooks, swaps the old notify-send ones for them, keeps your own hooks and settings, and changes nothing the second time. |
|
||||||
| `40-backup` | restic and rclone from apt, with `rclone serve webdav` standing in for Nextcloud and the secrets in the keyring. `system/backup` makes a snapshot that leaves out caches and the install, a file restores from it, and without the passphrase it fails. |
|
| `40-backup` | restic and rclone from apt, with `rclone serve webdav` standing in for Nextcloud and the secrets in the keyring. `system/backup` makes a snapshot that leaves out caches and the install, a file restores from it, and without the passphrase it fails. |
|
||||||
| `45-tailnet` | `lib/tailnet.sh` with a stand-in `tailscale`: the other online computers, without phones; nothing when Tailscale is stopped or missing. `configure ai-servers` and `configure storage` ask the tailnet's machines as well as mDNS's, list a machine found both ways once by its tailnet name, and mount a tailnet server at /mnt/<short name>. |
|
| `45-tailnet` | `lib/tailnet.sh` with a stand-in `tailscale`: the other online computers, without phones; nothing when Tailscale is stopped or missing. `configure ai-servers` and `configure storage` ask the tailnet's machines as well as mDNS's, list a machine found both ways once by its tailnet name, and mount a tailnet server at /mnt/<short name>. |
|
||||||
| `50-sandbox` *(all)* | Node.js and srt download and install. A stand-in agent can't read `~/.ssh` or Federated Connector's settings, or write outside its project, reaches allowed sites only, and won't start in your home folder. A new bash finds the sandboxed command first. |
|
| `50-sandbox` *(all)* | Node.js and srt download and install. A stand-in agent can't read `~/.ssh` or Federated Connector's settings, or write outside its project, reaches allowed sites only, and won't start in your home folder. A new bash finds the sandboxed command first. |
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
# Scenarios set what the runner and items read
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
DESCRIPTION="Claude Code's notifications name the app Claude runs in, and old hooks are swapped"
|
||||||
|
TIER=quick
|
||||||
|
|
||||||
|
# A fake /proc: pid $1 runs $2 under pid $3
|
||||||
|
fake_proc() {
|
||||||
|
mkdir -p "$PROC/$1"
|
||||||
|
echo "$2" > "$PROC/$1/comm"
|
||||||
|
printf 'Name:\t%s\nPPid:\t%s\n' "$2" "$3" > "$PROC/$1/status"
|
||||||
|
}
|
||||||
|
|
||||||
|
scenario() {
|
||||||
|
local bin="$HOME/.local/bin" sent="$HOME/sent" notify="$CONNECTOR/system/claude-notify" apps
|
||||||
|
PROC="$HOME/proc"
|
||||||
|
apps="$HOME/.local/share/applications"
|
||||||
|
mkdir -p "$bin" "$apps"
|
||||||
|
# A stand-in notify-send that records its arguments, one per line
|
||||||
|
printf '#!/bin/bash\nprintf "%%s\\n" "$@" > %q\n' "$sent" > "$bin/notify-send"
|
||||||
|
chmod +x "$bin/notify-send"
|
||||||
|
|
||||||
|
step "system/claude-notify"
|
||||||
|
# COSMIC Terminal (40) runs bash (41), which runs claude (42), which runs the hook
|
||||||
|
fake_proc 40 cosmic-term 1
|
||||||
|
fake_proc 41 bash 40
|
||||||
|
fake_proc 42 claude 41
|
||||||
|
touch "$apps/com.system76.CosmicTerm.desktop"
|
||||||
|
echo '{"message": "Claude needs your permission", "cwd": "/home/pop/Projects/demo"}' \
|
||||||
|
| XDG_DATA_DIRS="$HOME/none" CLAUDE_NOTIFY_PROC="$PROC" CLAUDE_NOTIFY_PID=42 "$notify" 'Needs your input'
|
||||||
|
check "it names COSMIC Terminal" grep -qxF -- "--hint=string:desktop-entry:com.system76.CosmicTerm" "$sent"
|
||||||
|
check "the title is the project folder" grep -qxF "Claude Code: demo" "$sent"
|
||||||
|
check "the body is Claude's message" grep -qxF "Claude needs your permission" "$sent"
|
||||||
|
echo '{"cwd": "/home/pop/Projects/demo"}' \
|
||||||
|
| XDG_DATA_DIRS="$HOME/none" CLAUDE_NOTIFY_PROC="$PROC" CLAUDE_NOTIFY_PID=42 "$notify" 'Task completed'
|
||||||
|
check "without a message, the hook's own text" grep -qxF "Task completed" "$sent"
|
||||||
|
rm "$apps/com.system76.CosmicTerm.desktop"
|
||||||
|
echo '{}' | XDG_DATA_DIRS="$HOME/none" CLAUDE_NOTIFY_PROC="$PROC" CLAUDE_NOTIFY_PID=42 "$notify" 'Task completed'
|
||||||
|
check_not "no app it can't find a desktop entry for" grep -q desktop-entry "$sent"
|
||||||
|
echo '{}' | XDG_DATA_DIRS="$HOME/none" FLATPAK_ID=com.vscodium.codium "$notify" 'Task completed'
|
||||||
|
check "inside a Flatpak, the Flatpak" grep -qxF -- "--hint=string:desktop-entry:com.vscodium.codium" "$sent"
|
||||||
|
|
||||||
|
step "configure agents' hooks"
|
||||||
|
source "$CONNECTOR/configure.d/30-agents.sh"
|
||||||
|
rm -f "$CLAUDE_SETTINGS"
|
||||||
|
check "claude_notifications writes them" claude_notifications
|
||||||
|
check_eq "through claude-notify" "$CLAUDE_NOTIFY 'Needs your input'" \
|
||||||
|
"$(jq -r '.hooks.Notification[0].hooks[0].command' "$CLAUDE_SETTINGS")"
|
||||||
|
check_not "they aren't the old ones" old_claude_notifications
|
||||||
|
|
||||||
|
# Settings written before claude-notify, with a hook of your own
|
||||||
|
cat > "$CLAUDE_SETTINGS" << 'EOF'
|
||||||
|
{
|
||||||
|
"model": "opus",
|
||||||
|
"hooks": {
|
||||||
|
"Notification": [{"matcher": "", "hooks": [{"type": "command", "command": "notify-send 'Claude Code' 'Needs your input'"}]}],
|
||||||
|
"Stop": [{"matcher": "", "hooks": [
|
||||||
|
{"type": "command", "command": "notify-send 'Claude Code' 'Task completed'"},
|
||||||
|
{"type": "command", "command": "my-own-hook"}
|
||||||
|
]}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
check "old hooks are found" old_claude_notifications
|
||||||
|
check "claude_notifications swaps them" claude_notifications
|
||||||
|
check_not "they're gone" old_claude_notifications
|
||||||
|
check_eq "Stop runs claude-notify" "$CLAUDE_NOTIFY 'Task completed'" \
|
||||||
|
"$(jq -r '.hooks.Stop[0].hooks[0].command' "$CLAUDE_SETTINGS")"
|
||||||
|
check_eq "your own hook stays" my-own-hook "$(jq -r '.hooks.Stop[0].hooks[1].command' "$CLAUDE_SETTINGS")"
|
||||||
|
check_eq "and your other settings" opus "$(jq -r .model "$CLAUDE_SETTINGS")"
|
||||||
|
cp "$CLAUDE_SETTINGS" "$HOME/before.json"
|
||||||
|
claude_notifications > /dev/null
|
||||||
|
check "running it again changes nothing" cmp -s "$CLAUDE_SETTINGS" "$HOME/before.json"
|
||||||
|
|
||||||
|
rm -rf "$PROC" "$sent" "$bin/notify-send" "$HOME/before.json" "$HOME/.claude"
|
||||||
|
}
|
||||||
Executable
+84
@@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Purpose : Claude Code's Notification and Stop hooks (configure agents writes
|
||||||
|
# them): a desktop notification that, when clicked, brings you back
|
||||||
|
# to the app Claude is running in (COSMIC Terminal, VS Codium, ...).
|
||||||
|
#
|
||||||
|
# claude-notify <text>, with the hook's JSON on stdin. <text> is shown when
|
||||||
|
# the JSON has no message of its own, as with Stop.
|
||||||
|
#
|
||||||
|
# COSMIC (and GNOME) bring an app forward when its notification is clicked
|
||||||
|
# only if they know which app sent it. notify-send runs from Claude, not from the app, so
|
||||||
|
# the notification names the app itself in its desktop-entry hint: the first
|
||||||
|
# terminal or editor found among the processes Claude runs under. Clicking
|
||||||
|
# brings forward that app's most recently used window.
|
||||||
|
#
|
||||||
|
# CLAUDE_NOTIFY_PROC (default /proc) and CLAUDE_NOTIFY_PID (default this
|
||||||
|
# script's parent) are for the tests.
|
||||||
|
|
||||||
|
text="${1:-Needs your input}"
|
||||||
|
proc="${CLAUDE_NOTIFY_PROC:-/proc}"
|
||||||
|
|
||||||
|
input=""
|
||||||
|
[ -t 0 ] || input="$(cat)"
|
||||||
|
message="$(jq -r '.message // empty' <<< "$input" 2> /dev/null)"
|
||||||
|
cwd="$(jq -r '.cwd // empty' <<< "$input" 2> /dev/null)"
|
||||||
|
[ -n "$cwd" ] || cwd="$PWD"
|
||||||
|
|
||||||
|
# The desktop entries an app may have, by the name of its process
|
||||||
|
entries_for() {
|
||||||
|
case "$1" in
|
||||||
|
kgx) echo org.gnome.Console ;;
|
||||||
|
ptyxis | ptyxis-agent) echo org.gnome.Ptyxis ;;
|
||||||
|
gnome-terminal*) echo org.gnome.Terminal ;;
|
||||||
|
ghostty) echo com.mitchellh.ghostty ;;
|
||||||
|
kitty) echo kitty ;;
|
||||||
|
alacritty) echo Alacritty ;;
|
||||||
|
wezterm-gui) echo org.wezfurlong.wezterm ;;
|
||||||
|
cosmic-term) echo com.system76.CosmicTerm ;;
|
||||||
|
codium) echo com.vscodium.codium codium vscodium ;;
|
||||||
|
code | code-oss) echo code com.visualstudio.code code-oss ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
installed() {
|
||||||
|
local dir
|
||||||
|
local IFS=:
|
||||||
|
for dir in "${XDG_DATA_HOME:-$HOME/.local/share}" ${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do
|
||||||
|
[ -f "$dir/applications/$1.desktop" ] && return 0
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
find_entry() {
|
||||||
|
# Inside a Flatpak (VS Codium's, say), the app is the Flatpak
|
||||||
|
if [ -n "$FLATPAK_ID" ]; then
|
||||||
|
echo "$FLATPAK_ID"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# tmux's server doesn't run under the terminal, its client does
|
||||||
|
local pid="${CLAUDE_NOTIFY_PID:-$PPID}"
|
||||||
|
if [ -n "$TMUX" ]; then
|
||||||
|
pid="$(tmux display-message -p '#{client_pid}' 2> /dev/null)" || return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local comm entry hops=0
|
||||||
|
while [ -n "$pid" ] && [ "$pid" -gt 1 ] && [ "$hops" -lt 30 ]; do
|
||||||
|
comm="$(cat "$proc/$pid/comm" 2> /dev/null)" || return
|
||||||
|
for entry in $(entries_for "$comm"); do
|
||||||
|
if installed "$entry"; then
|
||||||
|
echo "$entry"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
pid="$(awk '/^PPid:/ { print $2 }' "$proc/$pid/status" 2> /dev/null)"
|
||||||
|
hops=$((hops + 1))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
args=(--app-name="Claude Code" --icon=dialog-information)
|
||||||
|
entry="$(find_entry)"
|
||||||
|
[ -n "$entry" ] && args+=(--hint="string:desktop-entry:$entry")
|
||||||
|
|
||||||
|
exec notify-send "${args[@]}" "Claude Code: ${cwd##*/}" "${message:-$text}"
|
||||||
Reference in New Issue
Block a user