Access to a monitor not containing the desktop - linux

On a computer with multiple monitors where the desktop is not shown on one of them, is there any way to draw on that monitor from a program?
Reasoning: I need to display a variable image full-screen on a separate monitor, without the user being able to disturb the screen with the mouse or without being able to shift windows on top of my image. Example: a computer has one monitor and one projector connected; the monitor shows a "normal" desktop and the projector shows the generated image (say, a color gradient).
The first use would be on Win7, but if a portable solution exists, an X11 solution under Linux would also be nice.

On Linux this is easy using xvfb, a virtual framebuffer. The command is:
Xvfb :1 -screen 0 1600x1200x32
You can run programs on the virtual screen by setting the environment variable DISPLAY=:1
The best part is the user doesn't even have to worry about interfering with the mouse or keyboard. Very useful for testing.

Under Linux, you can also run a second X session on the extra monitor
Xorg :1 -config /path/to/xorg_1.conf
But you'd need to write a xorg_1.conf configuration file to feed in.

Related

Changing Resolution of Linux Framebuffer

I am writing a high performance video application in linux and C++ (but language shouldn't matter for this question)
I currently have my application such that I can display images to the Framebuffer. When my computer boots, the resolution of the display connected seems to be set permanently. I would like to be able to change the resolution output on the computer dynamically. I have tried fbset but it did not work. I am not using X11 because I assumed that there would be a performance decrease.
Is directly writing to the framebuffer the best way to be doing my
rendering for performance?
If I use X11 I see that I can get commands
to change the resolution. Should this be something I investigate?
Is there another way to change resolution?

Can I attach screen after system restart?

I used to create a screen and use vim to trace source code.
I usually use the commands to create, detach and attach a screen to keep my vim status.
$ screen -S vim_src1
[CTRL+a] d to detach the screen
$ screen -r vim_src1
However, screen status will be killed after system restart.
Can I attach screen after system restart?
After a system restart there is no screen session to attach. You can certainly create a new session.
A screen session that you could attach has been running since you detached it. A system restart kills all of the processes (including those running in screen).
In desktop environments, you may see occasional support for saving "session" state. Doing that relies upon each application to save its state when asked, e.g., on system shutdown. That can be workable for large GUI applications (which are designed to handle events). But in contrast, screen is mostly used for shell applications where this is done rarely.
Rather than require each application to save/restore itself, it is conceivable that the operating system could be designed to do this. But that does not appear to be the case for the systems we are using.
Further reading:
How to Automatically Remember Running Applications from Your Last Session in Ubuntu 14.04
How can I keep restore for apps in Lion without having session restore when I log in?
I can interpret your answer in a few ways, because I'm not 100% certain what your objective is. I'll try to give the two most obvious options I'm aware of.
You can configure your screen session with ~/.screenrc so it always launches the same with, with labels and for screens, and it will even launch applications for you. For example:
defutf8 on
caption always "%{= kK} %{K}%-w%{+b w}%51>%n %t%{= K}%+w%<%-=%{= kK} me#localhost | %{w}20%y-%m-%d %{w}%0c:%s %{-}"
shelltitle '$|$'
defscrollback 10000
termcap xterm|xterms|xs ti=\E7\E[?47l
terminfo xterm|xterms|xs ti=\E7\E[?47l
startup_message off
screen -t vim 0 vim $HOME/todo.txt
screen -t ipython 1 ipython
screen -t finch 2 finch
screen -t mutt 3 mutt
screen -t top 4 top
chdir $HOME/Repos/git
screen -t CL 5
screen -t git 6
If you actually want to be able to save a session that you're in you might consider using screen-session.
https://github.com/skoneka/screen-session
Session saver currently supports saving of: layouts, scrollbacks,
titles, filters and is able to restart programs run in windows. It
recognizes regular, group and zombie windows. Currently there is no
support for serial and telnet window types. By default, session saver
also tries to save Vim sessions using ":mksession" and ":wviminfo".
Session saver accesses important data by directly reading /proc
filesystem and sorts processes by parent pid. There is almost no
"stuffing" of commands into windows (except when saving Vim sessions)
so there is no interaction with programs itself.
During session loading, every new window starts with
screen-session-primer (a small C program) which displays a list of
processes and asks user what to do: whether to start none, some or all
of window's processes or directly starts programs provided
"--force-start [win_num]" option was used.

Embedded Linux with Standalone application

I want to make Linux Os which run only one application as a full screen without showing any Login window at start up or title-bar and minimize/maximize/close button.
Is there any way to do this? It's Embedded platform and I already build Linux os for it and I also have application.
In the nutshell - X System is extremely flexible.
When you system starts up, it does the following steps:
Loads and runs the Kernel (and related initrd, if any, but it's irrelevant)
Starts init (process 1)
Starts system services, networking, etc.
Starts X server
Starts Window Manager (the application responsible for resizing windows etc)
Starts your application.
What you need to do, is to first disable GUI login and session (easiest to disable X) - you'll be able to log in through the console terminal (You can always access it with Ctrl-Alt-F1)
Then, launch something along the lines of
X &
DISPLAY=:0 ./yourapp.exe
If your app can handle making itself fullscreen, that would be it.
Add this to your startup scripts and you're there.
More explanation
The purpose of the Window Manager.. is to manage windows. It's that simple :)
Basically, there are 3 components of your typical X session.
X Server - the piece of software that provides an abstraction layer around the hardware (GPU drivers, Keyboard, Mouse, Touchscreen, etc). It has a concept of windows - areas where X Clients can draw into.
X Clients - Everything else. Your software, if it draws something, is likely one. So is the web browser, etc. The connect to the X Server, and draw.
Window Manager - A special type of an X Client, this piece of software provides the ability to control the windows on your screen. It often draws window decorations (minimize, maximize buttons), sometimes draws a taskbar, etc.
You are free to mix and match them entirely as you please. Simpler, minimalisting window managers, such as my ratpoison which I prefer for many prototype embedded systems only have the notion of fullscreen windows, and can switch between fullscreen apps (think Windows 8 Metro). Others draw window decorations, and allow overlapping and cascading windows.
Since developing a Window Manager is a simple and modular task, there are literally hundreds to chose from. You also can choose not to use one at all, at which point your windows have to self-manage (you'll not be able to move them around by default). Many applications respect the -geometry 1920x1080+0+0 parameter, telling them to open a window in 1920x1080 resolution at the 0,0 corner - effectively fullscreen.

Map stdin from second keyboard to a specific program / tty

I have a program (a bash script actually - console only) that scans or makes copies, etc based on user input. It asks questions such as how many copies would you like to make, etc and then scans the document, and prints it to another printer. The program runs in a loop so it's always there when a user passes by, and using a keyboard or number pad you can easily operate it. It basically makes a simple scanner/printer combo into a complex multifunction device.
I can leave it running on a dedicated system just fine, but to save electricity and resources, I would love to have it run on a computer someone else is already using. There is a user who has a laptop on the same desk as the scanner, and I was wanting to have her be able to do her thing in Xorg, as per usual, but have this little program running on an external monitor. That part is easy, but separating input is not. First of all the window has to be in focus, and then any input from the laptop keyboard OR usb keyboard is sent to the program, obviously.
I can think of one way to do this: using virtualbox, I can run a virtual machine without X, have it permanently ssh into the host OS (to which the usb scanner is connected) and I have virtualbox grab the usb keyboard input. But that seems excessive.
Does anyone know of a way to map input from a specific keyboard to a specific program or tty?

Map framebuffer into an X window

Is there any easy hack or existing application that shows an existing framebuffer device (eg. like /dev/fb0 in an X window? So it would be possible to monitor multiple framebuffer applications simultaneously or peek on them from time to time without leaving the desktop.
Isn't x11vnc supposed to be able to do that?
x11vnc -rawfb map:/dev/fb0#1024x768x32

Resources