Gemini CLI notifications: काम पूरा होने या आपकी ज़रूरत पड़ने पर sound या alert पाएँ

जब आप कुछ और पढ़ रहे होते हैं, तब Gemini CLI आराम से “Waiting for confirmation” पर बैठा रहता है। वह आपको बता सकता है। बस setting default रूप से बंद है, और Windows पर यह docs के बताए से अलग व्यवहार करती है।

लेखक: Aslan, Pet Island टीम · अपडेट: 26 अक्टू॰ 2026 · पढ़ने में 5 मिनट

संक्षेप में

~/.gemini/settings.json में "general": { "enableNotifications": true } सेट करें (या /settings → General → Enable Notifications)। इसके बाद Gemini CLI आपको तब alert करता है जब उसे approval चाहिए और जब कोई session पूरा होता है। Windows Terminal और VS Code terminal पर automatic mode सिर्फ़ terminal bell बजाता है, इसलिए अगर आपको असली desktop notification चाहिए तो notificationMethod: "osc9" आज़माएँ। अपनी sound के लिए Notification hook (tool-permission prompts पर fire होता है) और AfterAgent hook (turn ख़त्म होने पर fire होता है) जोड़ें।

शुरू करने से पहले: आपके पास कौन-सा Gemini CLI है

Gemini CLI के documentation पर एक banner कहता है कि unpaid-tier और Google One users के लिए 18 जून 2026 को Gemini CLI की जगह Antigravity CLI आ गया। नीचे की सारी बातें ख़ुद Gemini CLI के बारे में हैं (gemini command और ~/.gemini/settings.json)। अगर आप Antigravity पर चले गए हैं, तो उसकी settings कहीं और रहती हैं।

लोग यह लंबे समय से चाहते रहे हैं। Gemini CLI repository में audio notifications की feature request (#4310) को 74 thumbs-up मिले, और एक maintainer ने इसकी priority बढ़ाई “to reflect how many people care” (यह दिखाने के लिए कि कितने लोगों को इसकी परवाह है)। बाद की एक discussion (#13313) ने इसे सीधे शब्दों में कहा: “I can never tell when it is done.” (मुझे कभी पता नहीं चलता कि यह कब पूरा हुआ)।

Built-in notifications चालू करें

Gemini CLI में एक experimental notification feature है। यह default रूप से बंद है। इसे CLI में /settings → General → Enable Notifications से चालू करें, या अपनी settings फ़ाइल में:

~/.gemini/settings.jsonकॉपी करें
{
"general": {
"enableNotifications": true
}
}

चालू होने के बाद Gemini CLI दो events पर आपको alert करता है:

  • Action required (कार्रवाई ज़रूरी): model आपके input या tool approval का इंतज़ार कर रहा है।
  • Session complete (session पूरा): कोई session सफलतापूर्वक पूरा हुआ।

Notification titles हैं “Gemini CLI needs your attention” और “Gemini CLI session complete”। Gemini CLI अपनी कोई sound नहीं बजाता: वह आपके terminal को एक escape sequence भेजता है, और terminal तय करता है कि क्या होगा।

Notification आप तक कैसे पहुँचती है (और Windows अलग क्यों है)

दूसरी setting, general.notificationMethod, तय करती है कि alert कैसे भेजा जाए। Values हैं auto (default), osc9, osc777 और bell।

Notifications पेज कहता है कि CLI OSC 9 escape sequence इस्तेमाल करता है और fallback के रूप में terminal bell बजाता है। Source code ज़्यादा सटीक है। auto mode में (packages/cli/src/utils/terminalNotifications.ts):

टर्मिनलauto क्या भेजता है
iTerm2OSC 9 (desktop notification)
Windows Terminal, VS Code terminal, Alacritty, Apple Terminalसिर्फ़ bell (BEL)
बाक़ी हर terminalOSC 777

तो Windows Terminal पर आपको bell मिलती है, toast नहीं। Bell क्या करती है, यह Windows Terminal की setting है: bellStyle all, audible, window, taskbar और none स्वीकार करता है, और default audible है। all के साथ Windows Terminal sound बजाता है और taskbar icon चमकाता है; आप bellSound से sound चुन सकते हैं।

Windows Terminal settings.json (profile)कॉपी करें
{
"bellStyle": "all"
}

अगर आप bell की जगह असली desktop notification आज़माना चाहते हैं, तो method को ज़बरदस्ती सेट करें:

~/.gemini/settings.jsonकॉपी करें
{
"general": {
"enableNotifications": true,
"notificationMethod": "osc9"
}
}

कोई terminal OSC 9 को Windows notification में बदलेगा या नहीं, यह terminal के version पर निर्भर है। अगर कुछ नहीं दिखता, तो वापस auto या bell पर जाएँ और bellStyle: "all" इस्तेमाल करें। Windows Terminal के लिए Gemini CLI के अपने code ने bell का ही रास्ता चुना है।

tmux या screen के अंदर Gemini CLI sequence को passthrough escape में लपेटता है ताकि वह फिर भी बाहरी terminal तक पहुँचे।

Hooks से अपनी sound

अगर आपको कोई ख़ास sound, popup, या phone पर message चाहिए, तो hooks इस्तेमाल करें। Gemini CLI तय जगहों पर hook commands चलाता है और उनके पूरा होने का इंतज़ार करता है। यहाँ दो events मायने रखते हैं:

  • Notification तब fire होता है जब CLI कोई system alert देता है। अभी इसका इकलौता type ToolPermission है (कोई tool आपकी approval का इंतज़ार कर रहा है)। Hook कुछ भी approve या block नहीं कर सकता; यह सिर्फ़ सूचना देने के लिए है।
  • AfterAgent हर turn में एक बार, model के आख़िरी जवाब के बाद fire होता है। Gemini का अपना best-practices पेज इसे तब सुझाता है जब “you only need to check the final completion” (आपको सिर्फ़ आख़िरी completion जाँचनी हो)।

Hooks default रूप से चालू हैं (hooksConfig.enabled)। Hook stdout पर ठीक एक JSON object print करता है और कुछ नहीं (जब कहने को कुछ न हो तो {} ठीक है)। Exit code 0 का मतलब सफलता है; 2 block करता है (और सिर्फ़ blocking events में मायने रखता है); बाक़ी कुछ भी warning है और CLI काम जारी रखता है। Default timeout 60 सेकंड है (timeout milliseconds में होता है)।

Windows (PowerShell)

Windows पर Gemini CLI hook commands को pwsh -NoProfile -Command से चलाता है, या PowerShell 7 इंस्टॉल न होने पर powershell.exe से। इस script को %USERPROFILE%\.gemini\hooks\ding.ps1 के रूप में सेव करें:

~/.gemini/hooks/ding.ps1कॉपी करें
# Two short beeps: frequency in Hz, duration in ms
[Console]::Beep(880, 150)
[Console]::Beep(1320, 150)
 
# Hooks must print one JSON object
"{}"

फिर दोनों events को इससे जोड़ें:

~/.gemini/settings.jsonकॉपी करें
{
"general": { "enableNotifications": true },
"hooks": {
"Notification": [
{ "matcher": "*", "hooks": [ { "name": "ding-approval", "type": "command",
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File $HOME\\.gemini\\hooks\\ding.ps1" } ] }
],
"AfterAgent": [
{ "matcher": "*", "hooks": [ { "name": "ding-done", "type": "command",
"command": "powershell -NoProfile -ExecutionPolicy Bypass -File $HOME\\.gemini\\hooks\\ding.ps1" } ] }
]
}
}

-ExecutionPolicy Bypass सबसे आम विफलता से बचाता है: PowerShell का scripts चलाने से मना करना। Gemini के docs स्थायी समाधान के रूप में Set-ExecutionPolicy RemoteSigned -Scope CurrentUser सुझाते हैं।

macOS और Linux

दूसरे systems पर hooks bash -c से चलते हैं। एक line की script काम कर देती है:

~/.gemini/hooks/ding.shकॉपी करें
#!/usr/bin/env bash
cat > /dev/null # drain the event JSON
afplay /System/Library/Sounds/Glass.aiff 2>/dev/null \
|| paplay /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null
echo '{}'

इसे executable बनाएँ (chmod +x ~/.gemini/hooks/ding.sh) और उन्हीं दो events में "command": "$HOME/.gemini/hooks/ding.sh" इस्तेमाल करें।

दो अलग sounds चाहिए, एक “approval चाहिए” के लिए और एक “काम पूरा” के लिए? दो scripts बनाएँ। Hook stdin से event भी पढ़ सकता है: Notification input में notification_type, message और details होते हैं, इसलिए आप अपने popup में असली request दिखा सकते हैं।

आपका hook क्यों नहीं चलता

  1. /hooks panel जाँचें। यह Gemini CLI द्वारा load किया गया हर hook दिखाता है। अगर hooks बंद किए गए थे, तो /hooks enable-all उन्हें फिर से चालू करता है।
  2. Untrusted folder। Untrusted folder में Gemini CLI project की .gemini/settings.json को ignore करता है, इसलिए project hooks load नहीं होते। Notification hooks को अपनी user settings (~/.gemini/settings.json) में रखें ताकि वे हर जगह काम करें।
  3. बदले हुए hooks नए माने जाते हैं। Gemini CLI project hooks का fingerprint रखता है; अगर किसी hook का नाम या command बदलता है, तो उसे नया, untrusted hook माना जाता है।
  4. stdout पर कुछ और। JSON से पहले भटका हुआ echo या PowerShell warning parsing तोड़ देता है। Logs stderr पर भेजें।
  5. Matchers। Notification और AfterAgent के लिए हर चीज़ से match करने को "*" (या खाली string) इस्तेमाल करें। Lifecycle events exact-string matchers इस्तेमाल करते हैं, tool events regular expressions।

या कम बार पूछा जाए

Notifications आपको जल्दी जवाब देने में मदद करती हैं; आप यह भी कम कर सकते हैं कि Gemini CLI को कितनी बार आपकी ज़रूरत पड़े। general.defaultApprovalMode की value default (पूछता है), auto_edit (edits मंज़ूर, बाक़ी सब के लिए पूछता है) या plan (read-only) हो सकती है। Shift+Tab इनके बीच बदलता है। tools.allowed उन tools की list है जो confirmation dialog छोड़ देते हैं (जैसे run_shell_command(git)), और tools.confirmationRequired उन tools की list है जिन्हें हमेशा पूछना चाहिए।

YOLO mode (--yolo, या Ctrl+Y) सब कुछ approve करता है और default रूप से sandbox चालू करता है। इसे सिर्फ़ command line से चालू किया जा सकता है, और अगर आप मशीन किसी के साथ share करते हैं तो security.disableYoloMode इसे हमेशा के लिए बंद कर देता है।

Pet Island कहाँ काम आता है

Beep बताती है कि कुछ हुआ; यह नहीं बताती कि किस terminal में, या Gemini क्या चलाना चाहता है। Pet Island Gemini CLI को आपके दूसरे एजेंटों के साथ आपकी स्क्रीन के ऊपर एक छोटे island पर रखता है: आप देखते हैं कि वह कब काम कर रहा है, कब आपके confirmation का इंतज़ार कर रहा है और कब पूरा हो गया, और एक click में सही terminal पर पहुँच जाते हैं।

Gemini CLI के साथ confirmation ख़ुद अब भी Gemini में ही होता है। Pet Island request दिखाता है और आपको वहाँ ले जाता है, लेकिन वह आपकी ओर से Gemini के tools को approve नहीं करता। (इसके उलट, Claude Code और Codex की requests का जवाब सीधे island पर दिया जा सकता है।)

अक्सर पूछे जाने वाले सवाल

क्या Gemini CLI में notifications हैं?

हाँ, एक experimental feature के रूप में जो default रूप से बंद है। ~/.gemini/settings.json में general.enableNotifications को true पर सेट करें, या /settings → General → Enable Notifications इस्तेमाल करें।

Gemini CLI Windows पर सिर्फ़ beep क्यों करता है?

Auto mode में Gemini CLI का code Windows Terminal और VS Code terminal को सिर्फ़ terminal bell भेजता है। Windows Terminal की bellStyle setting तय करती है कि वह bell sound बजाए, taskbar चमकाए, या दोनों।

क्या Gemini CLI का कोई hook किसी tool को अपने आप approve कर सकता है?

Notification hook नहीं। Docs कहते हैं कि यह alerts को block नहीं कर सकता और permissions नहीं दे सकता। Tools को पहले से approve करने के लिए इसकी जगह tools.allowed या policy engine इस्तेमाल करें।

Gemini CLI का काम पूरा होने पर कौन-सा hook fire होता है?

AfterAgent। यह हर turn में एक बार, model के आख़िरी जवाब के बाद fire होता है।

Hooks कहाँ रखूँ ताकि वे हर project में काम करें?

अपनी user settings में, ~/.gemini/settings.json। Untrusted folders में project settings ignore होती हैं।

स्रोत

इस पेज की हर setting और हर व्यवहार को 26 अक्टूबर 2026 को इन पेजों से मिलाकर जाँचा गया। एजेंट तेज़ी से बदलते हैं; अगर कुछ अब मेल नहीं खाता, तो आधिकारिक पेज ही मान्य है।

आगे पढ़ें

हर एजेंट को अपनी स्क्रीन के ऊपर से जवाब दें।

Windows और Mac · 7 दिन मुफ़्त, फिर एक बार $8.99 · हर बिक्री से $1 सड़क के बेसहारा जानवरों के खाने पर जाता है

Pet Island मुफ़्त आज़माएँ