Saturday 23 June 2018

linux - How to disable notify on "screen -D -R"


I'm running screen -D -R (with optionally using -S name), and it works great, but has one problem - when given screen doesn't exist earlier, i get notification "New screen...", and irritating wait.


How can I disable this particular notification?



Answer



Unfortunately, this behavior is hard-coded in the source: the same test is used to determine whether to emit the “New screen...” notification and to determine whether to attach to a running session. (In the screen 4.0.3 source, (rflag && (rflag & 1) == 0) in attacher.c and screen.crflag is 1 for -r plus 2 for each -R.)


If you're willing to recompile, the patch is trivial: remove the line that displays the message from screen.c.


You can make the message go away by typing something. If you don't want to type a key that will reach the application inside the screen window, you can type C-a ` or some other unbound key.


A simple workaround of sorts is to immediately detach the screen session (either with C-a d or with the detach command in the screenrc file; -m on the command line doesn't work for this when -R is also specified), then attach to it again (e.g. by running the same command again).


A really kludgy but fully automated workaround is to include the following lines in the screenrc file to skip messages initially and reenable them one second later:


msgwait 0
screen -t post_initialization 39 sh -c 'sleep 1; screen -X msgwait 5'

(39 is the highest possible window number, it's a compile-time option (MAXWIN).)


Note that both workarounds will hide any message screen chooses to display when it starts, not just the useless “New screen...” one.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...