Home > keyboard > Keyboard shortcut using 'Mac Driver' in WINE

Keyboard shortcut using 'Mac Driver' in WINE

November 4Hits:1
Advertisement

I would like to map the Command key to the Control key but, have it affective only while running a WINE application using the new 'Mac Driver', not X11. I tried a registry edit but, I don't know what I'm doing and google hasn't been very helpful.

No third party software! I don't want to hear about anything like KeyRemap4MacBook.

Answers

I was looking to solve the same issue in order to use the same hotkeys inside Wine as for regular OS X applications. No information on that is available from what I can tell so the easiest solution turned out finding the source code of winemac.drv. The important function is macdrv_compute_keyboard_layout() which does lots of various computations but for the modifier keys it all essentially boils down to taking values from default_map (all modifier keys are marked as "fixed"). Unfortunately, as of Wine 1.7.10 there is no configurability here so the map values have to be changed by modifying the compiled file.

For me the compiled file was located under /Applications/Wine.app/Contents/Resources/lib/wine/winemac.drv.so. It's generally a good idea to create a copy of the original file before changing it. You need a hex editor to open it. First let's have a look at the following two lines:

{ VK_RMENU,                 0x38 | 0x100,   TRUE },     /* kVK_RightCommand */
{ VK_LMENU,                 0x38,           TRUE },     /* kVK_Command */

According to the virtual key table VK_RMENU has the value 0xA5 and VK_LMENU the value 0xA4. In other words, the binary representation of these two lines looks like this:

A5 00 38 01 01 00 00 00
A4 00 38 00 01 00 00 00

I found this byte sequence at the offset 0x62770, for your Wine build things might be slightly different. We want to map the Command key to VK_LCONTROL and VK_RCONTROL meaning that these two entries have to be changed into:

A3 00 1d 01 01 00 00 00
A2 00 1d 00 01 00 00 00

Now I would also like to map the Option key to Alt because I need a working Alt key. By default both Option keys are unmapped, meaning that they are represented by a sequence of eight zeroes in the table and need to be found by position. The left Option key is the third entry after left Command, the right Option key is the sixth entry after left Command (for me offset 0x62790 and 0x627A8 respectively). The first entry can be changed into:

A4 00 38 00 01 00 00 00

And the second into:

A5 00 38 01 01 00 00 00

Yes, these are the values originally assigned to the Command key. I actually only changed the entry for the left Option key, this way the right Option key can still be used to produce special characters.

This isn't a great solution, more of a hack that will have to be repeated each time Wine is updated. Also, remapping the Option key only works for keyboard shortcuts like Alt-F4 but not for Alt-F. Still, it does the job for now and in future Wine developers will hopefully add some configuration here. I filed the corresponding change request as bug 35351.

Wladimir's answer (and other help he provided on his own site) made it easy to put together a modified copy of the source code, so that the Mac driver maps the Alt key to the Option key and the Win key to the Cmd key, plus a patched copy of the winemac.drv.so file. Details here:

http://www.columbia.edu/~em36/winekeymap.html

All credit goes to Wladimir. I just put together the information he supplied.

Tags:keyboard, wine

