Completely empty X11 (no window manager, no nothing) - possible? - x11

for an embedded video player I need X11 to start with nothing on it, I'll start xine via script later in the process.
A "naked" X11 install will always start xterm, killing xterm will also kill X11.
Any idea on how to start X11 "naked"?
Your answer(s) are as always highly appreciated,
thank you,
PS. Also, for bonus, any good (ie. no .bashrc, no mingetty --autologin) ways of starting X11 on boot?

You can run X by just running 'X' or 'Xorg' from the command line. To start X on boot, it depends on your system. Linux systems with an inittab can add X as another tty, the way it's done in inittab for other ttys. FreeBSD users can put it in /etc/ttys.
An alternative is to use a custom .xinitrc for root, that runs the script that you want. You will need to authenticate against the X server somehow, so the .xinitrc route is probably the easiest way to go.

If you use just call X directly instead of gdm or similar you can get a plain (i.e. empty) display e.g.:
/usr/bin/X :0
If you want to make this happen automatically you could put it in /etc/rc.local (if you have one), or write an init script of your own.

Related

Adding custom commands to terminal along side application

I am working on an application where we are using xtermjs and node-pty inside of an electron application. We are adding a terminal to our application and would like to add some custom commands that are used in the terminal that are related to our application.
What are some options for adding these commands?
We want them installed with the application.
They don't have to be useable inside an 'external' terminal, but it is ok if they are. By external, i mean your normal terminal. Not our xterm & node-pty implementation.
And we want them to behave the same as other normal unix commands. Where you can pipe with other commands && them together and stuff.
I have played around with intercepting commands between xterm and node-pty and that was a disaster. I am now considering, just writing bash scripts for the commands and having the installer manage putting them where they need to be so they can be used.
Just wondering what my options are, thanks.
You can simply put all your executables in a directory that you add to your PATH when you invoke the shell in your terminal emulator.
The commands will be available to the user like any others in any construct that accepts commands, regardless of the user's shell or shell version (i.e. it'll work equally well in bash, zsh and fish).
If you need the commands to coordinate with your terminal emulator (e.g. if you want to process the command in JS in your Node.js process), you can arrange that via a second environment variable containing e.g. a host/port to connect to.

Osx - users and GUI

My question is very simple.
How does OSX understands that this special process needs to make output to special terminal? Can we change it?
For example, is it possible to run process via ssh connection (without GUI) and make some system call, and this process will start using OSx GUI
I don't really understand your question, but I suspect you maybe have a look at the "expect" tool, which allows you to start some connection and then let the user continue after you have established the connection. Try:
man expect
in a terminal window.

running Mathematica remotely on macs

Here is what I want to do:
I want to run Mathematica on another Mac from my Mac (both Snow Leopards). I want to do this because the remote Mac has multiple cores/processors while my local Mac is rather shabby. I would like to have the front end still locally (i.e. the graphical interface).
What I've learned:
I used to do this type of thing from multiple Linux machines and was expecting to have similar success for Mac-to-Mac operation. However no such luck.
The problem seems to be a display issue (front end).
Mac front end runs in Aqua while X11 is what is really needed (this is why there is no problem on Unix). While Macs have X11, for some reason Mathematica can't use it.
So how do I get around this issue?
Possible solutions that I have had to rule out are: 1. screen sharing. Not practical since someone else will be using the remote Mac on another account. Screen sharing only uses the active screen. 2. Installing Unix on the remote computer. Not possible in my situation.
Thanks.
You should be able to set up a remote kernel on the other Mac. This is done through the Evaluation > Kernel Configurations menu item. The you can set the remote kernel for a given notebook using Evaluation > Notebook's Kernel or globally via Evaluation > Default Kernel.
I haven't done this in a while, and it's sometimes useful to test things from a terminal with something like
ssh <user>#<remote.machine.com> </path/to/remote/Mathematica.app/Contents/MacOS/MathKernel>
Why not use the command line kernel? I have a script math which does:
#!/bin/bash
rlwrap /Applications/Mathematica.app/Contents/MacOS/MathKernel
I built rlwrap from source, but basically that tool gives you readline behaviors. You can just do
ssh remote-machine /Applications/Mathematica.app/Contents/MacOS/MathKernel
The only solution, I believe, is for you to upgrade to OS X Lion. It allows simultaneous screen sharing sessions where each user can control the screen for their own account:
http://www.apple.com/macosx/whats-new/features.html#screensharing

Hook up into another Terminal process?

I've got two terminal instances/processes opened with different PID.
Is it possible to from one of them, hook up into the other so when I type something and it outputs something, then the other terminal will see the output too (maybe the input too if possible?).
Just like cloning the terminals.
I want this because then I can hook up some SSH processes and everyone connected to the machine could see what the other one is doing and could also collaborate.
I don't want to use any GUI or other workarounds for this.
Want it to be in process level.
I'm using Ruby and Ubuntu.
Install GNU Screen, run screen in the first terminal, then screen -x in the second.
(This works for both input and output).
Go hack the kernel.
But if you need a practical workarou^Wsolution, I'd advise using screen.

Another shell open when at server?

How can I have another Terminal open when I am at my server by ssh?
I do not want to type my password twice to get another terminal for my server.
Perhaps, Bash has buffers similarly as Vim.
Check out GNU screen. It's kind of arcane and awkward to use, but does what you're looking for, and it's probably also installed on your server.
You can also forward X11 and run multiple xterm instances, but that's a pain.
Your best bet, though, is your proverbial "type my password every time" solution: you should set up SSH keys so you don't need to type your password every time and then just use multiple connections in Terminal tabs.
You can use something like GNU Screen.
The Bash shell has a feature called Job Control that allows you to run and manage multiple processes. You can read about it here: http://commandlinemac.blogspot.com/2008/12/bash-job-control-fg-bg-jobs-and-ctrl-z.html
GNU Screen
BTW. If you don't like typing passwords, try PK auth.
How it's done with PuTTy.
It's possible to use screen to open other terminals without needing to authenticate again.
Screen can also detach so that you can leave terminal open after logging out and re-attach them later. I use this on my home server for keeping rtorrent open.

Resources