summaryrefslogtreecommitdiffstats
path: root/desktop-entry/desktop-entry-spec.xml
blob: 4bbbcb352334905ef4a07fe4df3735b1a35d1f1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
                  "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
				  ]>
<article id="index">
  <artheader>
    <title>Desktop Entry Standard</title>
    <releaseinfo>Version 0.9.4</releaseinfo>
	<date>7 July 2003</date>
    <authorgroup>
      <author>
	<firstname>Preston</firstname>
	<surname>Brown</surname>
	<affiliation>
	  <address>
	    <email>pbrown@kde.org</email>
	  </address>
	</affiliation>
      </author>
      <author>
	<firstname>Jonathan</firstname>
	<surname>Blandford</surname>
	<affiliation>
	  <address>
	    <email>jrb@redhat.com</email>
	  </address>
	</affiliation>
      </author>
      <author>
	<firstname>Owen</firstname>
	<surname>Taylor</surname>
	<affiliation>
	  <address>
	    <email>otaylor@gtk.org</email>
	  </address>
	</affiliation>
      </author>
    </authorgroup>
  </artheader>

  <sect1 id="introduction">
    <title>Introduction</title>
    <para>
      Both the KDE and GNOME desktop environments have adopted a similar
      format for "desktop entries," or configuration files describing how a
      particular program is to be launched, how it appears in menus, etc.
      It is to the larger community's benefit that a unified standard be
      agreed upon by all parties such that interoperation between the two
      environments, and indeed any additional environments that implement
      the specification, becomes simpler.
    </para>
  </sect1>
  <sect1 id="basic-format">
    <title>Basic format of the file</title>
    <para>
      These desktop entry files should have the extension ".desktop".
      Determining file type on basis of extension
      makes determining the file type very easy and quick.  When no file
      extension is present, the desktop system should fall back to
      recognition via "magic detection."  Desktop entries which describe how
      a directory is to be formatted/displayed should be simply called
      ".directory".
    </para>
    <para>
      The basic format of the desktop entry file requires that there be a
      "group" header named "[Desktop Entry]".
      This "group" entry denotes that all {key,value} pairs following it
      belong in the Desktop Entry group.  There may be other groups present
      in the file (see MIME types discussion below), but this is the most
      important group which explicitly needs to be supported.  This group
      should also be used as the "magic key" for automatic mime type
      detection.  There should be nothing proceeding this group in the
      desktop entry file but possibly one or more comments (see
      below).
    </para>
    <para>
      Group headers may not contain the characters '[' and ']' as
      those delimit the header.
    </para>
    <para>
      Lines beginning with a "#" and blank lines are considered comments and will be
      ignored, however they should be preserved across reads / writes of the
      desktop entry file.
    </para>
    <para>
      Compliant implementations MUST not remove any fields from the file,
      even if they don't support them.  Such fields must be maintained in a
      list somewhere, and if the file is "rewritten," they will be included.
      This ensures that any desktop-specific extensions will be preserved
      even if another system accesses and changes the file.
    </para>
    <para>
      Entries in the file are {key,value} pairs in the format:
    </para>
    <programlisting>
