Keyboard mapping for chorded keyboard - macos

I want to create a new keymapping on macosx, so I can create advanced multi-key commands.
Basically, I want to create a a keymapping for transforming a normal keyboard into a chorded keyboard, optimized for writing code in c-like languages.
What I am wondering, is it possible to create that general keymaps, or is it possible to create a layer in the OS, intercepting the keyboard input at a low level and implementing the transform there.
If not, does anybody know where I can find sourcecode for a driver for a general HID-keyboard, that I can use as a base for a keyboard driver doing this?

I think this is where you want to start:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/HandlingKeyEvents.html
I'm interested in trying out the same thing actually, I really dislike most of the chorded keyboards I see and would prefer to prototype w/o building the h/w.

Related

Drawing popups in X11

I would like to draw a popup in X11. Something like the slider that appears in KDE and GNOME when you press volume or brightness control buttons. This is what it looks like in GNOME:
What library should I use to create such popups (unlike normal windows they should be without borders, etc. and possibly with some transparency)? Would be nice if there were bindings for Python.
This is done in GTK+. The easiest thing may be to find the code that creates that and copy what it does (my system has a different volume notifier, I'm not easily finding the code for that one).
Roughly what you'd do is create a GtkWindow, set_decorated(FALSE), set_position(GTK_WIN_POS_CENTER), something along those lines.
I'm not sure of the best set_type_hint(). Maybe TYPE_HINT_NOTIFICATION or TYPE_HINT_SPLASHSCREEN. If you do set the type hint, it may not be necessary to set_decorated or set_position since the type hint may imply those with many window managers.

keyboard functions in mathematica

I am trying to find out what keyboard functionalities Mathematica has. Would appreciate anyone to give some help. Specifically, I want to:
1) How to implement something like "press any key to continue..." behavior
2) How to accept user input?
Many thanks.
First, you'll want to look at Input and ChoiceDialog for something simple.
If you want to build your own interface, you can use the dynamic interactivity components with CreateDialog to construct a custom notebook dialog window to accept and return whatever kind of input you'd like.
You might find the Introduction to Control Objects and Generalized Input tutorials useful as well.

Interactive TextArea (collapsible bullet points)

I don't work with Graphical interfaces very much, most of my experience has been with Java. I realize the operating system provides some "native" controls that allow you to do things. What if I want to do things that are a little more fancy but feel like the native control?
What I'm thinking is having the simplicity of editing in a TextArea while provide the ability to collapse lists just like a tree. I would also like to be able to display text between lines that the user could click, it should be aligned under the right most text and be smaller.
I'm not thinking in terms of any language or GUI library. Just wondering how to go about creating something like this. Would I overlay some drawing onto the TextArea which would scroll with it? Would I use something like Cairo and build my own text field losing built in copy and paste...
What do other text editors use that allow them to fold code?
There is no universal solution to this. It varies depending on GUI. Every GUI has a different way of responding to user events such as mouse clicks, keyboard shortcuts, etc. There is no universal approach to this.

GUI and non gui difference

as i know we have gui and non gui application today. but remember back in the old days there were many application thats kinda like half gui half not .
the applications are text based and it has no GUI like what we have now if we were to use java swing library or etc.
but you could pretty much select the area that you want using keyboard shortcut . pretty much looks like vim with more features.
basically it is text based but not fully gui
so my question is how did they do this ? to make the text output persistent and process the data as being inputed non sequentially (non gui typically inputs data non sequentially)
One popular way to do this is to use ncurses and/or its parent, curses. (The n in ncurses is for "new", as in "new curses".)
I think you're looking for something like the curses library.
You mean like ncurses interfaces?

Find out which keyboard layout is used, using ruby

How can I find out, which keyboard layout the user of my ruby application is using?
My aim is to have a game, where you can move the player on a map. To go one step down and one step left you press "Y" on a german keyboard. On an American keyboard, you would press "Z". We optimized the game for windows and mac, so I would like a solution for both platforms (and we don't use any command/shift/control-keys).
For Windows, you probably have to use the Windows API GetKeyboardLayout(), unless Ruby provides a wrapper for that.
There are a lot of useful I18n resources for Windows on the MSDN web site.
It might be easier to simply allow them to configure it themselves as a preference if you don't have a good portable way of detecting it.
I think it'll be much easier and naturally to allow users to define keys themselves.
As Alexander recommended, let the user define the keys themselves.
But, if you really want to recognize the layout, you could always ask the user to press keys in certain positions, particular to some layouts.
"Press the second key to the left of the return key. If your return key is two rows high, press the lower one"
[presses รค]
"Looks like you have a scandinavian keyboard"
That, however, is a horrible cludge, and, in the game context, would recommend the custom keymapping method

Resources