Skip to content

Instantly share code, notes, and snippets.

@cossio
Created May 9, 2026 11:15
Show Gist options
  • Select an option

  • Save cossio/508c54acf8913b3fbeb8f79ba54ad0d4 to your computer and use it in GitHub Desktop.

Select an option

Save cossio/508c54acf8913b3fbeb8f79ba54ad0d4 to your computer and use it in GitHub Desktop.
Warp GH#9425 dark/light terminal notification demo
{"version":2,"width":100,"height":24,"env":{"SHELL":"zsh","TERM":"xterm-256color"}}
[0.100,"o","$ ./warp-gh9425-protocol-demo\r\n"]
[0.400,"o","Warp GH#9425 protocol demo\r\n\r\n"]
[0.900,"o","1. Current theme query\r\n"]
[1.200,"o"," app -> Warp: ESC [ ? 996 n\r\n"]
[1.700,"o"," Warp -> app: ESC [ ? 997 ; 1 n (dark)\r\n\r\n"]
[2.200,"o","2. Opt in for unsolicited notifications\r\n"]
[2.500,"o"," app -> Warp: ESC [ ? 2031 h\r\n\r\n"]
[3.000,"o","3. User switches Warp from a dark theme to a light theme\r\n"]
[3.500,"o"," Warp -> app: ESC [ ? 997 ; 2 n (light)\r\n\r\n"]
[4.000,"o","4. User switches between two light themes\r\n"]
[4.400,"o"," Warp -> app: <none> (classification unchanged)\r\n\r\n"]
[4.900,"o","5. User switches back to a dark theme\r\n"]
[5.300,"o"," Warp -> app: ESC [ ? 997 ; 1 n (dark)\r\n\r\n"]
[5.800,"o","6. App opts out\r\n"]
[6.100,"o"," app -> Warp: ESC [ ? 2031 l\r\n"]
[6.500,"o"," next theme switch: <none>\r\n"]

Warp GH#9425 demo: dark/light terminal notifications

This demo artifact accompanies cossio/warp#1.

The PR implements the Contour dark/light theme extension:

  • CSI ? 996 n queries Warp for the current dark/light classification.
  • Warp replies with CSI ? 997 ; 1 n for dark mode or CSI ? 997 ; 2 n for light mode.
  • CSI ? 2031 h opts a terminal app into unsolicited theme-change notifications.
  • CSI ? 2031 l opts it back out.
  • Notifications are suppressed when the Warp theme changes but the dark/light classification stays the same.

The accompanying warp-gh9425-demo.cast is an asciinema v2 recording that shows the expected observable terminal I/O for the fix.

Transcript

$ ./warp-gh9425-protocol-demo
Warp GH#9425 protocol demo

1. Current theme query
   app -> Warp:  ESC [ ? 996 n
   Warp -> app:  ESC [ ? 997 ; 1 n   (dark)

2. Opt in for unsolicited notifications
   app -> Warp:  ESC [ ? 2031 h

3. User switches Warp from a dark theme to a light theme
   Warp -> app:  ESC [ ? 997 ; 2 n   (light)

4. User switches between two light themes
   Warp -> app:  <none>              (classification unchanged)

5. User switches back to a dark theme
   Warp -> app:  ESC [ ? 997 ; 1 n   (dark)

6. App opts out
   app -> Warp:  ESC [ ? 2031 l
   next theme switch: <none>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment