Apple’s X11 Keymap and virt-manager 31

Posted by peter on June 01, 2009

Apple’s default X11 key mapping causes trouble when using virt-manager on the local X server. For reasons unknown to me, Apple maps the option/alt key to Mode_switch, meaning that when virt-manager grabs the cursor, it’ll never let go, as there’s no way of sending Ctrl+Alt to it- apparently it works explicitly off of keysyms instead of mod maps. It’s been long enough since I’ve dealt with X11 configuration issues that I had to do a little hunting to figure things out, so I figured I’d throw my solution up here.

On the machine where you’ll be running your X server (your mac), stick this in ~/.Xmodmap

clear Mod1
keycode 66 = Alt_L
keycode 69 = Alt_R
add Mod1 = Alt_L
add Mod1 = Alt_R

This will make the control keys on your keyboard emit (I think) more sensible events, while keeping Mod1 in the same place. Finally, no more restarting X11 when you want to break free of virt-manager.

UPDATE: The above still works, but it turns out there’s a better way. XQuartz, the open source project that eventually gets rolled back upstream to Apple, has a setting in preferences to switch between Apple default behavior and what the .Xmodmap above will get you. It’s also got other improvements, such as working properly with Spaces. Use it instead.


Use this link to trackback from your own site.


Leave a response

  1. Tim Kersten Sun, 06 Sep 2009 04:52:16 UTC

    Judging by your post, you have virt-manager running on OS X. How did you get it running?

  2. peter Tue, 08 Sep 2009 20:30:18 UTC

    I did try this, but ran into enough trouble building the requisite libraries that I gave up on the idea for now (trouble building libvirt). I’m just using virt-manager via SSH and X11 forwarding. Hardly snappy, but works well enough on the links I’m dealing with.

  3. bbeausej Sun, 14 Mar 2010 12:33:08 UTC

    Oh man thanks so much for posting this!

    A quick fix to a super annoying issue!


  4. Libok Zhou Mon, 15 Mar 2010 18:52:25 UTC

    Hi, Peter.
    It works perfectly, Thank you so much:)

    Also, I’ve re-post this on my own blog:

  5. BigLee Wed, 13 Oct 2010 07:56:39 UTC

    Dude, this is great.
    I’ve been using expose’ to “trick” virt-manager into letting go of my cursor. It was a pretty lame workaround that didn’t always work, and this fix has set my cursor free.

    Thank you for posting this!

  6. peter Mon, 15 Nov 2010 14:32:29 UTC

    glad to hear i’m not the only one that needed to scratch this stupid itch.

  7. virt-manager keymaps on OS X « btm.geek Wed, 17 Nov 2010 19:12:32 UTC

    […] OS X has reasonable good built in support for X11. However, others have found that the keymap and meta keys are broken. While I got a kick out of “After some time I discovered that the number 8 is […]

  8. wryfi Thu, 14 Apr 2011 14:32:09 UTC

    ~/.Xmodmap seems to have no effect for me in 10.6.7 and X11 2.3.6.

    Without or without it, I continue to have problems releasing the cursor of virt-manager. When I run xev, the keycode returned for Alt_L is always 63 and Alt_R is always 71.

    I’ve even tried running each statement in xterm, e.g. using xmodmap -e, but still get the same old keycodes in xev (and virt-manager).

  9. peter Mon, 18 Apr 2011 13:10:34 UTC

    been meaning to update this for ages but never did. thankfully, due to XQuartz this .Xmodmap isn’t necessary anymore.

    I was able to get the .Xmodmap trick to work with stock X11, though- make sure you restart after updating it.

  10. […] Apple’s X11 Keymap and virt-manager, thanks Peter! […]

  11. refurbished server Mon, 02 Nov 2015 20:25:04 UTC

    Excellent website. Lots of useful information here.

    I am sending it to several buddies ans also sharing in delicious.
    And certainly, thanks in your effort!

  12. gc trim fast supplements Wed, 25 Nov 2015 16:31:24 UTC

    Fabulous, what a blog it is! This blog presents valuable information to us,
    keep it up.

    Feel free to visitt my blog – gc trim fast supplements

  13. tambang emas banyuwangi Sun, 29 Nov 2015 21:04:50 UTC

    Thanks on your marvelous posting! I actually enjoyed reading it, you
    may be a great author. I will make certain to bookmark your blog
    and may come back very soon. I want to encourage
    you continue your great posts, have a nice day!

  14. Vero Sun, 13 Dec 2015 18:32:34 UTC

    The new year starts at the evnineg after the equinox has been observed. That is always the 4th OF THE ENOCH WEEK and is the FIRST DAY OF THE ENOCH YEAR. You will need to ask the Messenger Uriel why the year is divided into 4 quarters of 30, 30, and 31 day months. Those are the laws of the Calendar as revealed to ENOCH. by Uriel. And yes the Enoch Year is only 364 days even though the solar year is 365.242 days. The extra day or two is put at the end of the year, and these days are not part of the Enoch year. The day of the week when the year starts is linked to the Feast of Firstfruits that is always on the 15th day of the Third month and is the first day of the week after the Feast of Weeks (even complete weeks).

  15. Elank Sun, 13 Dec 2015 20:32:31 UTC

    Have discoverd smoething interesting as for the dates for the 2015 calendar. Note this cluster of holidays and the Fathers called out times. First, Sabbath will be on the Roman Tuesday. April 2nd, on Thursday at about 7 p.m. is the last supper memorial, April 3rd in the evening is Passover, the night to be much remembered, April 4th is the Jewish Passover and Sunday the 5th is Easter! So april 2, 3, 4, and 5 are a real cluster! Now that year is mid point of the 7 years if the dates are correct and I counted properly. . .

  16. bolt and nuts parts Thu, 17 Dec 2015 03:07:09 UTC

    As one of the leading project management software applications, Microsoft Project is utilized by project teams
    with all types of background levels. Those
    that feel their legs are lacking may want to train legs twice a week- one day with a hamstring focus and the other day with a quadriceps
    focus. Then your staff can help them get more insight into what you provide.

  17. opportunity seekers Mon, 21 Dec 2015 14:58:03 UTC

    I’m not positive wherre ʏоu’ге ցetting уօur
    іnformation, hokwever great topic.

    Ӏ must spend a whgile learning mucfh more or ԝorking
    оut more. Ƭhanks fοr
    excellent іnformation ӏ used tⲟ Ьe ⅼooking fоr tҺіs information fоr my mission.

    Ӎʏ web page opportunity seekers

  18. Caryn Tue, 22 Dec 2015 03:04:11 UTC

    Hi there friends, how is the whole thing, and what you would like to say
    regarding this paragraph, in my view its really amazing designed for me.

  19. Shantell Sat, 26 Dec 2015 20:05:29 UTC

    Heya i’m for the first time here. I found this board and I in finding It really useful & it helped me out
    a lot. I’m hoping to offer one thing again and help others such as
    you aided me.

  20. artix hack Mon, 28 Dec 2015 14:00:16 UTC

    This article gives clear idea in support of the new visitors of blogging, that genuinely
    how to do blogging and site-building.

  21. Thu, 31 Dec 2015 10:56:06 UTC

    I don’t know whether it’s just me or if perhaps everybody else
    encountering problems with your blog. It seems like some of the
    written text in your content are running off the screen. Can someone else please comment
    and let me know if this is happening to them as well?

    This may be a issue with my browser because I’ve had this happen before.
    Appreciate it

  22. Eric Wed, 06 Jan 2016 14:57:25 UTC

    Hi everybody, here every person is sharing these kinds of
    know-how, thus it’s good to read this weblog, and I used to pay a visit this
    web site all the time.

  23. Thu, 14 Apr 2016 10:30:25 UTC

    It’s posts like this that make surfing so much pleasure

  24. car insurance Sun, 15 May 2016 20:25:39 UTC

    That’s really thinking at a high level

  25. auto insurance Fri, 20 May 2016 10:09:22 UTC

    I worked so much that I never knew about burn notice until last year yes very true but now I know I’m always on netflix catching up at work now oh God every wednesday nihgt I’m hooked on wwor tv 8 and 9oclock my aunt would ask me sandy did u watch (nice mouth) meaning his lips are (sweet) lol we from Guyana he is a great actor please do more with him hollywood please peace and love

  26. Lucienne Mon, 27 Jun 2016 10:05:15 UTC

    Howdy terrific blog! Does running a blog like this take a lot of work?
    I’ve absolutely no understanding of programming however I had
    been hoping to start my own blog in the near future.
    Anyhow, if you have any suggestions or techniques for new blog owners please share.

    I know this is off subject however I just wanted to ask.

  27. Sun, 10 Jul 2016 12:24:10 UTC

    Great question! Self-employment to me means:-Living life on my terms-Being able to fully express myself-Freedom-Have more time with friends and family-Being able to serve and share my gifts-Having complete control of how I want to live-To name a few ;)xoxoAlara

  28. Fri, 15 Jul 2016 06:27:16 UTC

    Wonderful website you have here but I was wondering if you knew of any discussion boards that cover the same topics discussed in this article? I’d really love to be a part of online community where I can get feed-back from other knowledgeable people that share the same interest. If you have any suggestions, please let me know. Kudos!

  29. http://www./ Thu, 21 Jul 2016 02:45:41 UTC

    Thank you for the well wishes, Marcia. I think for now I just have to be satisfied with writing a paragraph at a time. But I am making plans to do something else creative that doesn’t involve words, hoping to shake things loose.

  30. Sun, 16 Apr 2017 01:34:57 UTC

    Greetings frkm Los angeles! I’m ƅored to dеath at work soo I decіded
    to browse your website on my iphone during ⅼunch break.
    I enjy the info you pгovide here and can’t
    wait to take a look when I ցet home. I’m surpгised at how fast
    your blog loaded oоn my mobile .. I’m not even using WIFI, just 3G ..

    Anyhoա, great blog!

  31. Mon, 26 Jun 2017 02:36:04 UTC

    Gooɗ information. Lucky meе I discovered your site by ϲhance (stumbleupon).
    I’ve boo marked it for lаter!