Name=Value</programlisting>
    <para>
      Space before and after the equals sign should be ignored; the "="
      sign is the actual delimiter.
    </para>
    <para>
      The escape sequences \s, \n, \t, \r, and \\ are supported,
      meaning ASCII space, newline, tab, carriage return, and
      backslash, respectively.
    </para>
  </sect1>
  <sect1 id="value-types">
    <title>Possible value types</title>
    <para>
      The value types recognized are string, localestring, regexp,
      boolean (encoded as the string true/false), and numeric.
    </para>
    <para>
      The difference between string and localestring is that the value for
      a string key must contain only ASCII characters and while the value
      of a localestring key may contain UTF-8 characters. (See section 5.)
    </para>
    <para>
      Some keys can have multiple values; these should be separated by a
      semicolon.  Those keys which have several values should have a
      semicolon as the trailing character. For lists of strings, 
      semicolons are simply not allowed in the strings, there is no 
      escape mechanism.
    </para>
  </sect1>
  <sect1 id="recognized-keys">
    <title>Recognized desktop entry keys</title>
    <para>
	  Keys  with type localestring may be postfixed by [<replaceable>LOCALE</replaceable>],
	  where <replaceable>LOCALE</replaceable> is the locale type of the
	  entry.  <replaceable>LOCALE</replaceable> must be of the form
	  lang[_COUNTRY][ ENCODING][ MODIFIER], where _COUNTRY, .ENCODING,
	  and @MODIFIER may be omitted. If a postfixed key occurs, the same
	  key must be also present without the postfix.
    </para>
    <para>
      When reading in the desktop entry file, the value of the key is
      selected by matching the current POSIX locale for the LC_MESSAGES
	  category against the <replaceable>locale</replaceable> postfixes
	  of all occurrences of the key, with the .ENCODING part stripped.
	  The .ENCODING field is used only when the Encoding key for the
	  desktop entry file is Legacy-Mixed, (see <xref
	  linkend="legacy-mixed"/>.)
    </para>
    <para>
	  The matching of is done as follows.  If LC_MESSAGES is of the form
	  <replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable>.<replaceable>ENCODING</replaceable>@<replaceable>MODIFIER</replaceable>,
	  then it will match a key of the form
	  <replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable>@<replaceable>MODIFIER</replaceable>.
	  If such a key does not exist, it will attempt to match
	  <replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable>
	  followed by
	  <replaceable>LANG</replaceable>@<replaceable>MODIFIER</replaceable>.
	  Then, a match against <replaceable>LANG</replaceable> by itself
	  will be attempted.  Finally, if no matching key is found the
	  required key without a locale specified is used.  The encoding
	  from the LC_MESSAGES value is ignored when matching.
    </para>
    <para>
      If LC_MESSAGES does not have a <replaceable>MODIFIER</replaceable>
      field, then no key with a modifier will be matched.  Similarly, if
      LC_MESSAGES does not have a <replaceable>COUNTRY</replaceable>
      field, then no key with a country specified will be matched.  If
      LC_MESSAGES just has a <replaceable>LANG</replaceable> field, then
      it will do a straight match to a key with a similar value.  The
      following table lists possible matches of various LC_MESSAGES in
      the order in which they are matched.  Note that the
      <replaceable>ENCODING</replaceable> field isn't shown.
    </para>
    <table>
      <title>Locale Matching</title>
      <tgroup cols="2">
<thead>
  <row>
    <entry>LC_MESSAGES Value</entry>
    <entry>Possible Keys in Order of Matching</entry>
  </row>
</thead>
<tbody>
  <row>
    <entry><replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable>@<replaceable>MODIFIER</replaceable></entry>
    <entry>
      <replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable>@<replaceable>MODIFIER</replaceable>,
      <replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable>,
      <replaceable>LANG</replaceable>@<replaceable>MODIFIER</replaceable>,
      <replaceable>LANG</replaceable>,
      Default Value
    </entry>
  </row>
  <row>
    <entry><replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable></entry>
    <entry>
      <replaceable>LANG</replaceable>_<replaceable>COUNTRY</replaceable>,
      <replaceable>LANG</replaceable>,
      Default Value
    </entry>
  </row>
  <row>
    <entry><replaceable>LANG</replaceable>@<replaceable>MODIFIER</replaceable></entry>
    <entry>
      <replaceable>LANG</replaceable>@<replaceable>MODIFIER</replaceable>,
      <replaceable>LANG</replaceable>,
      Default Value
    </entry>
  </row>
  <row>
    <entry><replaceable>LANG</replaceable></entry>
    <entry>
      <replaceable>LANG</replaceable>,
      Default Value
    </entry>
  </row>
