Restrict keyboard short-cuts in x11vnc - vnc

How can I restrict keyboard shortcut options in x11vnc?
for example, I want to restrict Alt+F4, Alt+x, Ctrl+Q, etc.
Is -skip_keycodes option of any help here?

You can probably configure such shortcuts in your window manager. That way, such shortcuts won't be passed to the application, and you should be able to handle them.
But, since you seem to want an application running all the time (you want to prevent users from closing it), then it might be a good idea to write a simple script like this:
while true; do run_your_application ; done
That way, if the application crashes or is closed, it is restarted. (be careful about applications that fork themselves or detach from the terminal!)
On the other hand, if you just want a browser, you can try using the kiosk mode from Opera browser. See also kiosk software at Wikipedia.
Update: So you are using Gnome... I don't use Gnome, but a quick search at SuperUser gave me this answer:
https://superuser.com/questions/132666/how-to-disable-control-alt-arrow-gnome-window-manager-control-for-redhat-linux
[…] all the keyboard shortcuts gnome uses are under System, Preferences, Keyboard shortcuts.
But... Are you sure you want a Gnome environment running there? Do you really want users to be able to run and configure anything from your Gnome interface? Maybe you would prefer another more minimalistic Window Manager. Which one? I'm not sure, must look what are the alternatives and try some of them. Depending on the application, it might even be possible to run it with no window manager at all.
I don't what kind of problem you are trying to solve, but maybe using a VNC applet in a webpage in order to have access to one application might not be the best solution. Of course, it depends on what is the problem and who are the users.

Related

Can you embed a Linux command line in an application?

I have maybe a strange question: is there a way to embed something like the Linux command line in an application? Specifically I'm imagining hacking games like Uplink where there's a command prompt in-game that you interact with. They're sometimes done well but often not, since writing a command line interpreter is a lot of work on top of making a game. If there was a way to leverage actual command line tools that would both cut out a lot of work for the developer and also help with immersion (it's a Unix system, I know this!).
It would need to be something like a sandboxed virtual machine, since you wouldn't want it to interact with the real host machine, just a fake in-universe computer. But it'd still be nice to support things like bash.rc, piping commands, foreground and background tasks, and keyboard shortcuts.
I'm imagining something like how Lua embeds in C, where you'd get callbacks in the host application when the virtual linux machine wanted to interact with the console, read/write files or start up threads.
But I don't know if anything like this exists, or even can exist without more effort than it'd be worth? I'm not even sure exactly what terms to google to start researching this.

Making a GUI in Linux without booting the OS's GUI

Sorry if I'm using wrong terminology here.
I'd like to make an appliance for users that's running from a Raspberry Pi. When it's booted, I'd like users to see my own GUI that I'll design (hopefully in PyQT but I'm not sure about that yet.)
The thing I don't know how to do: I don't want the users to see the Linux operating system on the screen at all. I don't want them to see the desktop and launch my app. I want my app to be automatically launched on startup. I want it to be the only thing accessible and visible to the users. i.e. it should be full-screen and a user wouldn't be able to exit it or interact with the OS in any way.
How can I do that?

Does a window need a graphical environment to exist?

This one is a pretty strange question of mine so I'll try to explain the best I can.
On a DOS Linux distribution, without having installed any graphical environment, if I start an application which is supposed to have a GUI, will I be able to interact with that window via code?
What I thought is that if KDE/GNOME's role is to graphically represent an existing GUI, I should be able to interact with it but if these graphical environments have an active role in the window creation there is nothing I can do.
You won't be able to run a graphical program without a window manager.
The reason is that the window manager is doing a lot more than just allowing the window to be shown to the user. It comes with libraries and services for constructing windows and components and interacting with them. Without these libraries and services, the program won't be able to start.
The only exception would be if a program contained all the graphical code built into it, and didn't rely on a window manager. Realistically this would only happen for a fairly simple program and in special cases; for instance, Raspbian includes OMXPlayer, which shows full screen video without relying on any window manager.
Quoting (with some adaptation) from https://raspberrypi.stackexchange.com/a/3974 which answers how to start mplayer in X11 without a window manager:
The X server is really usually called X and you can just start it. You can set the DISPLAY number as an argument along with some other things.
You might want to have some sort of session, though, and still go through xinit or such and start X with startx. You can use .xinitrc or such as a script and simply not start a window manager there. You will need a "magic client" as the last command that stays running so X doesn't terminate immediately. In a traditional "failsafe" session, that was an xterm. If you know what to launch and launch once only, it could be that program or any UI/wrapper that does the launching for you. When the last ("magic") client in the init script terminates, X terminates.
If all you want to do is play video, you might see if you can run mplayer with directfb instead and skip using X11 entirely.

Hardware+OS setup for an Application

I want to make a system which would get input from USB barcode scanner, validate it on remote server and display an answer (text and images).
I would use JavaFX or in-browser JS web application to grab scanner input somehow.
I'm planning to run this application on Raspberry Pi or plain PC.
Is there a way (or a special linux distribution) to ensure that system always loads the same way and starts JavaFX app or opens particular web page in browser?
e.g. no login page, NO update or other popups are shown.
Any other ideas? Thanks
...
Found an interesting solution here, where JavaFX GUI app is started from command line, without X-Server(linux graphical interface) at all.
I have recently done something similar, and it's not too hard. Obviously working on the Pi, you will want to use something like Linux and having limited hardware will mean that you should be minimising what you are running. Due to this, I would recomend that you run a light weight distro. Something like arch (which is what I used) allows you to build only what you want from the ground up without the need to find and compile everything like you do for LFS or Gentoo.
As for booting, the following two wikis will give you the details of starting the Gui without manual login:
https://wiki.archlinux.org/index.php/Automatic_login_to_virtual_console
https://wiki.archlinux.org/index.php/Start_X_at_Login
After that, it is simply a matter of putting the command to launch your program in .xinitrc.

How to simultaneously run multiple window managers (esp. xmonad) for VNC

I'll start with a little background. A small project of mine has been to try to use my Android tablet as an external monitor for my laptop using a VNC client (vnc4server). There are two main options for doing this that I have seen. The simplest is to use xrandr and widen the screen, creating a section just for the tablet. However, this can cause some graphics issues if I understand correctly, although it has the benefit of permitting windows to cross displays. The other option is to run a separate desktop session for the VNC server.
I have chosen to go the route of a second desktop as the session can live and die without significantly affecting my main session and can in theory be tailored specifically to the tablet. A little tool called x2vnc allows me to connect to the VNC server in a similar manner to the more popular Synergy and use it like a n external monitor. I also have the nice little benefit of being able to easily and cleanly switch from landscape to portrait using xrandr.
This brings me to my current issue. So far, I have only been able to reliably use plain x-windows. Although this is entirely functional, I would prefer something more complete. Although xstartup examples have been posted for a variety of window managers, none of these seem to run properly. I suspect all of these are for headless systems. Gnome/Unity are each unforgivably slow and seem to conflict with my existing session. I also feel that these are a little too cluttered for my ten inch tablet. On the other hand, Xmonad simply crashes as soon as I try to open a second window in addition to not updating the graphics properly.
I would like to know anything that will lead me in the direction of a better stable desktop environment. This includes configuration tips and alternate window managers.
I am currently running Ubuntu 12.04 with gnome-xmonad (recently Unity). My xstartup is plain x-window-manager. I have tried any readily available examples for gnome and xmonad that I have been able to find.

Resources