Monday, January 21, 2008

System Preferences and Theme

If you are not a command-line person to use defaults, there is a System Preferences to help you on some of the settings, but not all.


Some people complain that GNUstep color scheme is too dark. The root of problem is because most monitors are not properly calibrated. Color Scheme allows you to change the scheme as a whole or on individual color. There are three default color schemes to choose.


Date & Time is for time zone. Find your city and click on it. It is equivalent to

defaults write NSGlobalDomain NSTimeZone 'MyPlace'.


You can find the valid name for time zone in GNUstep/System/Library/Libraries/gnustep-base/Versions/1.15/Resources/NSTimeZones/zones. It is quite obvious that System Preferences is easier to use in this case.


Fonts is the same as what we mentioned in previous article about NSFont and others. A good thing of using System Preferences is that you don't need to guess the font name any more. It does not support NSPreferredFonts, but it is good enough.


Defaults list all possible settings for GNUstep. You can see the GSBackend as we introduced before. It is quite convenient to know what GNUstep supports and what are the valid values for these settings. User Defaults Summary also explains some of the settings and possible values.


Modifier Keys map your physical keyboard to modifier key, like Ctrl, Alt and Option. You should read Keyboard Setup to know what Control, Command and Alternative mean. Then how do you know your physical right "Shift" maps to Right Hyper, Right Super or any other choice ? You can start a program xev and try each of your modifier key. You should be able to see something like this:

KeyRelease event, serial 30, synthetic NO, window 0x3200001,
root 0x3f, subw 0x0, time 1896953680, (375,276), root:(380,325),
state 0x40, keycode 115 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False

This is what it prints when I release the left Apple command key. You can tell it is called Super_L in X window. Then it is what System Prerences calls Left Super. You can also use defaults directly. Super_L is the value to used. You can always use this command to see what is in the user defaults:

defaults read NSGlobalDomain

Other preferences are mostly used by GWorkspace, which will be talked about some time later.

It is possible to have different theme of GNUstep. The solution is to install a user bundle to override the default GNUstep drawing. User bundles will be loaded automatically in any GNUstep application. It is specified in user defaults NSAppKitUserBundles. One side effect of this approach is that the user bundle has to be in sync with GNUstep. And bugs in user bundles may affect all of your GNUstep applications. Camaelon is the first one to support theme on GNUstep. You can download it from Étoilé project:

svn co Camaelon

Once installed, it will be under your GNUstep/System/Library/Bundles/Camaelon.themeEngine.

Then add the full path of Camaelon bundle in user defaults:

defaults write NSGlobalDomain NSAppKitUserBundles '( "/usr/local/GNUstep/System/Library/Bundles/Camaelon.themeEngine" )'

Next time you start any GNUstep application, it may look like this:


And this is the default GNUstep theme:


GNUstep is still under development and Camaelon is not actively developed recently. So your milage may vary. Another theme engine is Narcissus. After installed, add its full path into user defaults:

defaults write NSGlobalDomain GSAppKitUserBundles '("/usr/local/GNUstep/Local/Library/Bundles/Narcissus.themeEngine")'

Note that Narcissus is installed in Local by default. And this is a screenshot of it:


Narcissus is written more recently and its source codes may be more cleaner than Camaelon, but it is still in early stage and is less tested. Camaelon starts as an experiment to support theme on GNUstep and some of these methods are incorporated in GNUstep later. With recent changes in GNUstep, it may need some updates. Again, any change in GNUstep may affect these theme engines. If your GNUstep application has weird behaviors, you can remove the theme in user defaults by

defaults delete NSGlobalDomain NSAppKitUserBundles

It will fall back to default GNUstep theme.

Previous articles in this series:

  • Gomoku and Localization in GNUstep
  • Font Manager and GNUstep Backend

  • No comments: