Multi Key Term
Multi Key Term is a terminal emulator that helps you create one to one maping between several keyboards and terminal sessions. This can help multiple users use the same system with only additional keyboards required per user. The display will be split to create multiple terminal sessions each associated with different keyboard.
Each Terminal is activated as user presses number keys from each keyboard. When you want to start the first terminal, press 1. To open another terminal, press 2 from a different keyboard and so on.
If you find this useful, you may:
- donate me via librepay.
- Help free software by switching to any GNU/Linux.
- Regardless of the Operating System you use, always buy
Debian main compatible hardware or at least ask for one.
- This can help free software, improve hardware lifetime and reduce Planned obsolescence.
Figure 1: Running
gtypist in two terminals
I had a situation where I wanted to teach several kids the basics of computer. The resources were pretty low that there was just one computer for around 10 kids. I found no existing solution that will allow multiple users use a computer with single display.
And I decided to write a software which allows multiple users use the
same computer where the only additional hardware required is a keyboard
per user, which is cheaper than a whole computer. My initial requirement
is to run
gtypist and so running multiple terminal sessions was enough
Building Multi Key Term
Install required dependencies.
# On Debian and derivatives (like Ubuntu) sudo apt install build-essential meson libgtk-4-dev xsltproc \ appstream-util docbook-xsl libvte-2.91-gtk4-dev libinput-dev \ libxkbcommon-dev libudev-dev gettext appstream libadwaita-1-dev \ desktop-file-utils # On Fedora and derivatives sudo dnf install @c-development @development-tools vte291-gtk4-devel \ gettext-devel gtk4-devel meson desktop-file-utils libinput-devel \ libxkbcommon-devel systemd-devel docbook-style-xsl libxslt libadwaita-devel \ desktop-file-utils
meson is used as the build system. Run the following to build:
meson build --prefix=/usr cd build && ninja sudo ninja install # To install
build is a non-existing directory name. You may use any
name of your choice.
Running Multi Key Term
# If you have installed application: sudo multi-keyterm # If you want to run the application without installing: sudo ./run # to run from the build directory # You can add '-v' multiple times to get verbose logs: sudo ./run -vvvv
Once the Multi Key Term is open, press 1 to open the first terminal. Then if you press 2 from a different keyboard, a new terminal will be open, and so on. Input from those keyboards shall only go to the corresponding terminals.
- Works only as root
- It’s better to not run GUI Applications as root. Help welcome if you can fix this, eg.: by using polkit.
- Gtk/mutter seems to create one logical keyboard device and
map all keyboard events to the one created. Also, wayland
doesn’t seems require one to one maping of keyboard devices
wl_keyboard. So we can't rely on them and we directly access input devices with libinput.
- You shall be able to avoid this by adding yourself to
inputgroup. But it
maybe better to allow one application to run as root than to allow every application to have access to all input devices. Adding yourself to
inputgroup shall also fix various issues enumerated below.
- Won't stop users from pressing system wide keys
- Which means that any one user can disrupt others work by key combinations like Alt + Tab Control + Alt + F3 or Alt + Sysrq keys.
- All keystrokes shall be processed as long as the window has focus state
- Which means that if you are able to switch window in way that won’t effect the window focus state (as per what GTK reports) the keys will then be processed both in the focused window and Multi Key Term. Eg.: pressing Control + Alt + F3 when you have focus on Multi Key term may result in the following keys pressed to be processed by both tty and Multi Key Term. Or say, When you unlock screen after lock, the password you type in unlock screen may be shown in Multi Key Term if the window was in focus when screen was locked.
- Slow downs the system when used in GNOME Shell with X11 backend
- Likely this is an issue in mutter x11 backend
- Use GNOME shell wayland
- keyboard input is limitted to US pc105
- The LEDs on keyboards may be in a limbo state when the app is closed
- Since the LED states of keyboards are individually updated, each keyboard may have different LED states. This can be fixed by pressing the corresponding keys that have inconsistent LED states after the application is closed (so that your system shall update the LED states right)
gtypistmay fail to open if the window size is too small. This is a shortcoming of
gtypist(or the underlying
ncurseslibrary). You can use custom gtypist lessons to workaround this issue. I personally uses the file
Copyright 2021, 2023, 2024 Mohammed Sadiq <firstname.lastname@example.org>
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but Without Any Warranty; without even the implied warranty of Merchantability or Fitness For A Particular Purpose. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.