</tbody>
      </tgroup>
    </table>
    
    <para>
      For example, if the current value of the LC_MESSAGES category
      is sr_YU Latn and the desktop file includes:
    </para>
    <programlisting>
 Name=Foo
 Name[sr_YU]=...
 Name[sr Latn]=   
 Name[sr]=...</programlisting>
    <para>
      then the value of the Name keyed by "sr_YU" is used.
    </para>
    <para>
      Case is significant.  The keys "Name" and "NAME" are not equivalent.
      The same holds for group names.  Key values are case sensitive as
      well.
    </para>
    <para>
      Keys are either OPTIONAL or REQUIRED.  If a key is optional it may or
      may not be present in the file.  However, if it isn't, the
      implementation of the standard should not blow up, it must provide
      some sane defaults.  Additionally, keys either MUST or MAY be
      supported by a particular implementation.
    </para>
    <para>
      Some keys only make sense in the context when another particular key
      is also present.
    </para>
    <para>
      Some example keys: Name[C], Comment[it].
    </para>
    <table>
      <title>Standard Keys</title>
      <tgroup cols="5">
	<thead>
	  <row>
	    <entry>Key</entry>
	    <entry>Description</entry>
	    <entry>Value Type</entry>
	    <entry>REQ?</entry>
	    <entry>MUST?</entry>
		<entry>Type</entry>
	  </row>
	</thead>
	<tbody>
	  <row>
	    <entry>Type</entry>
	    <entry>
		  There are 4 types of desktop entries: Application(1), Link(2), FSDevice(3) and Directory(4).
	    </entry>
	    <entry>string</entry>
	    <entry>YES</entry>
	    <entry>YES</entry>
	  </row>
	  <row>
	    <entry>Version</entry>
	    <entry>
	      Version of Desktop Entry Specification
		  (While the version field is not required to be present, it should be in all newer implementations of the Desktop Entry specification. If the version number is not present, a "pre-standard" desktop entry file is to be assumed).
	    </entry>
	    <entry>numeric</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>Encoding</entry>
	    <entry>
	      Encoding of the whole desktop entry file (UTF-8 or LegacyMixed).
	    </entry>
	    <entry>string</entry>
	    <entry>YES</entry>
	    <entry>YES</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>Name</entry>
	    <entry>
          Specific name of the application, for example "Mozilla".
	    </entry>
	    <entry>localestring</entry>
	    <entry>YES</entry>
	    <entry>YES</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>GenericName</entry>
	    <entry>
          Generic name of the application, for example "Web Browser".
	    </entry>
	    <entry>localestring</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>NoDisplay</entry>
	    <entry>
		  NoDisplay means "this application exists, but don't display it in the menus".
		  This can be useful to e.g. associate this application with mimetypes, so that
		  it gets launched from a file manager (or other apps), without having a menu
		  entry for it (there are tons of good reasons for this, including e.g. the
		  netscape -remote, or kfmclient openURL kind of stuff).
	    </entry>
	    <entry>boolean</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>Comment</entry>
	    <entry>
           Tooltip for the entry, for example "View sites on the
           Internet"; should not be redundant with Name or 
           GenericName.
	    </entry>
	    <entry>localestring</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>Icon</entry>
	    <entry>
          Icon to display in file manager, menus, etc.  If the
          name is an absolute path, the given file will be
          used. If the name is not an absolute path, an
          implementation-dependent search algorithm will be used
          to locate the icon. Icons may be localized with the
          Icon[xx]= syntax.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>Hidden</entry>
	    <entry>
		  Hidden should have been called Deleted. It means the user deleted (at his level)
		  something that was present (at an upper level, e.g. in the system dirs). It's
		  strictly equivalent to the .desktop file not existing at all, as far as that user is
		  concerned. This can also be used to "uninstall" existing files (e.g. due to a renaming)
		  - by letting "make install" install a file with Hidden=true in it.
	    </entry>
	    <entry>boolean</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>FilePattern</entry>
	    <entry>
		  A list of regular expressions to match against for a
          file manager to determine if this entry's icon should be
          displayed. Usually simply the name of the main
          executable and friends.
	    </entry>
	    <entry>regexp(s)</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>TryExec</entry>
	    <entry>
          Filename of a binary on disk used to determine if the
          program is actually installed.  If not, entry may not
          show in menus, etc.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>Exec</entry>
	    <entry>
           Program to execute, possibly with arguments.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>Path</entry>
	    <entry>
           If entry is type Application, the working directory to run the program in.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>Terminal</entry>
	    <entry>
           Whether the program runs in a terminal window
	    </entry>
	    <entry>boolean</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>SwallowTitle</entry>
	    <entry>
           If entry is swallowed onto the panel, this should be the title of window
	    </entry>
	    <entry>localestring</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>SwallowExec</entry>
	    <entry>
           Program to exec if swallowed app is clicked.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>Actions</entry>
	    <entry>
           Additional actions possible, see MIME type discussion in <xref linkend="mime-types"/>.
	    </entry>
	    <entry>string(s)</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>MimeType</entry>
	    <entry>
           The MIME type(s) supported by this entry.
	    </entry>
	    <entry>regexp(s)</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>SortOrder</entry>
	    <entry>
           This may specify the order in which to display files.
	    </entry>
	    <entry>string(s)</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>4</entry>
	  </row>
	  <row>
	    <entry>Dev</entry>
	    <entry>
           The device to mount.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>3</entry>
	  </row>
	  <row>
	    <entry>FSType</entry>
	    <entry>
           The type of filesystem to try to mount.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>3</entry>
	  </row>
	  <row>
	    <entry>MountPoint</entry>
	    <entry>
           The mount point of the device in question.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>3</entry>
	  </row>
	  <row>
	    <entry>ReadOnly</entry>
	    <entry>
           Specifies whether or not the device is read-only.
	    </entry>
	    <entry>boolean</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>3</entry>
	  </row>
	  <row>
	    <entry>UnmountIcon</entry>
	    <entry>
           Icon to display when device is not mounted Mounted devices display icon from Icon key.
		   UnmountIcons may be localized with the UnmountIcon[xx]= syntax.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>3</entry>
	  </row>
	  <row>
	    <entry>URL</entry>
	    <entry>
           If entry is Link type, the URL to access.
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>YES</entry>
		<entry>2</entry>
	  </row>
	  <row>
	    <entry>Categories</entry>
	    <entry>
          Categories in which the entry should be shown in a menu (for possible values see the <ulink url="http://www.freedesktop.org/standards/menu-spec/">xdg-menu</ulink> specification).
	    </entry>
	    <entry>string(s)</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>OnlyShowIn / NotShowIn</entry>
	    <entry>
           A list of strings identifying the environments that should display/not display a given .desktop item. Only one of these keys, either OnlyShowIn or NotShowIn, may appear in a Group. (for possible values see the <ulink url="http://www.freedesktop.org/standards/menu-spec/">xdg-menu</ulink> specification)
	    </entry>
	    <entry>string(s)</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1-4</entry>
	  </row>
	  <row>
	    <entry>StartupNotify</entry>
	    <entry>
			If true, it is KNOWN that the application will send a "remove"
			message when started with the DESKTOP_LAUNCH_ID environment variable
			set (see the <ulink url="http://www.freedesktop.org/standards/startup-notification-spec/">startup notification spec</ulink> for more details).
	    </entry>
	    <entry>boolean</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	  <row>
	    <entry>StartupWMClass</entry>
	    <entry>
			If true, it is KNOWN that the application will map at least one
			window with the given string as its WM class or WM name hint (see the <ulink url="http://www.freedesktop.org/standards/startup-notification-spec/">startup notification spec</ulink> for more details).
	    </entry>
	    <entry>string</entry>
	    <entry>NO</entry>
	    <entry>NO</entry>
		<entry>1</entry>
	  </row>
	</tbody>
      </tgroup>
    </table>
  </sect1>
  <sect1 id="character-encoding">
    <title>Character set encoding of the file</title>
    <para>
      Desktop entry files are encoded as lines of 8-bit characters separated
      by LF characters.
    </para>
    <itemizedlist>
      <listitem>
       <para>
         Key names must contain only the characters 'A-Za-z0-9-'
       </para>
      </listitem>
      <listitem>
       <para>
         Group names may contain all ASCII characters except for control 
         characters and '[' and ']'.
       </para>
      </listitem>
      <listitem>
       <para>
         Values of type string may contain all ASCII characters except
         for control characters.
       </para>
      </listitem>
      <listitem>
       <para>
          Values of type boolean must either be the string 'true' or
          'false'.
       </para>
      </listitem>
      <listitem>
       <para>
          Numeric values must be a valid floating point number as recognized
          by the %f specifier for scanf.
       </para>
      </listitem>
    </itemizedlist>
    <para>
      Comment lines are uninterpreted and may contain any character 
      (except for LF). However, using UTF-8 for comment lines that
      contain characters not in ASCII is encouraged.
    </para>
	<para>
	  The encoding for values of type localestring is determined by the
	  Encoding field. 
	</para>
  </sect1>
  <sect1 id="exec-variables">
    <title>List of valid Exec parameter variables</title>
    <para>
      Each "Exec" field may take a number of arguments which will be
      expanded by the file manager or program launcher and passed to the
      program if necessary.
    </para>
    <para>
      Literal % characters must be escaped as %%, and adding new
      format characters is not allowed. It's a fatal error to have an
      Exec field with a format character not given in the spec.
      Again for emphasis: <emphasis>nonstandard extensions are 
      not allowed here - you must add an X-Foo-Exec field if you have
      nonstandard Exec lines</emphasis>.
    </para>
	<para>
	  The escaping of the exec parameters is done in the way the mailcap
	  specification describes. Take a look at
	  <ulink url="http://www.faqs.org/rfcs/rfc1524.html">RFC 1524</ulink>
	  for more information.
	</para>
    <para>
    Recognized fields are as follows:
    </para>
    <informaltable>
      <tgroup cols="2">
	<tbody>
	  <row>
	    <entry>%f</entry>
	    <entry>
	      a single file name, even if multiple files are selected.  The system
	      reading the Desktop Entry should recognize that the program in
	      question cannot handle multiple file arguments, and it should
	      should probably spawn and execute multiple copies of a program
	      for each selected file if the program is not able to handle
	      additional file arguments. If files are not on the local file system
	      (i.e. HTTP or FTP locations), the files will be copied to the local
	      file system and %f will be expanded to point at the temporary
	      file. Used for programs that do not understand URL syntax.
	    </entry>
	  </row>
	  <row>
	    <entry>%F</entry>
	    <entry>
	      a list of files. Use for apps that can open several local
	      files at once.
	    </entry>
	  </row>
	  <row>
	    <entry>%u</entry>
	    <entry>
	      a single URL.
	    </entry>
	  </row>
	  <row>
	    <entry>%U</entry>
	    <entry>
	      a list of URLs.
	    </entry>
	  </row>
	  <row>
	    <entry>%d</entry>
	    <entry>
              directory containing the file that would be passed in a %f field
	    </entry>
	  </row>
	  <row>
	    <entry>%D</entry>
	    <entry>
              list of directories containing the files that would be
              passed in to a %F field
	    </entry>
	  </row>
	  <row>
	    <entry>%n</entry>
	    <entry>
	      a single filename (without path)
	    </entry>
	  </row>
	  <row>
	    <entry>%N</entry>
	    <entry>
	      a list of filenames (without path)
	    </entry>
	  </row>
	  <row>
	    <entry>%i</entry>
	    <entry>
	      the icon associated with the desktop entry
	    </entry>
	  </row>
	  <row>
	    <entry>%c</entry>
	    <entry>
	      the comment associated with the desktop entry
	    </entry>
	  </row>
	  <row>
	    <entry>%k</entry>
	    <entry>
	      the name of the desktop file
	    </entry>
	  </row>
	  <row>
	    <entry>%v</entry>
	    <entry>
	      the name of the Device entry in the desktop file
	    </entry>
	  </row>
	</tbody>
      </tgroup>
    </informaltable>
  </sect1>
  <sect1 id="mime-types">
    <title>Detailed discussion of supporting MIME types</title>
    <para>
      It is in every desktop's best interest to have thorough support for
      mime types.  The old /etc/mailcap and /etc/mime.types files are rather
      limited in scope and frankly, are outdated.  Various desktop systems
      have come up with different ways of extending this original system,
      but none are compatible with each other.  The Desktop Entry Standard
      hopes to be able to provide the beginnings of a solution to this
      problem.
    </para>
    <para>
      At a very basic level, the "Exec" key provides the default action to
      take when the program described by a desktop entry is used to open a
      document or data file.  Usually this consists of some action along the
      lines of "kedit %f" or "ee %f".  This is a good
      start, but it isn't as flexible as it can be.
    </para>
    <para>
      Let us first establish that a program which supports a MIME type or
      multiple mime types may be able to support multiple actions on those
      MIME types as well.  The desktop entry may want to define additional
      actions in addition to the default.  The toplevel "Exec" key describes
      the default action; Let us define this action to also be known as the
      "Open" action.  Additional actions which might be possible include
      View, Edit, Play, etc.  A further revision of this document will
      probably specify several "standard" actions in addition to the default
      "Open" action, but in all cases, the number of actions is
      arbitrary.
    </para>
    <para>
      Let us use a sound player as a simple example.  Call it sp.  The
      default Exec (Open) action for this program would likely look
      something like:
    </para>
    <programlisting>
