Schizo Desktop II: Keyboard and Mouse
I have an office. It's like a home office but it's in another place. It's just mine, so I get the peace and quiet of a home office but also get to go outside to get there. It's a good setup.
BUT I have two computers there. Well, actually I have like 10, but I interact with two. One is my personal desktop computer, the other is my work laptop. and I want to use the same peripherals in the same way with both of them. That's why I have the world's most complicated schizo desktop setup.
This series of posts will document it, the why and how of it, and the various things I've learned along the way, along with making you want to buy weird chinese gadgets.
Today: Keyboard and Mouse
I have 2 keyboards and no mouse. Instead of a mouse I have a trackball but for all practical purposes ... 1 mouse.
How do I use them with two computers?
The answer is Barrier which runs a server in my personal machine and a client in my work laptop.
With it running, I can just slide my mouse to the edge of the screen of one computer and it will appear in the screen of the other computer. It's like magic.
I can even copy/paste between them transparently, I just can't move windows across the frontier for obvious reasons.
How do I use them with random computers?
My keyboard has 3 modes:
- Wired (always connected to my personal computer)
- Bluetooth for up to 3 devices (not connected to anything)
- 2.4Ghz dongle (not connected to anything)
So, if I have a random computer (say, a raspberry pi I need to debug) I can just switch the keyboard to use the 2.4Ghz dongle, plug it into the computer and use it that way.
What about the tiny keyboard?
That's macros. The wheel is volume, and also controls my lights and other things. The buttons do things like control my air conditioner.
It's a super cheap chinese one, and they have recently become configurable in Linux, which is always nice.
Why a trackball?
Why not a trackball?
Any special keyboard configuration?
Oh yes. because it's a 65% keyboard I have to choose between having an escape
key or a ~
key.
So I chose both, and mapped escape
to the caps lock
key.
So when I start my session I run this:
# Map caps lock and esc to proper keys
xkeysnail --watch --devices "ROYUAN GamaKay 68" .config/xkeysnail/config.py &
sleep 1
setxkbmap -model pc104 -layout us -variant altgr-intl -option
The xkeysnail
tool configures this keyboard (and only this keyboard) using this file:
from xkeysnail.transform import *
# define timeout for multipurpose_modmap
define_timeout(1)
# [Global modemap] Change modifier keys as in xmodmap
define_modmap({
Key.CAPSLOCK: Key.ESC,
Key.ESC: Key.GRAVE
})
So I get escape
in the caps lock
key, and ~
in the esc
key.
Then setxkbmap
configures a us international keyboard layout with the altgr-intl
variant, which is the one I like.
Conclusions
This one is not very weird, other than the reliance in a single keyboard and a trackball. If you use multiple computers in your setup I recommend Barrier, it's a great tool.