Related Articles

  • Keyboard shortcut using 'Mac Driver' in WINENovember 4

    I would like to map the Command key to the Control key but, have it affective only while running a WINE application using the new 'Mac Driver', not X11. I tried a registry edit but, I don't know what I'm doing and google hasn't been very helpful. No

  • How do I open a file with a keyboard shortcut on Mac?August 8

    I'd like to be able to open a file with a simple keyboard shortcut. It's always going to be the same file. I want to do this because I have an encrypted disk image that I'd like to mount quickly and easily. So if I'm in Chrome and I want to download

  • Search Help Keyboard Shortcut on Mac Illustrator CS6October 20

    The standard mac shortcut (Command+?) for opening the menu item search field doesn't work. As Beibei mentioned - This is about cueing the cursor to the "Search" box of the help menu, not invoking the Adobe help system. --------------Solutions---

  • Keyboard shortcuts of intel driver are not workingJune 28

    Keyboard shortcuts of the Intel Graphics Driver are not working - NONE! In the dialog where you can define them by directly typing them, they are recognized properly. And of course the option is set to "active". Anyone has an idea what could be

  • Add Keyboard Shortcut to MacDecember 19

    Is there a way I can make a keyboard shortcut for this? TAB, TAB, DOWN ARROW KEY, TYPE "S", RETURN, RETURN Is there a way I can bind this to a keyboard shortcut, i.e. CMD + ALT + G? Any help is appreciated. Thanks in advance! --------------Solut

  • How can I assign different characters to different keyboard shortcuts on Mac?November 24

    I am using Macbook Air with OS 10.8.2. I bought my MAC from the US, and then moved to another country. Therefore, I had to change my keyboard language. The problem is the keyboard layout is not the same. For instance when I type: Shift + 9 it is supp

  • Can I add a new keyboard shortcut in mac with tab key in it?

    Can I add a new keyboard shortcut in mac with tab key in it?October 26

    I'm using a software called Notational Velocity for taking notes on my mac. It's great, there's just one shortcut thing I'd like to fix: the software indents with tab key like any other text editor, but when I want to "unindent" (move text to th

  • Creating custom keyboard shortcuts in Mac OSX and repeating actionsOctober 15

    Most native apps have the following: Ctrl + n = up arrow Ctrl + b = left arrow Ctrl + p = up arrow Ctrl + f = right arrow I've been dying for a solution to make this global. Recently I discovered BetterTouchTools, which allowed me to map this globall

  • Microsoft Excel Mac, keyboard shortcut to edit in cellSeptember 9

    In Microsoft Excel for Mac 2011 (14.0.0) how can I modify the enter/return key to edit in cell instead of moving the selection down? I know that in Preferences > Edit you can uncheck the box that says "After pressing RETURN, move selection [Down/R

  • Set keyboard shortcut as double tap of modifier key on Mac?August 25

    I was wondering if i could set a keyboard shortcut on Mac as a double tap of a modifier key. For example, the default shortcut of start dictation command is a double tap of the Fn (Function) key. Can I set another command to have this shortcut? Thank

  • How to customize Google Chrome keyboard shortcuts?November 1

    I would like to customize keyboard shortcuts in Google Chrome. For example, I would like to map the keys combination Ctrl+Shift+W to the command "Close Other Tabs", instead of right-clicking on a tab (default command). Is there any setting in Ch

  • Set Services keyboard shortcut via script OSX

    Set Services keyboard shortcut via script OSXDecember 29

    I need a way to set the following programmatically: Specifically for shortcuts under Services, if that makes a difference. I'm wondering if this is possible via shell or AppleScript? EDIT: I've seen Programmatically add keyboard shortcut to Mac Syste

  • Disable trackpad handwriting keyboard shortcut without disabling Chinese keyboard input?November 3

    In the Keyboard Shortcuts preference pane, this is the one shortcut that can't be disabled. It's disabled if you turn off Chinese keyboard input, but I want to keep the keyboard input. I got hopeful when I found this technique for editing the symboli

  • How to send Keyboard Shortcuts to browser using Selenium and NodejsMarch 26

    I am trying to create a test script in Node.JS using selenium webdriver and in case I need to send keyboard shortcuts to the driver. I tried finding the //body element and sending them but only ctrl+a works there. Is there any alternative to that? I

  • Global keyboard shortcut to eject external hard drive on Mac OSX Yosemite?February 3

    I tried the Automator approach as described in Global keyboard shortcut to eject external hard drive on Mac OSX Lion? - but on 10.10. this gives me no result. In Finder, there's only an error sound, and in any other app, nothing happens at all. As fa

  • Global keyboard shortcut to eject external hard drive on Mac OSX Lion?

    Global keyboard shortcut to eject external hard drive on Mac OSX Lion?March 27

    Is there a global keyboard shortcut to eject an external hard drive? If not, can I install one? --------------Solutions------------- There is a shortcut in Finder. Select the drive in Finder and press ⌘E, which is the shortcut for File » Eject. This

  • Strange keyboard shortcut icons in Mac OS 10.6.7

    Strange keyboard shortcut icons in Mac OS 10.6.7April 12

    Running on Mac OS 10.6.7. Don't know of any changes that could of happened to make the keyboard shortcuts different. Tried Googling and found nothing helpful. Anyone know why this happens and how to fix it? --------------Solutions------------- Those

  • Win+Space keyboard shortcut doesn't work for me in Windows 7. Why?

    Win+Space keyboard shortcut doesn't work for me in Windows 7. Why?March 14

    I have read several Windows 7 keyboard shortcut blog posts and guides and several of them mention that Win+Space should make all windows transparent revealing the desktop. I'm running Windows 7 and this keyboard shortcut doesn't work for me. Is there

  • How can I change the keyboard shortcut for switching tabs in Mac Terminal?

    How can I change the keyboard shortcut for switching tabs in Mac Terminal?March 12

    I know that you can switch tabs with shift cmd [arrow key] in Mac Terminal, but it is painful to reach the arrow key. How can I change the default keybinding? --------------Solutions------------- You can change key bindings for almost all Cocoa apps

  • Unable to make system-wide keyboard shortcut for X11's full-screen in MacMay 27

    The keyboard shortcut for X11's full-screen mode is Option-Command A However, it works only if I click the X11 icon and then press the combination. How can you make a system-wide keyboard combination for the command on Mac OS X? --------------Solutio

Copyright (C) 2018 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.574 s.