Exec=sp %u</programlisting>
    <para>
      However, imagine the sound player also supports editing of sound files
      in a graphical manner.  We might wish to define an additional action
      which could accomodate this.  Adding the action would be performed
      like this:
    </para>
    <programlisting>
Actions=Edit;

[Desktop Action Edit]
Exec=sp -edit %u</programlisting>
    <para>
      As you can see, defining the action "edit" will enable an additional
      group of the name [Desktop Action <replaceable>actionname</replaceable>] to be read.  This
      group can contain an additional Exec line, as well as possibly other
      information like a new Name, Comment, Icon, and Path.  Thus
      right-clicking on a .wav file will show both the default "Open" action
      and this "Edit" action to both be displayed as choices in the
      context-menu.  A left click (double or single, whichever the file
      manager implements) would cause the default action to take place.
      These are implementation-specific details which are up to the
      implementer, and are not enforced by this standard.
    </para>
    <para>
      If no DefaultApp is specified for a particular MIME type, any one of
      the programs registered which claim to be able to handle the MIME type
      may become the default handler.  This behaviour is undefined and
      implementation-specific. KDE doesn't use a DefaultApp anymore, but assigns
      a Preference number to each program, so that the highest number is the
      one chosen for handling the MIME type.
    </para>
  </sect1>
  <sect1 id="extending">
    <title>Extending the format</title>
    <para>
      If the standard is to be amended with a new {key,value} pair which
      should be applicable to all supporting parties, a group discussion
      will take place.  This is the preferred method for introducing
      changes.  If one particular party wishes to add a field for personal
      use, they should prefix the key with the string "X-PRODUCT",
      i.e. "X-NewDesktop-Foo", following the precedent set by other IETF and RFC
      standards.
    </para>
    <para>
      Alternatively, fields can be placed in their own group, where they may
      then have arbitrary key names.  If this is the case, the group should
      follow the scheme outlined above, i.e. [X-PRODUCT GROUPNAME] or
      something similar.  These steps will avoid namespace clashes between
      different yet similar environments.
    </para>
  </sect1>
  <appendix id="example">
    <title>Example Desktop Entry File</title>
    <programlisting>
