Difference between revisions of "Documentation/How Tos/Edit Keyboard Configuration File"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Getting ALT-key in short cuts. Only for WinXp, need to be tested and extended for other OS.)
 
(Customize Keybord by Editing a Configuration File)
Line 1: Line 1:
 +
{{Documentation/NeedsRework}}
 +
 
== Customize Keybord by Editing a Configuration File ==
 
== Customize Keybord by Editing a Configuration File ==
  
Up to OOo3.0 it is not possible to define a short cut key which includes the ALT-key using the Customize dialog, {{Bug|4756}}. But you must edit the configuration file to get such a short cut. This is a description, how to do it. It has only been tested for WinXP.
+
Up to OOo3.0 it is not possible to define a shortcut key which includes the ALT-key using the Customize dialog, {{Bug|4756}}. But you must edit the configuration file to get such a shortcut. This is a description, how to do it. It has only been tested for WinXP.
  
 
You need an editor, which preserves Unix line ends and the coding "UTF-8", and which will not set a byte order mark. I have used "PSPAD" or "jEdit" on WinXP. On WinXP neither WordPad nor NotePad is suitable. OOo itself can export in UTF-8 and Unix line ends, but sets a byte order mark, so you cannot use OOo.
 
You need an editor, which preserves Unix line ends and the coding "UTF-8", and which will not set a byte order mark. I have used "PSPAD" or "jEdit" on WinXP. On WinXP neither WordPad nor NotePad is suitable. OOo itself can export in UTF-8 and Unix line ends, but sets a byte order mark, so you cannot use OOo.
Line 10: Line 12:
 
<pre><..>\user\config\soffice.cfg\global\accelerator\<language code>\current.xml</pre>
 
<pre><..>\user\config\soffice.cfg\global\accelerator\<language code>\current.xml</pre>
  
Older versions of OOo might not have this files by default. If they are missing, goto Tool | Customize | Keyboard and change something. Then the files will be generated.
+
Older versions of OOo might not have these files by default. If they are missing, go to Tool | Customize | Keyboard and change something. Then the files will be generated.
  
 
# Close OOo and close quickstarter.
 
# Close OOo and close quickstarter.
Line 56: Line 58:
 
The complete line for inserting the special character &delta; when pressing the keys AltGr (German) and D together is then
 
The complete line for inserting the special character &delta; when pressing the keys AltGr (German) and D together is then
 
<pre><accel:item accel:code="KEY_D" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertSymbol?Symbols:string=δ" /></pre>
 
<pre><accel:item accel:code="KEY_D" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertSymbol?Symbols:string=δ" /></pre>
 +
 +
{{PDL1}}

Revision as of 10:43, 17 November 2008

Template:Documentation/NeedsRework

Customize Keybord by Editing a Configuration File

Up to OOo3.0 it is not possible to define a shortcut key which includes the ALT-key using the Customize dialog, Issue 4756 . But you must edit the configuration file to get such a shortcut. This is a description, how to do it. It has only been tested for WinXP.

You need an editor, which preserves Unix line ends and the coding "UTF-8", and which will not set a byte order mark. I have used "PSPAD" or "jEdit" on WinXP. On WinXP neither WordPad nor NotePad is suitable. OOo itself can export in UTF-8 and Unix line ends, but sets a byte order mark, so you cannot use OOo.

On WinXP the keybord settings for the single modules are in the files

<..>\user\config\soffice.cfg\modules\<module name>\accelerator\<language code>\current.xml

and general keyboard settings are in the file

<..>\user\config\soffice.cfg\global\accelerator\<language code>\current.xml

Older versions of OOo might not have these files by default. If they are missing, go to Tool | Customize | Keyboard and change something. Then the files will be generated.

  1. Close OOo and close quickstarter.
  2. Make a copy of the file, you will work on.
  3. Open the file in an editor.
  4. Edit the file and save it.
  5. Start OOo.

If something is wrong, OOo will crash when you press a key. Do not try to restore the document and do not sent a crash report. But restore the original file with the copy you have made in step 2.

To learn more about this file, see "StarOffice 7 Administration Guide" chapter 4 [1], "StarOffice 8 Administration Guide" chapter 3 and appendix A [2], and "OpenOffice.org XML File Format 1.0 Technical Reference Manual", chapter 9.2 [3].

Let us have a deeper look at the file. You will see something like

<?xml version="1.0" encoding="UTF-8"?>
<accel:acceleratorlist xmlns:accel="http://openoffice.org/2001/accel" xmlns:xlink="http://www.w3.org/1999/xlink">
	<accel:item accel:code="KEY_Q" accel:mod1="true" xlink:href=".uno:Quit"/>
	<accel:item accel:code="KEY_N" accel:shift="true" accel:mod1="true" xlink:href=".uno:NewDoc"/>

You will notice that the lines have all the same structure.

accel:item
Each such line defines a single short cut key.
accel:code="KEY_Q"

You can use only keys which has got a name. I don't know where to find a actual list of all possible keys and which of them will work, dependent on keyboard, operating system and language. If you know something, please add the information.

Next the modifier keys are listed. You need only those, which are used, because the default value of the modifier keys is "false".

accel:mod1="true"
That is the CRTL-key.
accel:mod2="true"
That is the ALT-key.
accel:shift="true"
That is the SHIFT-key.

Instead of pressing the keys CRTL and ALT together, you can also press the key AltGr That's on a German keyboard. Would be nice, if someone corrects this for an English keyboard.

The last position describes what the shortcut should do, for example

xlink:href=".uno:Quit"
will close OOo.


Inside the quotes stands a Command URL. In older OOo versions the command URL could be build as
"slot:<number>"
but that way should not be used for newer versions, if a ".uno" form exists. Therefore always use
".uno:<command>"

You find those commands in the document [4] in the first column or in the above mentioned document "StarOFfice 8 Administration Guide".

Some of the commands need parameters. There seems to be no list of those parameters, but you can get a hint, if you record a macro and look, which parameters the dispatcher gets. For example the macro record of inserting a special character gives you the Command URL ".uno:InsertSymbol" and the parameter "Symbols" with for example the value "δ" (Greek delta). Or look at the existing lines in the configuration files. Perhaps you can alter a parameter?

Such parameters follow the command after a ?. For inserting the character "δ" the complete Command URL is ".uno:InsertSymbol?Symbols:string=δ".

Modifier keys and command URL may be exchanged.

The complete line for inserting the special character δ when pressing the keys AltGr (German) and D together is then

<accel:item accel:code="KEY_D" accel:mod1="true" accel:mod2="true" xlink:href=".uno:InsertSymbol?Symbols:string=δ" />
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools