Hooking softkeys on Windows? - keyboard

My laptop has a mysterious "AV Now" button on it, which would usually launch Samsung's "AVStation Now" application. I don't have this application installed, so I'd like to get this button to do something else.
So (and this question can be generalised to any keyboard with softbuttons on it), how would I go about writing a Windows program (C++ or C#) to:
Figure out what pressing this button does. Is it a custom USB HID device, or is it just an obscure key combination?
Install a global hook for this button, so that I could get it to do something useful.

I'd like to get this button to do something else.
If you don't insist on writing the program yourself, you can remap keys: These extra buttons are mostly just obscure key combinations, and in WinXP and above it is possible to remap just about any button on the keyboard to any other by modifying a registry setting at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
There exists a frontend utility to do this for you: check out SharpKeys. You select the key to remap from, key to remap to, write to registry and reboot. (Writing the keymap into the registry requires administrative privileges, as the keyboard mapping is global for all users.)

Related

Simulating Physical Keypress

So I have a keyboard, and it has a mode where it lights up every key you press.
I was wondering if you could physically simulate a keypress, AHK just sends it directly to the system.
However I need a way to make the keyboard light up, because AHK doesn't do that. The keyboard is not programmable.
Solutions in mostly any language are welcome.
This is not possible, you want to send a simulate keypress to your fysical keyboard. (this is i think a mechanical switch insite the keyboard self, that does do light up if you press a key) and it is only possible if the company did make a keyboard driver that allows you to change the settings (disable - light up) in the Windows Registry. (you did not give me the name of your keyboard but you can then try to searching into the registry for example software/Logitech/settings)

How to change the functionality of a button so that it can work as the backspace button

Okay, so I have a Compaq laptop [American keyboard].
It is a few days that the backspace button is broken - I mean, it is totally popped off. It ought to be replaced but it is hard to find it out.
Now, I was wondering whether or not there was a way to change the functionality of another button so that it can replace the functionality of the backspace button.
It is not the DEL button. It is the BACKSPACE button [above the Enter button].
I knew that through some binary numbers it is possible to change the functionality of a button. For example, I can change the DEL button in the Number Lock so that instead of working as DEL button or dot, it will work as backspace.
Is it possible?
Another way on Ankit's recommendation:
After installing the AutoHotkey, creating the short script and saving it with .ahk extension, just put the file in the startup folder :) click Start(or windows logo)---All Program---startup folder :) then re-start pc.
If on windows, you may use AutoHotkey, install it, create a file with .ahk extension and put following code in it.
F1::Send {BackSpace} ; Makes the 'F1' key send 'BackSpace' key.
Then run the above script on startup.
More Details for remapping here.

Can I assign custom keyboard shortcuts for menu items in applications on Ubuntu?

OSX allows user to add custom keyboard shortcuts for menu items. For instance you can define a custom keyboard shortcut for "Copy" and it will work for every application that has a menu item called Copy.
Is there a way to do this for GTK and/or KDE applications?
For KDE applications, it is possible for common keyboard shortcuts. To do this, open systemsettings and navigate to Standard Keyboard Shortcuts.
For example, here I change the shortcut for "activate next tab" to Ctrl-Tab (for consistency with Firefox):
This changes the shortcut in most tabbed KDE applications as well as tabbed dialog boxes. You can specify up to 2 alternative shortcuts for each action.
However, this only works for common shortcuts; you can't globally specify shortcuts for arbitrary menu-item captions.
I don't think GNOME applications have any such feature. You have to change the shortcuts individually (for each application). (Generally KDE is more customizable.)
Is there a way to set an absolute keyboard shortcut for an arbitrary menu item name that will be honored by any GTK+ application?
No.
Can you set a different global shortcut for Cut/Copy/Paste?
I suspect so. I didn't do the reading, but here's two promising links: making keyboard shortcuts in linux as uniform as the mac and change default/preference keyboard shortcuts like copy & paste
You can of course modify GTK+ applications to tweak their shortcuts. In the case of a GTK+ application whose GUI was designed with Glade, e.g. virt-manager, this could be ridiculously trivial.
I suggest you to take a look at xbindkeys and xdotool. Those are the automation tools which can help you to simulate certain keystrokes with customized shortcut.
By this means, though you don't really modify the original shortcuts, but you can still make your desired key combinations functional.

Shortcut with meta-shift key doesn't work in emacs

I can't use any shortcut that has meta-shift (alt and shift) in it because ubuntu will treat it as "change keyboard layout" shortcut (I map it to alt-shift since I use the same shortcut in windows) as soon as I press m-s. In windows change keyboard layout shortcut doesn't register until you release the key so any shortcut with m-s is usable in windows.
Is there any work-around without changing shortcut or meta key ? I kinda used to it.
Change the Ubuntu change-keyboard-layout shortcut, to something else.
Or use Esc as Meta
Nothing easy that I know of.
You can manually bind everything that's M-S-??? to C-M-S-??? in your .emacs or at least all of the ones that you use...
Or you can just change the short-cut... how often do you change the keyboard layout? (I use dvorak, and qwerty, but I've never needed a shortcut for it, I just use the button...)
I have tried different things, and in my opinion it is best to change the layout shortcut to something else. The power of emacs is all in its shortcuts that are available right there under your fingers. If you move the M key away and make it harder to reach, it will most surely have a negative impact on your editing speed.
Right now I'm trying to get used to switching layouts with the right Alt key. I almost never use it for anything, so missing it won't be a problem. And from my experience teaching yourself to switch layouts with another combination is a matter of several days.
P.S. Also it pays to use Caps-Lock as an additional Ctrl key, it helps tremendously!

Mapping my custom keys in Debian

I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search" , "Web/Home" etc.
It would be nice to be able to bind these keys so they execute arbitrary programs.
Does anybody know how to do this in Debian Etch?
I can't say for certain because I'm not using Debian but if you're using Gnome the easiest way is to run gnome-keybinding-properties (System > Preferences > Keyboard Shortcuts)
Instead of typing a shortcut such as Ctrl+M, hit the button on your keyboard.
If you would prefer to do this via command line or with a different desktop environment, this may help: Unusual keys and keyboards
Running Debian, I had the same issue. What I did is run xev and see what keycode those keys return. Microsoft likes to break standards a little, so some of the multimedia keys just won't work. But the ones that do will return a keycode. Then write a script with xmodmap to map those keys properly.
The Gentoo Wiki has excellent documentation on how to do these things.
I put my xmodmap script in ~/.kde/Autostart/ because I use kde, but you could just as easily put it in your home folder and have your .bashrc or .profile source it.
Once you've mapped the keycodes, you can assign those keys to specific actions in your desktop environment.
I used Gizmo Daemon for my PowerMate under Debian - it supports fancy keyboard keys as well (although I haven't tried it for those keys). Hacking on gizmod to get it to do what I wanted was pretty easy.
Gizmo Daemon
There's a few different ways to do so, the easiest generally being keytouch, which is probably available in the Debian repositories. The user manual is here. There is a chance that your keyboard won't work with it though.
If you want to do it manualy you can edit ~/.xmodmap
and use xmodmap ~/.xmodmap to apply the modifications

Resources