There isn't currently any quick and easy way to enable this kind of functionality on the desktop version of Ubuntu.
Personally I'm a big fan of the default compose key shortcuts; I find them faster and a lot more intuitive than mobile-style long press selection (♥). That said, if you have the time and determination, you might be able to piggyback the slowkeys option in the default core Universal Access application to build something similar to the mobile option.
Poking around in that myself, XKB seems to be associated with slowkeys control. You can use XKB to configure and enhance Ubuntu's keyboard bindings, and as far as I can tell, this section has what you need. So it shouldn't be that (relatively) difficult to have an alternative character print when a key is long-held.
Where things get complicated is assigning multiple special characters to a keystroke (example: hold down "a" and get options for ä, à, á, â, etc.). How do you cycle through the options? Do you have the characters pop up in a dialogue window, then use the mouse, tab or arrow keys to select one? Seems time consuming.
Or you could assign different hold lengths to different characters. 100ms hold for à, 200ms hold for á, 300ms for â... But remembering how many seconds are for which characters could get tricky, not to mention assigning all of them individually would be a headache. Plus when you get into longer lists of characters you could be sitting there holding a key for a good 3-4 seconds. Seems even more time consuming.
Rather than slowkeys, you could try the repeatkeys option instead to have multiple taps of a key provide a special character: 3 taps of "a" for à, for instance. But then you run the risk of having unwanted special characters popping up when you type anything like "good", or "eerie", or "aaaaaaahhh!"
You may have come up with some other, more efficient implementation method that I'm not thinking of, in which case go forth and modify! But I'll still recommend compose key combinations in the meantime. ☺
In the image below I have limited the number of keys by blacking out the ones that, in my opinion, would not really be used for this (enter,arrows, hardware etc) and coloured the keys to be modifiers in gray. This will give us a nice starting point.
This gives us, 6 modifier (mod) keys and 63 normal keys (key), so to get the amount of two key combinations we can do key*mod
and get 378, call this A.
To get the number of three key combinations we have 6 mod keys and each can be paired with another, so each key can have 5 combos. If we do 6*5
we get 30 (com) and we can multiply this by key to get the number of three key combinations com*key
is 1890 and call this B.
Finally we can add A to B and get the number of mappable shortcuts for Unity, within the given criteria.
A+B = 2268
To summarize:
mod*key + com*key = answer
You should be able to use this on any keyboard by assigning the numbers to the variables (key, mod, com) by counting them and then using the final equation to work out the number of possible shortcuts.
I am no mathematician but I think I did this right, please anyone feel free to tell me if I am not in the comments but I had to answer this, it was driving me nuts.
Best Answer
I'm not sure if I completely understand your question but, without n-key rollover using PS/2 you can only have 4 modifier keys per keyboard.
Excerpt from this article.
PS/2 vs USB Technical Limitations
Keep the following in mind if you have an n-key rollover keyboard that can be hooked up to your computer through either USB or a PS/2 port:
USB protocol limitation - A max of 10 simultaneous key presses are recognized, 6 non-modifier keys ('w', 'a', 's', 'd', etc) + 4 modifier keys (Shift, Caps, Ctrl, etc). Although you are limited to 6 regular keys you are still guaranteed that any combination of keys will be recognized properly if you have an n-key rollover keyboard. I would guess that most people would not need support for more keys than this. I would also guess that the 6 key limit may have had something to do with braille input requirements rather than someone choosing an arbitrary limit (although that doesn't explain why the limit exists in the first place). PS/2 - There are no limitations when using a PS/2 connection with your keyboard. You will truly get full n-key rollover support.
So using 2 standard keyboards without without PS/2, I think that you could have a maximum of 8 modifier keys.