GNU screen: can't connect to display - gnu-screen

I'm using GNU screen on OS X and get this error if I start up / use a screen session remotely:
Application initialization failed: couldn't connect to display "localhost:11.0"
Unable to initialize window system.
Is there any way to re-establish a terminal session's connection to X?

Screen does not reset the DISPLAY environment variable when you connect to a new xsession.
You will need to reset your DISPLAY varaible to the correct value.
It is not a problem specific to osx
See here
https://superuser.com/questions/105954/updating-screen-session-environment-variables-to-reflect-new-graphical-login

Related

How open nested screen session with screen command linux

I want to open multiple sessions in one main session with a screen command, and I can do that after opening the main session and then press on the keyboard (CTRL + A + c) but I don't want this way I want to do this using the command line only because I create a script to open the main session with multiple sub-session, so how can I achieve this. And thanks in advance :)
CTRL+A+C doesn't create a new screen session. It creates a new window within the current session.
(With a little environment trickery, you could create a nested screen session within an existing screen session, where the outer screen session and the inner screen session could each have multiple windows, but that's probably not what you want to do.)
Each window within a screen session runs a command. By default, that command is your login shell. Thus you can have multiple shell processes running simultaneously and switch between them.
From any of those shells, you can create a new window under the current screen session using the screen command. It uses the $STY environment variable to recognize that it's inside an existing session, which tells it to create a new window rather than starting a new session. You could also type, for example, screen vi to launch a new window running the vi editor.
All this is covered in the screen documentation (info screen or man screen).
(Personally, I used screen for a long time, but then switched to tmux, which I find to be more flexible, more powerful, and easier to control from the command line. If you haven't invested a lot of time learning screen, you might consider switching. Or not; it's up to you, of course.)
You can do this using by by putting the following in your ~/.screenrc (or using a custom .screenrc file):
$ cat ~/tmp/screenrc_custom
...
<content of ~/.screenrc>
...
screen -t csh 0
screen -t csh 1
screen -t csh 2
$ screen -c ~/tmp/screenrc_custom

Unsupported Mac Mojave display Issue

The Mac built-in display is unresponsive to closed lid state and causes external display not to respond to resolution adjustment behavior on an unsupported Mac running macOS Mojave.
New Tag Request
unsupported-mac &
mac-display
Easy fix/workaround for this is to download a program that I fianlly found. Super easy. Here it is. https://github.com/Eun/DisableMonitor. Download and run. Click the display icon in menu bar and navigate to appropriate device and select disable. This will cause your external monitor to take true full power of your display environment.

how do you know your currently attached gnu screen session

We used gnu screen a lot in the office and sometimes if I don't take note, I end up getting lost as to what screen session I already am in.
So my question is, how do you know what screen session you're in? Do you have a way to check?
CLARIFICATION: What I need to know is when I do a:
~$ screen -ls
and I see something like:
There is a screen on:
4732.work_Sept42012 (Attached)
3551.web01 (Attached)
5521.mysql01 (Attached)
1255.tomcat05 (Detached)
3326.oracle15 (Attached)
1 Socket in /tmp/uscreens/S-icasimpan.
How do I know if I am currently connected to any of the attached session?
Thanks in advance.
In addition to the sessionname screen command, screen sets the STY environment variable for processes it starts. You can check the value of this variable from a shell:
$ echo $STY
5521.mysql01
$
Update:
ctrl+a, :sessionname can be used to display the name of the current screen session.
Previous reply (with missinterpreted question):
I struggled with this too until I came across the wonderful hardstatus feature. With these two lines in my ~/.screenrc I get the following at the bottom of my screen sessions.
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n*%f %t%{= kG}%+Lw%< %{= kG}%-=%D %M %d | %C:%s %A %1`%{-}'
What I am looking at here is a screen session on my local computer with three windows (bash, mumble, kalkyl). In the active window called mumble I am connected to another computer over ssh on which I am running another screen session with three windows (top, auto, bash). I can see see all windows in both sessions and keep track of where I am.

Xcode cocoa - dynamically change the checkbox bool

I want to write test_application for MacOS which will show whether IM client is running. This test_application also will have ability to start and kill IM Messenger (checkbox on/off)
I understand how to run / kill application with the help of push-buttons and now i want to show status of IM (is it running or not) and show checkbox ON or OFF depending on it
I suppose, i need to use some system call like "ps -aux processname" and parse it or use some API from Cocoa - but i can't understand how to get that information to test_application and how to do it outside any method (i want test_application to load initial information at it start, so if i open test_application it looks whether IM Messenger is running and makes checkbox ON or OFF without any clicks)
You can have a look at GetBSDProcessList and the Process Manager Reference to get running processes and daemons.
You could also use NSAppleScript and some AppleScript to launch the application or NSTask along with ps -aux processname and grep

Detach and reattach a complete Screen session with multiple windows

I am writing a client/server-application and when I'm testing the code I want to be able to have both the server and client in a separate terminal (+ vim). For this I thought I could use GNU Screen and divide the terminal in multiple windows (and it works great!). But I have a problem when I want to detach the whole session with windows and all. When I try to reattach the session I don't get them in windows like I arranged it, but instead they attaches like "normal" screen instances.
Also, is there a way to change the size of a screen window? Like change the height proportions of two windows splitted vertically.
your first question isn't possible because the regions (the way the windows are displayed) are bound to a single screen instance and not to a screen session.
C-a :
resize
see man screen for more explanation of the resize command