[Desktop Entry]
Version=1.0
Type=Application
Encoding=UTF-8
Name=Foo Viewer
Comment=The best viewer for Foo objects available!
TryExec=fooview
Exec=fooview %F
Icon=fooview.png
MimeType=image/x-foo
X-KDE-Library=libfooview
X-KDE-FactoryName=fooviewfactory
X-KDE-ServiceType=FooService

[Desktop Action Inverse]
Exec=fooview --inverse %f
Name=Foo Viewer (inverse image)

[Desktop Action Edit]
Exec=fooview --edit %f
Name=Foo Viewer (edit image)
Icon=fooview-edit.png</programlisting>
  </appendix>
  <appendix id="kde-items">
  <title>Currently reserved for use within KDE</title>
    <para>
      During the time KDE added some extensions that are currently not prefixed by the "X-" prefix, but should be in future KDE releases.
    </para>
    <itemizedlist>
      <listitem>
        <para>
         Keys added by KDE: ServiceTypes, DocPath, Keywords, InitialPreference
        </para>
      </listitem>
	  <listitem>
        <para>
         Types added by KDE: ServiceType, Service
        </para>
      </listitem>
	</itemizedlist>
  </appendix>
  <appendix id="deprecated-items">
  <title>Deprecated Items</title>
  <para>
    As this standard is quite old there are some deprecated items that may or may not be used by serveral implementations.
  </para>
    <itemizedlist>
      <listitem>
        <para>
          Type=MimeType is deprecated as there is a new standard for this now: http://www.freedesktop.org/standards/shared-mime-info.html for more information. In consequence the Keys 'Patterns' (various file name extensions associated with the MIME type.) and 'DefaultApp' (the default application associated with this mime type) are also deprecated.
        </para>
      </listitem>
      <listitem>
        <para>
          Using .kdelnk instead of .desktop as file-extension is deprecated.
        </para>
      </listitem>
      <listitem>
        <para>
          Using "[KDE Desktop Entry]" instead of "[Desktop Entry]" as header is deprecated.
        </para>
      </listitem>
      <listitem>
        <para>
          Encoding=LegacyMixed, which allowed localestrings in the encoding of the specified locale, is deprecated.
        </para>
      </listitem>
      <listitem>
        <para>
          Deprecated ExecParameters: %m (the mini-icon associated with the desktop entry)
        </para>
      </listitem>
      <listitem>
        <para>
          Deprecated Keys: MiniIcon (small icon for menus, etc), TerminalOptions (if the program runs in a terminal, any options that should be passed to the terminal emulator before actually executing the program), Protocols, Extensions, BinaryPattern, MapNotify.
        </para>
      </listitem>
      <listitem>
        <para>
    Historically some booleans have been represented by the numeric entries 0 or 1. With this version of the standard they are now to be represented as a boolean string. However, if an implementation is reading a pre-1.0 desktop entry, it should interpret 0 and 1 as false and true, respectively. 
        </para>
      </listitem>
      <listitem>
        <para>
          Historically lists have been comma separated . This is inconsistent with other lists which are separated by a semicolon. When reading a pre-1.0 desktop entry, comma separated lists should continue to be supported. 
        </para>
      </listitem>
    </itemizedlist>
  </appendix>
  <appendix id="legacy-mixed">
    <title>The Legacy-Mixed encoding (Deprecated)</title>
    <para>
      The Legacy-Mixed encoding corresponds to the traditional encoding
      of desktop files in older versions of the GNOME and KDE desktop
      files. In this encoding, the encoding of each localestring key
      is determined by the locale tag for that key, if any. For keys
      without a locale tag, the value must contain only ASCII 
      characters.
    </para>
    <para>
      If the file specifies an unsupported encoding, the implementation
      should either ignore the file, or, if the user has requested a direct
      operation on the file (such as opening it for editing), display an
      appropriate error indication to the user.
    </para>
    <para>
      In the absence of an Encoding line, the implementation may choose
      to autodetect the encoding of the file by using such factors
      as:
    </para>
    <itemizedlist>
      <listitem>
	<para>
	  The location of the file on the filesystem
	</para>
      </listitem>
      <listitem>
	<para>
	  Whether the contents of the file are valid UTF-8
	</para>
      </listitem>
    </itemizedlist>
    <para>
      If the implementation does not perform such auto-detection, it should
      treat a file without an Encoding key in the same way as a file with an
      unsupported Encoding Key.
    </para>
    <para>
      If the locale tag includes an .ENCODING part, then that determines
      the encoding for the line. Otherwise, the encoding is determined
      by the language, or language-country pair from the locale tag, according
      to the following table.
    </para>
    <informaltable>
      <tgroup cols="2">
	<thead>
	  <row>
	    <entry>Encoding</entry>
	    <entry>Aliases</entry>
	    <entry>Tags</entry>
	  </row>
	</thead>
	<tbody>
	  <row>
	    <entry>ARMSCII-8 (*)</entry><entry></entry><entry>by</entry>
	  </row><row>
	    <entry>BIG5</entry><entry></entry><entry>zh_TW</entry>
	  </row><row>
	    <entry>CP1251</entry><entry></entry><entry>be bg</entry>
	  </row><row>
	    <entry>EUC-CN</entry><entry>GB2312</entry><entry>zh_CN</entry>
	  </row><row>
	    <entry>EUC-JP</entry><entry></entry><entry>ja</entry>
	  </row><row>
	    <entry>EUC-KR</entry><entry></entry><entry>ko</entry>
	  </row><row>
	    <entry>GEORGIAN-ACADEMY (*)</entry><entry></entry><entry></entry>
	  </row><row>
	    <entry>GEORGIAN-PS (*)</entry><entry></entry><entry>ka</entry>
	  </row><row>
	    <entry>ISO-8859-1</entry><entry></entry><entry>br ca da de en es eu fi fr gl it nl no pt sv wa</entry>
	  </row><row>
	    <entry>ISO-8859-2</entry><entry></entry><entry>cs hr hu pl ro sk sl sq sr</entry>
	  </row><row>
	    <entry>ISO-8859-3 </entry><entry></entry><entry>eo</entry>
	  </row><row>
	    <entry>ISO-8859-5</entry><entry></entry><entry>mk sp</entry>
	  </row><row>
	    <entry>ISO-8859-7</entry><entry></entry><entry>el</entry>
	  </row><row>
	    <entry>ISO-8859-9</entry><entry></entry><entry>tr</entry>
	  </row><row>
	    <entry>ISO-8859-13</entry><entry></entry><entry>lt lv mi</entry>
	  </row><row>
	    <entry>ISO-8859-14</entry><entry></entry><entry>cy ga</entry>
	  </row><row>
	    <entry>ISO-8859-15</entry><entry></entry><entry>et</entry>
	  </row><row>
	    <entry>KOI8-R</entry><entry></entry><entry>ru</entry>
	  </row><row>
	    <entry>KOI8-U</entry><entry></entry><entry>uk</entry>
	  </row><row>
	    <entry>TCVN-5712 (*)</entry><entry>TCVN</entry><entry>vi</entry>
	  </row><row>
	    <entry>TIS-620</entry><entry></entry><entry>th</entry>
	  </row><row>
	    <entry>VISCII</entry><entry></entry><entry></entry>
	  </row>
	</tbody>
      </tgroup>
    </informaltable>
    <variablelist>
      <varlistentry>
	<term>Encoding</term>
	<listitem>
	  <para>
	    The name given here is listed here is typically the
	    canonical name for the encoding in the GNU C Library's
	    iconv facility Encodings marked with (*) are not
	    currently supported by the GNU C Library; for this reason,
	    implementations may choose to ignore lines in desktop
	    files that resolve to this encoding. Desktop files with
	    these encodings are currently rare or non-existent.
	  </para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>Aliases</term>
	<listitem>
	  <para>
	    Other names for the encoding found in existing desktop
	    files.
	  </para>
	</listitem>
      </varlistentry>
      <varlistentry>
	<term>Tags</term>
	<listitem>
	  <para>
	    Language tags for which this is the default encoding.
	  </para>
	</listitem>
      </varlistentry>
    </variablelist>
    <para>
      This table above covers all tags and encodings that are known to
      be currently in use. Implementors may choose to support
      encodings not in the above set. For tags without defaults listed
      in the above table, desktop file creators must specify the
      ENCODING part of the locale tag.
    </para>
    <para>
      Matching the ENCODING part of the locale tag against a locale
      name or alias should be done by stripping all punctuation
      characters from both the tag and the name or alias, converting
      both name and alias to lowercase, and comparing the result.
      This is necessary because, for example, "Big5" is frequently
      found instead of "BIG5" and "georgianacademy" instead of
      GEORGIAN-ACADEMY. Desktop files creators should, however, use
      the name as it appears in the "Encoding" column above.
    </para>
  </appendix>
</article>