Modifying keys on a Norwegian Linux keyboard to resemble those on a Mac

A friend of mine is switching between a Mac and a Linux machine, causing some readjustment whenever he switches keyboards. The most urgent fixes were to move the curly and square braces together with the backslash and dollar sign. Basically to map the keys as follows:

ALT + 8 = [
SHIFT + ALT + 8 = {
SHIFT + ALT + 7 = \
SHIFT + 4 = $

To set up these fixes, the first thing you need to do is to go to System Settings and Keyboard Layout (might be hidden under Region and Language) and select advanced options. Here you need to enable “Key to choose third level: Left Alt”.

The next is to run the following commands:

xmodmap -e "keycode 13 = 4 dollar 4 currency dollar onequarter"
xmodmap -e "keycode 16 = 7 slash 7 slash braceleft backslash"
xmodmap -e "keycode 17 = 8 parenleft 8 8 bracketleft braceleft"
xmodmap -e "keycode 18 = 9 parenright 8 8 bracketright braceright"

To store these settings permanently, create a file named .bashrc in your home folder and add them to this file.

Deploy Qt applications for Mac OS X

This turned out to be really simple. I was trying to create a Mac OS X version of my game, Nanoparticles, and was having trouble with some flicker when running a QGraphicsView with OpenGL. The solution turned out to simply be to disable some style sheet settings that I didn’t need.

After this I wanted to create a nice .dmg file for easy deployment on Mac OS X. Thankfully, this process is not hard either. I found this through the Qt Documentation, but it is actually simpler than it seems thanks to the macdeployqt tool. This is mentioned on the page, but I decided to give a more thorough walk through on how to use the tool here:

  1. Build your application
  2. In the build directory, run
    macdeployqt -dmg

    macdeployqt is found in the ~/Library/QtSDK/Desktop/Qt/474/gcc/bin folder (if that is where you installed Qt)

  3. You should now have a nice yourappname.dmg file in the build directory. Open this up and check that your application runs from there.
  4. If everything is working fine, you can do some prettifying of your .dmg file by opening it up using the Disk Utility and converting it to a Read/Write disk image.
  5. Open your Read/Write disk image and create a shortcut to your Applications folder. This could either be done by dragging the Applications folder while holding the command key or by creating a symbolic link in terminal:
    ln -s /Applications ./Applications
  6. Edit the icon size, background image, etc. by clicking Command + J to open the View Options. Also, use View -> Hide Toolbar and Hide Sidebar to hide the excessive toolbars from the disk image.
  7. Close the image and use Disk Utility to convert it back to a compressed disk image.
  8. Distribute your .dmg file.

If you need more details about the process and how deployment is performed, have a look in the Qt Docs.