I am on a Linux (fluxbox/Mint) with urxvt using an external Mac keyboard. I can't find an ins key. In urxvt you can select a part of text, it automatically copies, and with other types of keyboards I could use Shift+Insert and it pastes the text. How can I paste the text with a mac keyboard running in a Linux? Needless to say, that I tried the standard variations of Ctrl+C and Ctrl+V, Ctrl+0, Shift+0, in combination with fn key.
Try Fn+Shift+return.
This works as middle-click paste under both Gnome (Wayland) and i3wm (Xorg) in Fedora 28 with my 2016 MacBook Pro 13,1 built-in keyboard (using an out-of-tree SPI driver). Hopefully it's the same situation for external Mac keyboards under other specific environments.
Maybe you can try fn + return to simulate the Insert key.
Another way, install AutoKey :
apt-get install autokey-gtk
and set a phrase to:
Phrase Text: <ctrl>+C (actually type out the <ctrl>+ here)
Paste Using: Keyboard
Abbreviation: None
Hotkey: <super>+v
Window Filter: None
If you want to use your Apple keyboard like a regular US-layout keyboard, with Alt on the left side of Meta, you can use the AUR package un-apple-keyboard. Currently it only works for the aluminium USB model.
The package does the following things:
Adds a /etc/modprobe.d/hid_apple.conf file which enables the F num keys by default, as in #Function keys do not work.
Uses keyfuzz to remap F13-15 to PrintScreen/SysRq, Scroll Lock, and Pause, respectively.
Swaps the ordering of the Alt and Meta (Command) keys to match all other keyboards, again using /etc/modprobe.d/hid_apple.conf, as in #Swap the Alt key and Command key (Meta/Super).
Applies these changes automatically when you plug in your keyboard, with a udev rule.
See more information from Archlinux wiki Apple Keyboard.
Try Fn+Opt+Return. Works for me.
I want to use uinput to emulate pressing the menu key just next to the right Alt key. I tried KEY_MENU and KEY_CONTEXT_MENU, but neither of them worked. The key in Win32 API is VK_APPS.
KEY_COMPOSE is the correct Kernel keycode.
Some elaboration from Chromium’s keyboard event notes:
'Menu' and 'Props' naming differs between evdev and USB / UI Events. USB 0x010085 [System Main Menu] and USB 0x0C0040 [Menu Mode] both map to evdev 0x8B KEY_MENU (which has no corresponding UI Events |code|). USB 0x070076 [Keyboard Menu] does not map to KEY_MENU; it maps to evdev 0x82 KEY_PROPS, which is not the same as USB and UI Events "Props". USB 0x0700A3 [Props], which does correspond to UI Events "Props", is not mapped by the kernel. (And all of these are distinct from UI Events' "ContextMenu", which corresponds to USB 0x070065 [Keyboard Application] via evdev 0x7F KEY_COMPOSE, following Windows convention.)
On many older laptops and some compact keyboards there is an integrated numeric keypad in the main keyboard area. This alternate keypad is activated with a special 'Fn' key next to the left Ctrl key.
As a programmer I learned to use the cursor movement keys (arrows, PgUp, PgDn etc.) and found it greatly improved my programming speed. And the benefits were not bound to just a single application as is the case with specialised shortcut keys.
On conventional PC keyboards, the 'Windows Key' can be used to emulate the 'Fn' key and a corresponding integrated numeric keypad. When I used to use MS Windows I found Autohotkey was able to map the keys using a simple script.
Recently I learned about xkb and how it can be used to map keystrokes at a very low level.
What is the xkb keyboard mapping profile that will emulate an integrated numeric keypad using the windows key as the fn key?
Hint(?): I suspect the file will look a lot like the '/usr/share/X11/xkb/symbols/keypad' file on a Debian-derivative linux distro. This 'keypad' file is included at the top of the '/usr/share/X11/xkb/symbols/pc' file.
The corresponding autohotkey script for reference (# == WinKey):
#8::Up
#k::Down
#u::Left
#o::Right
#7::Home
#j::End
#9::PgUp
#l::PgDn
#m::Insert
#.::Delete
;(Scroll with the left-over keys)
#i::WheelUp
#,::WheelDown
Note that all these keys need to work with any combination of Ctrl, Alt, Shift as well as the Windows Key.
Steps to install numeric keypad-like cursor keys on the main keyboard in Linux / XKB...
xkbcomp $DISPLAY original.xkb (just in case ;)
xkbcomp $DISPLAY custom.xkb
Edit custom.xkb
Add the following at the end of section: xkb_types "..." {
type "WinKeyAsFnKey" {
modifiers = Shift+Super;
map[Shift] = level2;
map[Super] = level3;
map[Super+Shift] = level3;
level_name[Level1] = "Base";
level_name[Level2] = "Caps";
level_name[Level3] = "Fn";
};
Add the following at the end of section xkb_symbols "..." {
key <AE07> {type="WinKeyAsFnKey",symbols[Group1]=[7,ampersand,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<HOME>,clearmods=Super)]};
key <AE08> {type="WinKeyAsFnKey",symbols[Group1]=[8,asterisk,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<UP>,clearmods=Super)]};
key <AE09> {type="WinKeyAsFnKey",symbols[Group1]=[9,parenleft,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<PGUP>,clearmods=Super)]};
key <AD07> {type="WinKeyAsFnKey",symbols[Group1]=[u,U,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<LEFT>,clearmods=Super)]};
key <AD09> {type="WinKeyAsFnKey",symbols[Group1]=[o,O,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<RGHT>,clearmods=Super)]};
key <AC07> {type="WinKeyAsFnKey",symbols[Group1]=[j,J,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<END>,clearmods=Super)]};
key <AC08> {type="WinKeyAsFnKey",symbols[Group1]=[k,K,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<DOWN>,clearmods=Super)]};
key <AC09> {type="WinKeyAsFnKey",symbols[Group1]=[l,L,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<PGDN>,clearmods=Super)]};
key <AB07> {type="WinKeyAsFnKey",symbols[Group1]=[m,M,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<INS>,clearmods=Super)]};
key <AB09> {type="WinKeyAsFnKey",symbols[Group1]=[period,greater,NoSymbol],actions=[NoAction(),NoAction(),RedirectKey(key=<DELE>,clearmods=Super)]};
Save custom.xkb
xkbcomp custom.xkb $DISPLAY
I'm still working on the mouse scroll with 'i' and ','.
EDIT:
The above solution does not play nice with Google Chrome and Chrome-based apps (like Slack).
Alternative approach is to use a programmable keyboard. I use an after-market PCB for a CoolerMaster Masterkeys S keyboard. The Easy AVR layout is available online (although currently the left win-key now doesn't work by itself...I use the right one).
I have Linux (Backtrack5) running as guest operating system in IOS.
There seems to be some problems with certain keys, I can't type the # sign.. instead, it gives 2 (in superscript).
I have tried hex (%40) but it won't compile.
I have reinstalled it with another keyboard layouts but problem reproduces.
Is there a file where i can reconfigure certain keys?
I am afraid I may sound trivial, but maybe this is your case.It might be that the keymap your system loads by default does not match the one your physical keyboard actually has.
You can change the keyboard layout you're using with setxkbmap it Return typed in a console in your graphical environment (X11), be it under KDE, GNOME, or what you have. With that command you would use an Italian keyboard layout, it looks like the two-letter code for a Danish one is da.
If you're not working with a graphical environment you can set your keyboard layout with loadkeys it Return
I have a barcode scanner works as HID device. Everytime a barcode scans it goes directly to windows keyboard, for example if I open notepad I can see the barcode typed there.
As far as I know programmatically is it possible to to read HID data from your HID devices.
But what happens if the user is already on a form with a text edit control? The scanned code will go inside the text box.
Can you block incoming text and make a background-only processing?
Can you explain the theory please?
See if your barcode scanner can emulate a serial port and just read the data directly from the the serial port into your app.
That is cleaner and less expensive then a global keyboard hook. When I was looking into this awhile ago I found that most USB barcode scanners can emulate a serial port, it's a cinch to read serial port data in most programming languages. I happened to be doing mine in Java, I posted an example in answer to this question actually.
You can set up your scanner to use USB-HID(POS) setting. Your datasheet of barcode settings for the scanner device should have it. I use this project to test my scanners. http://www.codeproject.com/Articles/18099/A-USB-HID-Component-for-C
Sure, just capture keypresses before they are handled by the control and suppress normal handling of the events. In VB.NET you might override the OnKeyPress method in your form and set KeyPreview to true, for example.