1

I use GNU Screen to run programs. One of my programs sets up a custom cursor colour. When I reattach to the program via GNU Screen, the cursor does not restore to the custom colour, until I refresh the screen in the program.

I'd like to config GNU Screen to always run a refresh command after I reattach. Is this possible?

9
  • It's not very clear to me what you mean by refresh here, do you mean the redisplay screen command (as bound by default on prefix-l, prefix-^L) or a command called refresh on your system, or some specific action within some TUI software. In the latter case, how would you invoke that action? By a series of key presses, by clicking somewhere? Commented Dec 22, 2024 at 14:37
  • Terminals such as xterm support setting the cursor colour with things like printf '\e]12;blue\a', but AFAIK, GNU screen doesn't support such escapes. Do you have some configuration in place for screen to let those escape sequences through from applications to the host terminal? Commented Dec 22, 2024 at 14:42
  • @StéphaneChazelas GNU Screen does make it a bit tricky, but it does support it. See gnu.org/software/screen/manual/html_node/Control-Sequences.html ; simply wrap your terminal escape code with ESC P and `ESC \`, and it will work. Commented Dec 23, 2024 at 3:42
  • @StéphaneChazelas By refresh, I meant that I was hoping to call a command on the shell whenever GNU Screen reattaches. Commented Dec 23, 2024 at 3:43
  • You mean on the shell you run the screen reattaching command, or on the shell that happens to be sitting at its prompt in the current screen window, or in a new shell to be started in a new screen window, or by screen's exec command? Commented Dec 23, 2024 at 6:29

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.