Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Is there a Linux Equivalent to VK Keys?


    Hi,

    I'm currently working on a video game, and aren't really happy with how the input system is currently working, I want a system that works better with various types of keyboards. For example, I'm from the UK, and our keyboard layouts slightly different to the US layout, and this causes some key errors in both Unity & Unreal Engine.

    The closest solution I found to this is VK Keys, or Virtual Keys, unfortunately it's not possible to use this since it's platform dependent to Windows, and is not supported in Mono (only in .NET)

    So my question is, is there a Linux/Mono equivalent to VK Keys? Essentially what I want to be able to do, is say a key (for example, the ';' key, since this is one that doesn't work on UK keyboards in Unity & Unreal) and that be able to detect if that key was pressed on the various types of keyboards.

    I'm not sure if I've explained VK Keys well, and unfortunately I can't post to an external URL (less than 15 posts) - so let me know if you need anything further explaining :)

    Thanks in advance for your help :)
    - Steven

  2. #2
    Linux Guru
    Join Date
    Dec 2013
    Posts
    2,747
    the way i undestand is that vk keys is an ingenious utility that allows you to overcome the limitations of windows and assign custom actions to keys, or remap them.

    since linux does not have these limitations, there is no need to overcome them either, and an equivalent can not exist.

    but you might want to look at
    Code:
    xmodmap
    xbindkeys
    xdotool
    with their respective documentation.

    though i struggle to understand how that could be helpful in game development.

  3. #3
    Hi, thanks for your help so far, I realise I didn't really explain why I want to do this for games - essentially, in Unity, the input system is built for US Keyboard Layouts, this isn't a problem most the time, but some keys on the UK Keyboard register incorrectly - for example, the ; key registers as ' - while I realise this is only a small issue, I worry that foreign keyboards which layout differs even more from the US Keyboard layout than the UK Keyboard does, will have keys registering incorrectly. Essentially, I'm not really planning on using the Virtual bit of Virtual Keys if that makes sense, but this system converts physical key presses to virtual keys (if I'm understanding it correctly) - and I'm trying to find an equivalent of something like this for Mono (so I can use it for both Windows & Linux)

    Thanks for your help, and sorry for not explaining it very well :)
    - Steven

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru
    Join Date
    Dec 2013
    Posts
    2,747
    Quote Originally Posted by SeveRM View Post
    I'm trying to find an equivalent of something like this for Mono (so I can use it for both Windows & Linux)
    won't work.
    keyboard layout is operating system specific.

    i suggest you simply change unity engine's preferences.
    if that isn't possible, then that engine isn't worth sh!t and you should start looking for alternatives.

  6. #5
    Linux Newbie sarlacii's Avatar
    Join Date
    May 2005
    Location
    South Africa
    Posts
    223
    Yip, the keyboard mapping (like locale) is a pretty "low-level" setting for the OS, based on initial installation or later setup. Trying to remap keys will not work reliably, as the key code sent to the system will still be incorrect. That's like trying to auto detect the attached device, by asking the user to press a certain combination etc. What you have to do is setup your app to check the keyboard map associated with the system (eg. /etc/default/keyboard, or whatever locale system is in use) and then move on from there.

    Trying to work the other way around, i.e. not checking the keyboard settings, and then trying to dynamically remap them is going to cause issues... only the user has a visual indication of what is actually printed on the key.
    Respectfully... Sarlac II
    ~~
    The moving clock K' appears to K to run slow by the factor (1-v^2/c^2)^(1/2).
    This is the phenomenon of time dilation.
    The faster you run, the younger you look, to everyone but yourself.

  7. #6
    i suggest you simply change unity engine's preferences.
    I'm afraid that's not possible, unfortunately that's what lead me on this path of trying to find an alternative way of detecting input methods.

    What you have to do is setup your app to check the keyboard map associated with the system (eg. /etc/default/keyboard, or whatever locale system is in use)
    There's a problem though of even if I detect what keyboard version they are using (which is proving to be a difficult task of it's own), some keys are reported as the same, I went back to Unity to double check the key errors so I can say them properly here: the ' (quote) key reports as the ` (backquote) key (below escape), the ` (backquote) key reports correctly (as itself) which means both quote and backquote are reporting as backquote. And # (hash) is reporting as ' (quote). Essentially some keys are incorrect, and some are duplicates.

    As I say, I know this isn't a major issue for UK keyboards, but I'm concerned incorrect keys might be a bigger problem on other types of keyboards, especially non-English ones.

    Thanks for your help so far, and I realise what I'm asking might not be possible, but thank you for trying to help :)
    - Steven

    PS:
    if that isn't possible, then that engine isn't worth sh!t and you should start looking for alternatives.
    I do find it quite surprising that something like this isn't possible in Unity, but from what I've been reading, Unreal has the same problems (these are the 2 biggest game engines on the independent scene).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •