How to create simple configuration file

Configuration file examples

You may find predefined configuration files in cfg-data directory. Firstly, take a look to the simple configuration file like kdialog.cfg. After investigation of some configuration files You'll became more familiar with its format.

How To

Specify parameters

In general it needs to specify only (for server mode):

Screen=true

or (for AT mode):

Device=/dev/rfcommXX

where /dev/rfcommXX is the device to connect. Other parameters can be used by default.

Specify keys to handle

A short example, which:

[Keys]
1=Exec(kdialog --msgbox "Hello!")
2=Set(title,"Hello!")
3=ExecAndSet(status,date +"%M:%S")
...

Exec() command is the mostly used one. It used to run specified command.
Set()/ExecAndSet() commands used to control look and behavour of java client, which is used in Server mode.

To make custom setup of java client main window upon connection:

(Connect)=Set(icons,TheTitle,\
    1,vol_down,2,mute,3,vol_up,4,rewind,9,next,\
    *,question,#,pause);\
    Set(status,Connected now);\
    Set(title,Hello!);

As You can see it is possible to execute more than one command at once.

At the end, another "almost" real Server mode example which contols Amarok player:

Screen=true

[Keys]  
% Run amarok when connected
(Connect)=Exec(amarok);

% Volume control
1=Exec(dcop amarok player volumeDown)   
2=Exec(dcop amarok player mute)   
3=Exec(dcop amarok player volumeUp)   

% Play, rewind back and forward
4=Exec(dcop amarok player seekRelative -10)   
5=Exec(dcop amarok player play);Set(title,Playing);  
6=Exec(dcop amarok player seekRelative 10)   

% Previous song, stop playback and next song
7=Exec(dcop amarok player prev);  
8=Exec(dcop amarok player stop);Set(title,Stopped);  
9=Exec(dcop amarok player next);

% Pause playback
0=Exec(dcop amarok player pause);Set(title,Paused);   
[End]

Lines starting with % are considered as a comment.