So X will translate keycodes from the keyboard press/release events that contain keysyms + modifiers + more (look up X keypress event) that get sent to your terminal emulator. Your terminal emulator will translate those into ascii chars or sequences in order to send them to your editor. (Note that, without translating some of these X keyboard events into escape sequences, you can't express the full range of possible keys and chords in ASCII.)
You can define custom translations keysym for some terminal emulators. I've done this in urxvt in order to free up C-j and C-S-[letter] combinations for my own use.
urxvt will allow you to translate the Shift_L keycode into "(" or "()" or "i_love_hacker_news_<3". And it still does it's job as a modifier too. The only problem is that "i_love_hacker_news<3" will be output as soon as the press event is received, so you'll output "(" even when you press shift as part of a chord.
You can write perl scripts in urxvt that can capture X keyboard events, and maybe your script could only output "(" if it detects that no intermediate X event was detected between the press and the release of "(".
I'm not totally sure that you get THAT much info from urxvt, but it's the best approach that I know of. As an alternative, maybe you could write a program to intercept X events before they reach the terminal (and/or any other program).
That's about as far as I care to go right now.
Let me know if you get something working, I'd be interested in using it too.
You can define custom translations keysym for some terminal emulators. I've done this in urxvt in order to free up C-j and C-S-[letter] combinations for my own use.
urxvt will allow you to translate the Shift_L keycode into "(" or "()" or "i_love_hacker_news_<3". And it still does it's job as a modifier too. The only problem is that "i_love_hacker_news<3" will be output as soon as the press event is received, so you'll output "(" even when you press shift as part of a chord.
You can write perl scripts in urxvt that can capture X keyboard events, and maybe your script could only output "(" if it detects that no intermediate X event was detected between the press and the release of "(".
I'm not totally sure that you get THAT much info from urxvt, but it's the best approach that I know of. As an alternative, maybe you could write a program to intercept X events before they reach the terminal (and/or any other program).
That's about as far as I care to go right now.
Let me know if you get something working, I'd be interested in using it too.