summaryrefslogtreecommitdiffstats
path: root/doc/userguide/kde-for-admins.docbook
blob: bc646625bc55fe551dab1bd0168ccf1eb2232310 (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
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
<part id="kde-for-administrators">
<partinfo>
<authorgroup>
<author>
<personname>
<firstname>Waldo</firstname>
<surname>Bastian</surname>
</personname>
<email>bastian@kde.org</email>
</author>
<othercredit role="reviewer">
&Philip.Rodrigues;
&Philip.Rodrigues.mail;
</othercredit>
</authorgroup>
</partinfo>

<title>&kde; for Administrators</title>

<chapter id="kde-internals">
<title>&kde; Internals</title>

<sect1 id="kde-for-admins-overview">
<title>Overview</title>
<para>to be written</para>
</sect1>

<sect1 id="directory-layout">
<title>Directory Layout</title>

<para>&kde; defines a filesystem hierarchy which is used by the &kde;
environment itself as well as all &kde; applications. In general &kde;
stores all its files in a directory tree with a fixed structure.
</para>

<para>By default &kde; uses two directory trees:</para>

<itemizedlist>
<listitem><para>One at the system level (for example <filename
class="directory">/opt/trinity</filename>).</para></listitem>
<listitem><para>One at the user level in the user's home directory
(usually <filename class="directory">
~/.kde</filename>)</para></listitem>
</itemizedlist>

<para>As a system administrator you can create additional trees. Such
additional trees can be used for <link
linkend="user-profiles">profiles</link></para>

<informalexample><para>&SuSE; &Linux; for example uses:</para>

<itemizedlist>
<listitem><para><filename
class="directory">$<envar>HOME</envar>/.kde</filename></para></listitem>
<listitem><para><filename
class="directory">/opt/trinity</filename>. (This is
&SuSE;-specific; other distributions may use
<filename class="directory">/usr</filename> or <filename
class="directory">/usr/trinity</filename>)</para></listitem>
<listitem><para><filename
class="directory">/etc/opt/trinity</filename>. (This was added by
&SuSE;).</para></listitem>
</itemizedlist>

<para>If you have the KIOSK Admin tool v0.7 or later installed you can
check which directory trees are used with the following command:
<userinput><command>kiosktool-tdedirs</command>
<option>--check</option></userinput></para>
</informalexample>

<para>&kde; and &kde; applications look up files by scanning all the
&kde; directory trees.  The directory trees are checked in order of
precedence. When a file is present in multiple directory trees, the
file from the last tree takes precedence.  Normally, the tree
located in the user's home directory has the highest precedence. This
is also the directory tree to which changes are written.</para>

<informalexample>
<para>For information about the <literal>text/plain</literal> &MIME; type
the following files are searched:</para>

<itemizedlist>
<listitem><para><filename
class="directory">$<envar>HOME</envar>/.kde/share/mimelnk/text/plain.desktop</filename></para></listitem>
<listitem><para><filename
class="directory">/opt/trinity/share/mimelnk/text/plain.desktop</filename></para></listitem>
<listitem><para><filename
class="directory">/etc/opt/trinity/share/mimelnk/text/plain.desktop</filename></para></listitem>
</itemizedlist>

<para>If a user makes a change, the change is written to <filename
class="directory">$<envar>HOME</envar>/.kde/share/mimelnk/text/plain.desktop</filename></para>
</informalexample>

<para>For configuration files the story is slightly different. If
there are multiple configuration files found in the directory trees
with the same name, their content is combined. The precedence order of
the directory trees plays a role here. When two files define the same
configuration key, the file with the highest precedence determines
which value is used for the key.</para>

<informalexample><para>
For example, if the following two files exist, with these contents:</para>
<variablelist>
<varlistentry><term><filename>$<envar>HOME</envar>/.kde/share/config/foobar</filename></term>
<listitem><programlisting>
Color=red
Shape=circle
</programlisting>
</listitem>
</varlistentry>

<varlistentry>
<term><filename>/etc/opt/trinity/share/config/foobar</filename></term>
<listitem><programlisting>
Color=blue
Position=10,10
</programlisting>
</listitem>
</varlistentry>
</variablelist>

<para>The files will be merged to result in:</para>

<programlisting>
Color=red
Shape=circle
Position=10,10
</programlisting>

</informalexample>
</sect1>

<sect1 id="specifying-directories">
<title>Specifying Directories</title>

<para>

<segmentedlist>
<segtitle>Environment Variable</segtitle>
<segtitle>Example Setting(s)</segtitle>
<segtitle>Comment</segtitle>

<seglistitem>
<seg><envar>TDEHOME</envar></seg>
<seg><filename class="directory">~/.kde</filename></seg>
<seg></seg>
</seglistitem>

<seglistitem>
<seg><envar>TDEROOTHOME</envar></seg>
<seg><filename class="directory">/root/.kde</filename></seg>
<seg>Different variable to prevent
root writing to $TDEHOME of the user after running
<command>su</command>.</seg>
</seglistitem>

<seglistitem>
<seg><envar>TDEDIR</envar></seg>
<seg><filename class="directory">/opt/trinity</filename>, <filename
class="directory">/usr</filename>, <filename
class="directory">/usr/trinity</filename></seg>
<seg>Vendor dependent. Used by &kde; 2. If not set, falls back to
compiled-in default.</seg>
</seglistitem>

<seglistitem>
<seg><envar>TDEDIRS</envar></seg>
<seg><filename class="directory">/opt/trinity</filename>, <filename
class="directory">/usr</filename>, <filename
class="directory">/usr/trinity</filename></seg>
<seg>New in &kde;3. Can list multiple locations separated by a
colon. If not set, falls back to $<envar>TDEDIR</envar></seg>
</seglistitem>

</segmentedlist>
</para>
<para>Don't <emphasis>need</emphasis> to be set, defaults work just fine.</para>
<para>Running &kde;2 next to &kde;3? Point $<envar>TDEDIR</envar> to
&kde; 2 and $<envar>TDEDIRS</envar> to &kde; 3.</para>

<informalexample>
<para>A staff member at a university could have the following
settings:</para>
<programlisting>
TDEHOME='~/.trinity'
TDEROOTHOME='/root/.trinity'
TDEDIRS='/opt/kde_staff:/opt/trinity'
</programlisting>

</informalexample>

</sect1>

<sect1 id="user-profiles">
<title>User Profiles</title>

<para>In the previous example <filename
class="directory">/opt/kde_staff</filename> contained additional settings
and applications for staff members. <quote>User Profiles</quote> allow you
to add this directory only for certain users and not for others.  Add the
following to <filename>/etc/kderc</filename>:</para>

<programlisting>
[Directories-staff]
prefixes=/opt/kde_staff
</programlisting>

<para>This creates a profile named <quote>staff</quote> that adds the
<filename class="directory">/opt/kde_staff</filename> directory
tree. (Note that &SuSE; &Linux; uses
<filename>/etc/trinityrc</filename> instead of
<filename>/etc/kderc</filename>. Now that we have a named profile it
can be assigned to users.</para>

<para>To map profiles to users a mapping file needs to be specified in
<filename>/etc/kderc</filename>:</para>

<programlisting>
[Directories]
userProfileMapFile=/etc/kde-user-profile
</programlisting>

<para>It is now possible to assign a profile based on either the user name
or based on the &UNIX; group the user is part of.</para> 

<para>To assign the staff profile to all users that are a member of the
&UNIX; group staff_members add the following to
<filename>/etc/kde-user-profile</filename>:</para>

<programlisting>
[General]
groups=staff_members
[Groups]
staff_members=staff
</programlisting>

<para>It is also possible to assign a profile to a single user:</para>

<programlisting>
[Users]
bastian=staff
</programlisting>

</sect1>

<sect1 id="directory-layout-revisited">
<title>Directory Layout Revisited</title>

<para>Each directory tree used by &kde; has a fixed directory structure.
Directories that are not relevant for a certain tree, or simply not used can
be left out though. For example, directories used for temporary files are
usually only found under <filename
class="directory">$<envar>TDEHOME</envar></filename> but not in any other
directory tree.</para>

</sect1>

<sect1 id="architecture-specific-directories">
<title>Architecture-specific Directories</title>

<para>Architecture (OS and CPU type) specific directories:</para>

<variablelist>
<varlistentry>
<term><filename class="directory">bin</filename></term>
<listitem><para>Used for &kde; executables.</para></listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">lib</filename></term>
<listitem><para>Used for &kde; libraries.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">lib/trinity</filename></term>
<listitem><para>This directory contains components, plugins, and other
runtime loadable objects for use by &kde; 3.<replaceable>x</replaceable>
applications.</para></listitem> 
</varlistentry>
</variablelist>

</sect1>

<sect1 id="shared-directories">
<title>Shared Directories</title>

<para>Shared: Not architecture specific, can be shared between different
archs.</para>

<variablelist>
<varlistentry>
<term><filename class="directory">share/applnk</filename></term>
<listitem><para><literal role="extension">.desktop</literal> files for
&kde;-menu (old)</para></listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/applications</filename></term>
<listitem><para><literal role="extension">.desktop</literal> files for
&kde;-menu (since &kde; 3.2)</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/apps</filename></term>
<listitem><para>Contains application-specific data files. Each
application has a sub-directory here for storing additional data
files.</para></listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/config</filename></term>
<listitem><para>Configuration files. Configuration files are normally
named after the application they belong to plus the letters
<quote>rc</quote>. A special case is <filename>kdeglobals</filename>. 
This file is read by all &kde; applications.</para></listitem>
</varlistentry>

<varlistentry>
<term><filename
class="directory">share/config/session</filename></term>
<listitem><para>This directory is used by session management and is
normally only available under <filename
class="directory">$<envar>TDEHOME</envar></filename>. At the end of a
session &kde; applications store their state here. The file names
consist of the name of the application followed by a number. The
session manager <command>ksmserver</command> stores references to
these numbers when saving a session in
<filename>ksmserverrc</filename>.</para></listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/doc/HTML</filename></term>
<listitem><para>This directory contains documentation for &kde;
applications. Documentation is categorized by language and the
application it belongs to. Normally at least two files can be found in
a directory: <filename>index.docbook</filename>, which contains the
documentation in the unformatted DocBook format, and
<filename>index.cache.bz2</filename>, which contains the same
documentation formatted as <command>bzip2</command>-compressed
&HTML;. The &HTML; version is used by &khelpcenter;. If the &HTML;
version is missing, &khelpcenter; will regenerate it from the DocBook
version but this is a time-consuming process.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/icons</filename></term>
<listitem><para>Under this directory icons are stored. Icons are
categorized by theme, dimension and usage category.</para></listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/mimelnk</filename></term>
<listitem><para>In this directory,<literal
role="extension">.desktop</literal> files that describe &MIME; types
are stored. &kde; uses &MIME; types to identify the type of a
file.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/services</filename></term>
<listitem><para>This directory contains <literal
role="extension">.desktop</literal> files that describe services. Services
are like applications but are usually launched by other applications instead
of the user. Services do not appear in the &kde; menu.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/servicetypes</filename></term>
<listitem><para>This directory contains <literal
role="extension">.desktop</literal> files that describe
servicetypes. A servicetype usually represents a certain programming
interface. Applications and Services include in their <literal
role="extension">>.desktop</literal> files the servicetypes that they
provide.</para> </listitem></varlistentry>

<varlistentry>
<term><filename class="directory">share/sounds</filename></term>
<listitem><para>This directory contains sound files.</para></listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/templates</filename></term>
<listitem><para>This directory contains templates for creating files
of various types. A template consists of a <literal
role="extension">.desktop</literal> file that describes the file and
that includes a reference to a file in the <filename
class="directory">.source</filename> sub-directory. The templates in
this directory appear in the <guimenu>Create New</guimenu> menu
available on the desktop and in the file browser. When a user selects
a template from the menu its source file is copied.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename class="directory">share/wallpapers</filename></term>
<listitem><para>This directory contains images that can be used as
background picture</para></listitem>
</varlistentry>

</variablelist>

</sect1>

<sect1 id="host-specific-directories">
<title>Host-specific Directories</title> 

<para>There are three host-specific directories that are usually
symlinked to other locations. If the directories do not already exist,
the following symlinks and directories will be created using the
<command>lnusertemp</command> utility:</para>

<variablelist>

<varlistentry>
<term><filename>$<envar>TDEHOME</envar>/socket-$<envar>HOSTNAME</envar></filename></term>
<listitem><para>Usually <filename
class="directory">/tmp/ksocket-$<envar>USER</envar>/</filename>, this
is used for various &UNIX; sockets.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename>$<envar>TDEHOME</envar>/tmp-$<envar>HOSTNAME</envar></filename></term>
<listitem><para>Usually	<filename
class="directory">/tmp/kde-$<envar>USER</envar>/</filename>, this is used for temporary files.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename>$<envar>TDEHOME</envar>/cache-$<envar>HOSTNAME</envar></filename></term>
<listitem><para>Usually <filename
class="directory">/var/tmp/kdecache-$<envar>USER</envar>/</filename>,
this is used for cached files.</para>
</listitem>
</varlistentry>
</variablelist>

<para>Since both <filename class="directory">/tmp</filename> and
<filename class="directory">/var/tmp</filename> are world writable,
there is a possibility that one of the above directories already
exists but is owned by another user. In that case the
<command>lnusertemp</command> utility will create a new directory with
an alternative name and link to that instead.</para>

</sect1>

<sect1 id="configuration-files">
<title>Configuration Files</title> <para>&kde; uses a simple
text-based file format for all its configuration files. It consists of
key-value pairs that are placed in groups.  All &kde; configuration
files use <acronym>UTF</acronym>-8 encoding for text outside the
<acronym>ASCII</acronym> range.</para>

<para>The start of a group is indicated by a group name that is placed
in square brackets. All the key-value entries that follow belong to
the group. The group ends when either another group starts or when the
end of the file is reached. Entries at the top of the
file that are not preceded by a group name belong to the default
group.</para>

<informalexample><para>The following example shows a configuration
file that consists of two groups. The first group contains the keys
<varname>LargeCursor</varname> and <varname>SingleClick</varname>, the
second group contains the keys <varname>Show hidden files</varname>
and <varname>Sort by</varname>:</para>

<programlisting>
[KDE]
LargeCursor=false
SingleClick=true
</programlisting>

<programlisting>
[KFileDialog Settings]
Show hidden files=false
Sort by=Name
</programlisting>
</informalexample>

<para>Entries in a group consist of a key and value separated by an equals
sign. The key can contain spaces and may be followed by options placed in
square brackets.  The part after the equals sign is the value of the
entry. Any white space surrounding the equals sign is ignored, as is any
trailing white space. Put more concisely, the format is:</para>

<programlisting>
<replaceable>entry</replaceable>=<replaceable>value</replaceable>
</programlisting>

<para>If a value is supposed to include a space at the begin or end
then this can be achieved by using a backslash followed by an
<quote>s</quote>.</para>

<para>There are several other backslash codes; here is a complete
list:
<itemizedlist>
<listitem><para><token>\s</token> can be used as space</para>
</listitem>
<listitem><para><token>\t</token> can be used to include a tab</para>
</listitem>
<listitem><para><token>\r</token> for a carriage return character</para>
</listitem>
<listitem><para><token>\n</token> for a linefeed character (new line)</para>
</listitem>
<listitem><para><token>\\</token> to include the backslash itself</para>
</listitem>
</itemizedlist></para>

<informalexample><para>In the following example the value of the
<varname>Caption</varname> entry starts with two spaces while the
<varname>Description</varname> entry contains three lines of
text. Linefeeds in backslash notation are used to separate the
different lines.</para>

<programlisting>
[Preview Image]
Caption=\s My Caption
Description=This is\na very long\ndescription.
</programlisting>
</informalexample>

<para>Empty lines in configuration files are ignored, as are lines that
start with a hash mark (<quote>#</quote>). The hash mark can be used to add
comments to configuration files. It should be noted that when a &kde;
application updates a configuration file the comments are
<emphasis>not</emphasis> preserved.</para>

<para>There can be multiple configuration files with the same name in the
<filename class="directory">share/config</filename> sub-directory of the
various &kde; directory trees. In this case the information of all these
configuration files is combined on a key-by-key basis.  If the same key
within a certain group is defined in more than one place, the key value read
from the directory tree with the highest precedence will be used.
Configuration files under <filename
class="directory">$<envar>TDEHOME</envar></filename> always have the highest
precedence.  If a key in a certain group is defined multiple times in a
single file, the value of the last entry is used.</para>

<informalexample>
<para>If <filename>$<envar>HOME</envar>/.kde/share/config/foobar</filename>
contains:
<programlisting>
[MyGroup]
Color=red
Shape=circle
</programlisting>
and <filename>/etc/opt/trinity/share/config/foobar</filename> contains
<programlisting>
[MyGroup]
Color=blue
Position=10,10
</programlisting>
the result will be:
<programlisting>
[MyGroup]
Color=red
Shape=circle
Position=10,10
</programlisting>
</para>
</informalexample>

<informalexample>
<para>If
	<filename>$<envar>HOME</envar>/.kde/share/config/foobar</filename>
	contains
<programlisting>
[MyGroup]
Color=red
Shape=circle
[MyGroup]
Color=green
</programlisting>
and <filename>/opt/kde_staff/share/config/foobar</filename> contains
<programlisting>
[MyGroup]
Color=purple
Position=20,20
</programlisting>
and <filename>/etc/opt/trinity/share/config/foobar</filename> contains
<programlisting>
[MyGroup]
Color=blue
Position=10,10
</programlisting>
the result will be:
<programlisting>
[MyGroup]
Color=green
Shape=circle
Position=20,20
</programlisting>
</para>
</informalexample>

<para>To prevent users being able to override default settings,
settings can be marked immutable. Settings can be made immutable
individually, per group or per file. An individual entry can be locked
down by adding <userinput>[$i]</userinput> behind the key, &eg;:
<programlisting>
Color[$i]=blue
</programlisting>
</para>
<para>A group of entries can be locked down by placing
<userinput>[$i]</userinput> behind the group name, &eg;:
<programlisting>
[MyGroup][$i]
</programlisting>
</para>
<para>To lock down the entire file, start the file with
<userinput>[$i]</userinput> on a single line, &ie;:
<programlisting>
[$i]
</programlisting>
</para>

<informalexample>
<para>If
	<filename>$<envar>HOME</envar>/.kde/share/config/foobar</filename>
	contains:
<programlisting>
[MyGroup]
Color=red
Shape=circle
</programlisting>
and <filename>/etc/opt/trinity/share/config/foobar</filename> contains:
<programlisting>
[MyGroup][$i]
Color=blue
Position=10,10
</programlisting>
the result will be:
<programlisting>
[MyGroup]
Color=blue
Position=10,10
</programlisting>
</para>
</informalexample>

<informalexample><para>If
	<filename>$<envar>HOME</envar>/.kde/share/config/foobar</filename>
	contains:
<programlisting>
[MyGroup]
Color=red
Shape=circle
</programlisting>
and <filename>/opt/kde_staff/share/config/foobar</filename> contains
<programlisting>
[MyGroup]
Color=purple
Shape=rectangle
</programlisting>
and <filename>/etc/opt/trinity/share/config/foobar</filename> contains
<programlisting>
[MyGroup][$i]
Color=blue
Position=10,10
</programlisting>
the result will be
<programlisting>
[MyGroup]
Color=purple
Shape=rectangle
Position=10,10
</programlisting>
</para>
</informalexample>


<para>So-called <quote>Shell Expansion</quote> can be used to provide more
dynamic default values. With shell expansion the value of a configuration
key can be constructed from the value of an environment variable or from the
output of a shell command.  To enable shell expansion for a configuration
entry, the key must be followed by <token>[$e]</token>.  Normally the
expanded form is written into the user's configuration file after first use.
To prevent that, it is recommend to lock the configuration entry down by
using <token>[$ie]</token>.  The user can't change it then of course.</para>

<informalexample>
<para>In the following example the value for the <varname>Host</varname>
entry is determined by the output of the <command>hostname</command>
program. This setting is also locked down to ensure that the value is always
determined dynamically.</para>

<para>The value for the <varname>Email</varname> entry is determined by
filling in the values of the $<envar>USER</envar> and $<envar>HOST</envar>
environment variables. When <systemitem class="username">joe</systemitem> is
logged in on <systemitem class="systemname">joes_host</systemitem> this will
result in a value equal to <literal>joe@joes_host</literal>. The setting is
not locked down.</para>

<programlisting>
[Mail Settings] 
Host[$ie]=$(hostname)
Email[$e]=${USER}@${HOST}
</programlisting>
</informalexample>

<para>Most configuration entries can be indexed with a language code. In
this case, the language that the user has selected for use on the desktop is
used to look up the key value. If the default language (American English)
has been selected or if there is no index that corresponds to the selected
language, the key entry without index is used.</para>

<informalexample>
<para>In the following example the value of the <varname>Caption</varname>
entry depends on the language. If the user has selected French as language
(language code <literal>fr</literal>) the value of the entry will be
<quote>Ma L&eacute;gende</quote>. In all other cases the value <quote>My
Caption</quote> will be used.</para>

<programlisting>
[Preview Image]
Caption=My Caption
Caption[fr]=Ma L&eacute;gende
</programlisting>
</informalexample>

<informalexample>
<para>In this example the value of the <varname>Caption</varname> entry
depends on the language. If the user has selected French as language
(language code <literal>fr</literal>) the value of the entry will be
<quote>Ma L&eacute;gende.</quote> In all other cases the value <quote>My
Caption</quote> will be used.</para>

<programlisting>
[Preview Image]
Caption=My Caption
Caption[fr]=Ma L&eacute;gende
</programlisting>
</informalexample>

<para>In general the entries that can appear in a configuration file are not
documented.  With &kde; 3.2 a start has been made to change this. In
<filename
class="directory">$<envar>TDEDIR</envar>/share/config.kcfg</filename>, files
can be found that provide a formal description of the possible entries in a
configuration file. These are used by the new &kde; Configuration Editor
when available.</para>

<informalexample>
<para>Here is an example &XML; configuration file:
<programlisting>
<markup>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd"&gt;
&lt;kcfg&gt;
    &lt;kcfgfile name="korganizerrc"/&gt;
    &lt;group name="General"&gt;
         &lt;entry type="Bool" key="Auto Save"&gt;
             &lt;label&gt;Enable automatic saving of calendar&lt;/label&gt;
             &lt;default&gt;true&lt;/default&gt;
         &lt;/entry&gt;
         &lt;entry type="Int" key="Auto Save Interval"&gt;
             &lt;default&gt;10&lt;/default&gt;
         &lt;/entry&gt;
    &lt;/group&gt;
&lt;/kcfg&gt;
</markup>
</programlisting>
</para>
<para>It has the same effect as:
<programlisting>
[General]
Auto Save=false
Auto Save Interval=25
</programlisting>
</para>
</informalexample>

</sect1>

<sect1 id="kde-startup-sequence">
<title>&kde; Startup Sequence</title>

<sect2 id="kdm">
<title>&kdm;</title>

<para>Always runs as <systemitem class="username">root</systemitem>! Uses
<filename>$<envar>TDEDIR</envar>/share/config/kdmrc</filename> and
<filename>/etc/X11/xdm/Xservers</filename>. The latter contains entries
like:</para>

<programlisting>
:0 local /usr/X11R6/bin/X :0 vt07
</programlisting>

<para>Relevant startup files are also: </para>
<simplelist>
<member>
[X-*-Core] section in <filename>kdmrc</filename>
</member>
<member>
Setup - <filename>/etc/X11/xdm/Xsetup</filename>
</member>
<member>
User enters username &amp; password
</member>
<member>
Startup - <filename>/etc/X11/xdm/Xstartup</filename> - prepare as root
</member>
<member>
Session - <filename>/etc/X11/xdm/Xsession</filename> - starts session as user
</member>
<member>
= For a KDE session: <command>kde</command> or <command>starttde</command>
</member>
<member>
= If present <filename>~/.xsession</filename> or <filename>~/.xinitrc</filename>
</member>
<member>
Reset - <filename>/etc/X11/xdm/Xreset</filename> - after session finished
</member>
</simplelist>

</sect2>

<sect2 id="starttde">
<title>The &kde; Startup Script: <command>starttde</command></title>

<para>The &kde; startup sequence starts with the
<filename>starttde</filename> script. In most cases this script gets called
from the display manager (&kdm;) once the user has been authenticated. Their
are two very important lines in the <filename>starttde</filename>
script:</para>

<programlisting>
LD_BIND_NOW=true tdeinit +kcminit +knotify and kwrapper
ksmserver $KDEWM
</programlisting>

<para>The first line starts the <command>tdeinit</command> master process.
The <command>tdeinit</command> master process is used to start all other
&kde; processes.  It show up in the output of <command>ps
<option>aux</option></command> as <computeroutput>tdeinit:
Running...</computeroutput>. The arguments after <command>tdeinit</command>
are the names of additional processes to be started.  The <token>+</token>
indicates that <command>tdeinit</command> needs to wait till the process has
finished.  <command>tdeinit</command> also starts
<command>dcopserver</command>, <command>klauncher</command> and
<command>kded</command>.</para>

<para>The second of the two lines asks <command>tdeinit</command> to start
the <command>ksmserver</command> session manager process.  The session
manager determines the lifetime of the session. When this process exits, the
user is logged out.</para>

</sect2>
</sect1>

<sect1 id="background-processes">
<title>Background Processes</title>

<para>All &kde; background services are user-specific: unlike system daemons
they are not shared between users. As well as being unique per user they are
also unique per X-server display. The processes are:</para>

<variablelist>
<varlistentry>
<term><command>dcopserver</command></term>
<listitem><para>Desktop communication</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>kded</command></term>
<listitem><para>Generic service daemon.</para>
<para>Triggers <link linkend="ksycoca">Sycoca</link> database updates when
needed</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>kcminit</command></term>
<listitem><para>Initialization service</para>
<para>See <xref linkend="kcminit"/> for more information.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>klauncher</command></term>
<listitem><para>Program launch (this is <emphasis>not</emphasis> the
<keycombo action="simul">&Alt;<keycap>F2</keycap>
</keycombo>dialog!)</para>
<para>See <xref linkend="klauncher"/> for more information.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>knotify</command></term>
<listitem><para>User notifications.</para>
<para>See <xref linkend="knotify"/> for more information.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>ksmserver</command></term>
<listitem><para>Session management</para>
<para>See <xref linkend="ksmserver"/> for more information.</para>
</listitem>
</varlistentry>

</variablelist>

<sect2 id="tdeinit">
<title><command>tdeinit</command></title>
<para><command>tdeinit</command> is used to start all other &kde;
programs. <command>tdeinit</command> can start normal binary program files
as well as <command>tdeinit</command> loadable modules
(<acronym>KLM</acronym>s).  <acronym>KLM</acronym>s work just like binary
program files but can be started more efficiently.  <acronym>KLM</acronym>s
live in <filename
class="directory">$<envar>TDEDIR</envar>/lib/trinity</filename></para>

<para>The drawback is that programs started this way appear as
<computeroutput><command>tdeinit</command></computeroutput> in the output of
<command>top</command> and <command>ps</command>. Use <command>top
<option>-c</option></command> or <command>ps <option>aux</option></command>
to see the actual program name:</para>

<screen>
<prompt>%</prompt><userinput><command>ps <option>aux</option></command></userinput>
<computeroutput>
waba     23184  0.2  2.1 23428 11124 ?	S    21:41   0:00 tdeinit: Running...
waba     23187  0.1  2.1 23200 11124 ?	S    21:41   0:00 tdeinit: dcopserver --nosid
waba     23189  0.2  2.4 25136 12496 ?	S    21:41   0:00 tdeinit: klauncher
waba     23192  0.7  2.8 25596 14772 ?	S    21:41   0:00 tdeinit: kded
waba     23203  0.8  3.4 31516 17892 ?	S    21:41   0:00 tdeinit:
knotify
</computeroutput>
</screen>

<para><computeroutput>tdeinit: Running...</computeroutput> indicates the
master <command>tdeinit</command> process. The other processes listed are
programs started as <acronym>KLM</acronym>s.</para>

<para>When <command>tdeinit</command> starts for the first time it will
launch <command>dcopserver</command>, <command>klauncher</command>, and
<command>kded</command>, as well as any additional programs specified on its
command line in the <command>starttde</command> script, normally
<command>kcminit</command> and <command>knotify</command>.</para>

</sect2>

<sect2 id="dcopserver">
<title><command>dcopserver</command></title>

<para><command>dcopserver</command> is a daemon which provides inter-process
communication (&DCOP;) facilities to all &kde; applications. The &DCOP;
facilities are accessible from the command shell via the
<command>dcop</command> command line tool. &DCOP; is essential for all &kde;
applications.</para>

<para>Some related files:</para>

<variablelist>
<varlistentry>
<term><filename>$<envar>HOME</envar>/.DCOPserver_$<envar>HOSTNAME</envar>_$<envar>DISPLAY</envar></filename></term>
<listitem><para>&eg; <filename>.DCOPserver_linux__0</filename>.	Controlled by $<envar>DCOPAUTHORITY</envar></para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename>/tmp/.ICE-unix/dcop<replaceable>pid</replaceable>-<replaceable>number</replaceable></filename></term>
<listitem><para>&eg; <filename>dcop7634-1069677856</filename>. This is
the file that the <filename>DCOPserver</filename> file above points to.</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename>$<envar>HOME</envar>/.ICEauthority</filename></term>
<listitem><para>Authorization information controlled by
$<envar>ICEAUTHORITY</envar></para>
</listitem>
</varlistentry>
</variablelist>

</sect2>

<sect2 id="kcminit">
<title>kcminit</title>

<para><command>kcminit</command> executes initialization services during
startup. Initialization services are specified in the .desktop files of
applications or services via the <varname>X-KDE-Init</varname> line:</para>

<programlisting>
[Desktop Entry]
Encoding=UTF-8
Exec=kcmshell energy
Icon=energy_star
Type=Application
X-KDE-Library=energy
X-KDE-Init=energy
</programlisting>

<para>Initialization services are typically used for initializing
hardware based on user-specified settings.</para>

<para><userinput><command>kcminit
<option>--list</option></command></userinput> can be used to show all
initialization services and <userinput><command>kcminit
<replaceable>service</replaceable></command></userinput> can be used to
execute a single service explicitly. This can be useful when investigating
startup problems.</para>

</sect2>

<sect2 id="klauncher">
<title><command>klauncher</command></title>

<para><command>klauncher</command> is a daemon which is responsible for
service activation within &kde;. It operates in close connection with the
<command>tdeinit</command> master process to start new processes. &kde;
applications communicate with <command>klauncher</command> over &DCOP; in
order to start new applications or services.</para>

<para>Best known from the error message: <computeroutput><errortext>
KLauncher could not be reached via DCOP </errortext></computeroutput> which
either indicates a serious problem with the <command>dcopserver</command> or
that <command>klauncher</command> crashed.</para>

<para><command>klauncher</command> can be restarted by restarting
<command>tdeinit</command> from a console window. Make sure that
$<envar>HOME</envar>, $<envar>DISPLAY</envar> and the various
$<envar>TDEDIR(S)</envar> are set correctly when doing so!</para>

</sect2>

<sect2 id="knotify">
<title><command>knotify</command></title>

<para>The primary task of <command>knotify</command> is to relay sound
notifications to the sound server, it also provides alternative notification
methods.</para>

</sect2>


</sect1>

<sect1 id="ksmserver">
<title>KSMServer</title>

<para><command>ksmserver</command> is &kde;'s session manager. On startup
the session manager launches auto-start applications and restores
applications from the previous session.  The applications to auto-start are
indicated by <literal role="extension">.desktop</literal> files in the
<filename
class="directory">$<envar>TDEDIR</envar>/share/autostart</filename>
directory.  Whether or not to auto-start an application can be made
conditional upon some configuration entry determined by the
<varname>X-KDE-autostart-condition</varname> entry in the <literal
role="extension">.desktop</literal> file.</para>

<informalexample>
<para>The <filename>ktip.desktop</filename> file for example
contains:</para>

<programlisting>
X-KDE-autostart-condition=ktiprc:TipOfDay:RunOnStart:true
</programlisting>

<para>This means that the <filename>ktiprc</filename> configuration
file is checked for a <varname>RunOnStart</varname> entry in the
<varname>[TipOfDay]</varname> section. If no such entry is found,
<literal>true</literal> is assumed, which means that
<application>ktip</application> is one of the applications that is
auto-started by default.</para>
</informalexample>

<para>Some of the applications auto-started by <command>ksmserver</command>
are:</para>

<variablelist>

<varlistentry>
<term><command>kdesktop</command></term>
<listitem><para>The &kde; desktop</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>&kicker;</command></term>
<listitem><para>The &kde; panel</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>ktip</command></term>
<listitem><para>A tip of the day program</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>kwrited</command></term>
<listitem><para>A utility to receive system messages sent to the user</para>
</listitem>
</varlistentry>

<varlistentry>
<term>&klipper;</term>
<listitem><para>A clipboard utility that docks in the panel</para>
</listitem>
</varlistentry>

<varlistentry>
<term><command>kalarm</command></term>
<listitem><para>A utility that warns about upcoming events and appointments</para>
</listitem>

</varlistentry>
</variablelist>

<para><command>kdesktop</command> in its turn automatically starts
applications stored in <filename
class="directory">$<envar>TDEHOME</envar>/Autostart</filename>. <command>kdesktop</command>
will automatically open any files stored in this directory including
documents, binary files or applications in the form of <literal
role="extension">.desktop</literal> files.</para>

<para>The &kde; session manager also restores one of the previous
sessions. A session contains a collection of applications as well as
application-specific information that reflects the state of the applications
at the time the session was saved.  Sessions are stored in the
<filename>ksmserverrc</filename> configuration file which contains
references to application-specific state information. The
application-specific state information is saved in <filename
class="directory">$<envar>TDEHOME</envar>/share/config/session</filename>.
The state information of &twin; contains the location of the application
windows of all the other applications in the session.
</para>

</sect1>

<sect1 id="environment-variables">
<title>Environment variables</title>

<para>Some important environment variables used by &kde;:</para>

<variablelist>

<varlistentry>
<term>$<envar>TDEDIR</envar></term>
<listitem><para>Has to be set if
<envar>TDEDIRS</envar> is not set and has to point to the root of the
&kde; installation tree. Allows &kde; to find its data like icons,
menus and libraries.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>TDEDIRS</envar></term>
<listitem><para>Overrides <envar>TDEDIR</envar> and allows you to specify
multiple directories where &kde; searches for its data. Useful if you want
or have to install some programs to a different prefix than the rest of
&kde;.</para> 
</listitem>
</varlistentry>

<varlistentry><term><envar>$TDEHOME</envar></term><listitem><para>If
not set, &kde; uses <filename class="directory">~/.kde</filename> as
the directory where personal data is stored.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>TDEROOTHOME</envar></term><listitem><para>If
not set, &kde; uses <filename class="directory">~root/.kde</filename>
as the directory for <systemitem class="username">root</systemitem>'s
personal data. Was introduced to prevent &kde; from accidently
overwriting user data with root permissions when the user runs a &kde;
program after switching with <command>su</command> to <systemitem
class="username">root</systemitem>.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDEWM</envar></term><listitem><para>If the
<envar>KDEWM</envar> environment variable has been set, then it will
be used as &kde;'s window manager within the
<command>starttde</command> script instead of &twin;.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDE_LANG</envar></term><listitem><para>Overrides
the &kde; language configuration, &eg; <userinput>KDE_LANG=fr kprogram
&amp;</userinput> starts a program with French translation if the
necessary files are installed.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>TDE_MULTIHEAD</envar></term><listitem><para>Set
this variable to <literal>true</literal> to indicate that &kde; is running
on a multi-head system.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDE_FORK_SLAVES</envar></term>
<listitem><para>(Since &kde; 3.2.3) Set this variable to spawn
<acronym>KIO</acronym>-slaves directly from the application process
itself. By default <acronym>KIO</acronym>-slaves are spawned using
<command>klauncher</command>/<command>tdeinit</command>. This option is
useful if the <acronym>KIO</acronym>-slave should run in the same
environment as the application. This can be the case with
<application>Clearcase</application>.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDE_HOME_READONLY</envar></term>
<listitem><para>Set this variable to indicate that your home directory is
mounted as read-only.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDE_NO_IPV6</envar></term><listitem><para>
(Since &kde; 3.2.3) - Set this variable to disable <acronym>IPv6</acronym>
support and <acronym>IPv6</acronym> <acronym>DNS</acronym>
lookups.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDE_IS_PRELINKED</envar></term><listitem><para>
(Since &kde; 3.2) - Set this variable to indicate that you have prelinked
your &kde; binaries and libraries. This will turn off
<command>tdeinit</command>.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDE_UTF8_FILENAMES</envar></term><listitem><para>If
this environment variable is set, &kde; assumes all filenames are in
<acronym>UTF-8</acronym> encoding regardless of the current C
locale.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>TDE_FULL_SESSION</envar></term><listitem><para>
(Since &kde; 3.2)  Automatically set to true by &kde; startup, it is used
by &eg; &konqueror; to know if it should consider remaining in memory
for future re-use when being closed. If not set, &konqueror; will exit
after being closed (&eg; &tdesu; does that, it's also useful for
debugging).</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDESYCOCA</envar></term><listitem><para>Allows
you to specify the path and the name of the generated &kde; system
configuration cache file.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDETMP</envar></term><listitem><para>Allows
to specify another path than <filename
class="directory">/tmp</filename> where &kde; stores its temporary
files.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>KDEVARTMP</envar></term><listitem><para>Allows
to specify another path than <filename
class="directory">/var/tmp</filename> where &kde; stores its variable
files.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>XDG_DATA_HOME</envar></term><listitem><para>
(Since &kde; 3.2) Defines the base directory relative to which user-specific
data files should be stored. Default is <filename
class="directory">$<envar>HOME</envar>/.local/share</filename></para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>XDG_DATA_DIRS</envar></term><listitem><para>
(Since &kde; 3.2) Defines the preference-ordered set of base directories to
search for data files in addition to the <filename
class="directory">$<envar>XDG_DATA_HOME</envar></filename> base
directory. Default is
<literal>/usr/local/share/:/usr/share/</literal></para>

<para>&kde; adds locations from $<envar>TDEDIRS</envar> and profiles
as well.  Used for <literal role="extension">.desktop</literal> and
<literal role="extension">.directory</literal> menu files. <literal
role="extension">.desktop</literal> files under <filename
class="directory">$<envar>XDG_DATA_DIRS</envar>/applications</filename>. 
<literal
role="extension">.directory</literal> files under
$XDG_DATA_DIRS/desktop-directories
</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>XDG_CONFIG_HOME</envar></term><listitem><para>
(&kde; 3.2) - Defines the base directory relative to which user
specific configuration files should be stored. Default is
<filename class="directory">$<envar>HOME</envar>/.config</filename>.</para>
</listitem>
</varlistentry>

<varlistentry><term>$<envar>XDG_CONFIG_DIRS</envar></term><listitem><para>
(&kde; 3.2) - Defines the preference-ordered set of base directories
to search for configuration files in addition to the $<envar>XDG_CONFIG_HOME</envar>
base directory. The default is <filename class="directory">/etc/xdg</filename> &kde; adds locations from
$<envar>TDEDIRS</envar> and profiles as well. Used by <literal role="extension">.menu</literal> descriptions in
<filename class="directory">$<envar>XDG_CONFIG_DIRS</envar>/menus</filename>.
</para>
</listitem>
</varlistentry>
</variablelist>

</sect1>

<sect1 id="the-tdeinit-mystery">
<title>The tdeinit Mystery</title>

<!-- FIXME: Add more words. Fix markup -->

<para><command>tdeinit</command> is used to start all other &kde;
programs. <command>tdeinit</command> can start normal binary program f iles
as well as <command>tdeinit</command> loadable modules
(<acronym>KLM</acronym>s).  <acronym>KLM</acronym>s work just like binary
program files but can be started more efficiently.  <acronym>KLM</acronym>s
live in <filename
class="directory">$<envar>TDEDIR</envar>/lib/trinity</filename></para>

<para>The drawback is that programs started this way appear as
<computeroutput><command>tdeinit</command></computeroutput> in the
output of <command>top</command> and <command>ps</command>. Use
<command>top <option>-c</option></command> or <command>ps
<option>aux</option></command> to see the actual program name:</para>

<screen>
<prompt>%</prompt> <userinput><command>ps aux | grep bastian</command></userinput>
<computeroutput>
bastian  26061  0.0  2.2 24284 11492 ?       S    21:27   0:00 tdeinit: Running...
bastian  26064  0.0  2.2 24036 11524 ?       S    21:27   0:00 tdeinit: dcopserver
bastian  26066  0.1  2.5 26056 12988 ?       S    21:27   0:00 tdeinit: klauncher
bastian  26069  0.4  3.2 27356 16744 ?       S    21:27   0:00 tdeinit: kded
bastian  26161  0.2  2.7 25344 14096 ?       S    21:27   0:00 tdeinit: ksmserver
bastian  26179  1.1  3.4 29716 17812 ?       S    21:27   0:00 tdeinit: kicker
bastian  26192  0.4  3.0 26776 15452 ?       S    21:27   0:00 tdeinit: klipper
bastian  26195  1.0  3.5 29200 18368 ?       S    21:27   0:00 tdeinit: kdesktop
</computeroutput>
</screen>
<para>As you might have noticed, this has another side effect, making it
difficult to kill a process that is causing trouble:</para>

<screen><prompt>%</prompt> <userinput><command>killall kdesktop</command></userinput>
<computeroutput>kdesktop: no process killed</computeroutput></screen>

<para>You might be tempted to try <userinput><command>killall
tdeinit</command></userinput>, but killing all tdeinit processes will have
the effect of shutting down all of &kde;. In effect, total
destruction!</para>

<para>There are two simple solutions to this:</para>

<screen><prompt>%</prompt> <userinput><command>kdekillall kdesktop</command></userinput>
or good old
<prompt>%</prompt> <userinput><command>kill 26195</command></userinput></screen>
<para><command>kdekillall</command> is part of the &kde; <acronym>SDK</acronym>
package.</para>

</sect1>

</chapter>

<chapter id="customizing-kde">
<title>Customizing &kde;</title>


<sect1 id="desktop-icons">
<title>Desktop Icons</title>

<para>&kde; uses several types of icons:</para>
<itemizedlist>
<listitem><para>Documents</para>
</listitem>
<listitem><para>Links to Websites (using <literal role="extension">.desktop</literal> file)</para>
</listitem>
<listitem><para>Links to Applications (using <literal role="extension">.desktop</literal> file)</para>
</listitem>
<listitem><para>Devices - Disks, Partitions &amp; Peripherals:
<itemizedlist>
<listitem><para>Explicit using <literal role="extension">.desktop</literal> file</para>
</listitem>
<listitem><para>Automatic via devices:// io-slave</para>
</listitem>
</itemizedlist>
</para>
</listitem>
<listitem><para>Vendor-specific (&eg; &SuSE;'s My Computer)</para>
</listitem>
</itemizedlist>

<sect2 id="desktop-icons-websites">
<title>Websites</title>
<para>
Links to Websites using <literal role="extension">.desktop</literal>
file: <menuchoice><guimenu>Create
New</guimenu><guisubmenu>File</guisubmenu><guimenuitem>Link to
Location (URL)</guimenuitem></menuchoice>. Change Icon using
<guilabel>Properties</guilabel> dialogs.  The resulting <literal
role="extension">.desktop</literal> file:
<programlisting>
[Desktop Entry]
Encoding=UTF-8
Icon=/opt/trinity/share/apps/kdesktop/pics/ksslogo.png
Type=Link
URL=http://www.kde.org/
</programlisting>
</para>
</sect2>

<sect2 id="desktop-icons-applications">
<title>Applications</title>

<para>Links to Applications using <literal
role="extension">.desktop</literal> file: <menuchoice><guimenu>Create
New</guimenu><guisubmenu>File</guisubmenu><guimenuitem>Link to
Application</guimenuitem></menuchoice>. You must provide details
yourself. Drag from &kde; Menu: Either copy or link (creates symlink),
much easier</para>

<!-- Perhaps legacy and translated should be the other way around, but -->
<!-- this is how it appears in Waldo's presentation. Need to check -->
<!-- this -->

<programlisting>
[Desktop Entry]<co id="boilerplate"/>
Encoding=UTF-8
GenericName=IRC Client<co id="generic-desc"/>
GenericName[af]=Irc Kli&euml;t
GenericName[de]=IRC Programm
...
GenericName[zu]=Umthengi we IRC<co id="legacy"/>
SwallowExec=<co id="translated"/>
Name=KSirc
Name[af]=Ksirc
Name[de]=KSirc
...
</programlisting>

<calloutlist>
<callout arearefs="boilerplate"><para>Boiler plate</para>
</callout>
<callout arearefs="generic-desc"><para>Translated generic description, not used on desktop</para>
</callout>
<callout arearefs="legacy"><para>Legacy, can be removed</para>
</callout>
<callout arearefs="translated"><para>Translated name as it appears on desktop</para>
</callout>
</calloutlist>

<para>Desktop Icons</para>
<programlisting>
...
Name[zu]=Ksirc
MimeType=<co id="co-mimetype"/>
Exec=ksirc %i %m<co id="co-exec"/>
Icon=ksirc<co id="co-icon"/>
TerminalOptions=<co id="co-terminaloptions"/>
Path=<co id="co-path"/>
Type=Application<co id="co-type"/>
Terminal=0<co id="co-terminal"/>
X-KDE-StartupNotify=true<co id="co-x-kde-startupnotify"/>
X-DCOP-ServiceType=Multi<co id="co-x-dcop-servicetype"/>
Categories=Qt;KDE;Network<co id="co-categories"/>
</programlisting>

<calloutlist>
<callout arearefs="co-mimetype"><para>Supported &MIME; types, not used on
desktop</para>
</callout>
<callout arearefs="co-exec"><para>The command line to execute</para>
</callout>
<callout arearefs="co-icon"><para>The icon, from icon theme or full path</para>
</callout>
<callout arearefs="co-terminaloptions"><para>Only used if terminal is
needed</para>
</callout>
<callout arearefs="co-path"><para>Working directory for command</para>
</callout>
<callout arearefs="co-type"><para>More boiler plate</para>
</callout>
<callout arearefs="co-terminal"><para>Use true if terminal is needed,
text application</para>
</callout>
<callout arearefs="co-x-kde-startupnotify"><para>Show bouncy cursor,
disable if it doesn't work.</para>
</callout>
<callout arearefs="co-x-dcop-servicetype"><para>Has app started ok?
Remove if it doesn't work</para>
</callout>
<callout arearefs="co-categories"><para>Categories for &kde; Menu, not
used on desktop</para>
</callout>
</calloutlist>



</sect2>

<sect2 id="desktop-icons-exec">
<title>The <varname>Exec</varname> option in <literal
role="extension">.desktop</literal> files</title>

<para>Following the command, you can have several place holders which will
be replaced with the actual values when the actual program is run:
<variablelist>
<varlistentry>
<term>%f</term> <listitem><para>A single file name; used when dropping
file on icon, or with file associations.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%F</term>
<listitem><para>A list of files; use for applications that can
open several local files at once.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%u</term>
<listitem><para>A single &URL;: if the app can
handle &eg; &FTP; or &HTTP; &URL;s itself, otherwise &kde;.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%U</term>
<listitem><para>A list of
&URL;s; will download the file first and pass a local file to the app
(!!)</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%d</term>
<listitem><para>The folder of the file to open; useful if app needs to
have file in current working directory.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%D</term>
<listitem><para>A list of folders, not very practical.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%i</term> 
<listitem><para>The icon; <option>--icon</option> option; &kde; app
will use icon from <varname>Icon</varname>= line in taskbar.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%m</term>
<listitem><para>The mini-icon; legacy.</para>
</listitem>
</varlistentry>

<varlistentry>
<term>%c</term> 
<listitem><para>The caption; <option>--caption</option> option; &kde;
app will use name from <varname>Name</varname>= line in
taskbar.</para>
</listitem>
</varlistentry>

</variablelist>
</para>

<informalexample>
<para>Examples:
<segmentedlist>
<segtitle><varname>Exec</varname> line</segtitle>
<segtitle>Command executed</segtitle>
<seglistitem><seg>ksirc %i</seg><seg><command>ksirc --icon ksirc</command></seg>
</seglistitem>
<seglistitem><seg>cd %d; kedit $(basename %f)</seg><seg><command>cd /tmp; kedit file.txt</command></seg>
</seglistitem>
</segmentedlist>
</para>
</informalexample>

<!--Dont' know what this refers to: -->
<!--See What's This (Shift-F1) in Properties Dialog-->

</sect2>

<sect2 id="desktop-icons-devices">
<title>Devices</title>
<para>
Links to Devices using <literal role="extension">.desktop</literal> file:
o Create New -> Device

</para>
</sect2>

<sect2 id="where-to-define">
<title>Where to Define</title>

<para>Many places to define Desktop Icons:
<itemizedlist>

<listitem><para><filename class="directory">~/Desktop</filename>:
copied from <filename
class="directory">/etc/skel/Desktop</filename></para></listitem>

<listitem><para><filename
class="directory">$<envar>TDEDIR</envar>/apps/kdesktop/Desktop</filename>
(merged)</para></listitem>

<listitem><para><filename
class="directory">$<envar>TDEDIR</envar>/apps/kdesktop/DesktopLinks</filename>
(copied)</para></listitem>

<listitem><para>Device Icons (dynamically
merged)</para></listitem>

<listitem><para>Distribution Specific SUSE Linux copies certain icons
in starttde.theme from <filename
class="directory">/opt/trinity/share/config/SuSE/default/</filename></para></listitem>

</itemizedlist>
</para>
</sect2>
</sect1>

<sect1 id="kde-menu">
<title>&kde; Menu</title>

<sect2 id="how-it-works">
<title>How it Works</title>

<para>In &kde; 3.2 a common menu format is introduced at
<ulink
url="http://freedesktop.org/Standards/menu-spec/">http://freedesktop.org/Standards/menu-spec/</ulink></para>
<para>Before &kde; 3.2:
<itemizedlist>

<listitem><para>Directory structure under <filename
class="directory">share/applnk</filename></para></listitem>

<listitem><para>Directory structure represents menu
structure</para></listitem>

<listitem><para>Each <literal role="extension">.desktop</literal> file
represents a single application</para></listitem>

</itemizedlist>
</para>

<para>It was difficult to rearrange the structure in &kde; 3.2 so the
new menu format:
<itemizedlist>
<listitem><para>Defines structure in a single .menu file</para></listitem>
<listitem><para>Is based on categories</para></listitem>
<listitem><para>is shared between <acronym>GNOME</acronym> and &kde;</para></listitem>
<listitem><para>Supports applnk style menus as well</para></listitem>
</itemizedlist>
</para>

<informalexample>
<para>Example from <filename>kde-applications.menu</filename>:
<programlisting>
<markup>
	&lt;Menu&gt;
	    &lt;Name&gt;Office&lt;/Name&gt;
	    &lt;Directory&gt;suse-office.directory&lt;/Directory&gt;
	    &lt;Include&gt;
	        &lt;Filename&gt;Acrobat Reader.desktop&lt;/Filename&gt;
	        &lt;Filename&gt;kde-kpresenter.desktop&lt;/Filename&gt;
	        &lt;Filename&gt;kde-kword.desktop&lt;/Filename&gt;
	    &lt;/Include&gt;
	&lt;Menu&gt;
</markup>
</programlisting>
</para>
<para>Menu entry with 3 applications:
<itemizedlist>

<listitem><para><filename>/usr/share/applications/Acrobat
Reader.desktop</filename></para></listitem>

<listitem><para><filename>/opt/trinity/share/applications/kde/kpresenter.desktop</filename></para></listitem>

<listitem><para><filename>/opt/trinity/share/applications/kde/kword.desktop</filename></para></listitem>

</itemizedlist>
</para>
</informalexample>
</sect2>

<sect2 id="stored-where">
<title>Stored Where?</title>

<para><literal role="extension">.menu</literal> files describing the
menu structure. The files are stored in <filename
class="directory">$<envar>TDEDIR</envar>/etc/xdg/menus</filename> and
<filename class="directory">/etc/xdg/menus</filename>. These store the
system-wide menu structure and are controlled by
$<envar>XDG_CONFIG_DIRS</envar>. <filename
class="directory">$<envar>HOME</envar>/.config/menus</filename> stores
user-specific changes to the menu structure and is controlled by
$<envar>XDG_CONFIG_HOME</envar>. For more information, see <ulink
url="http://www.freedesktop.org/Standards/basedir-spec">http://www.freedesktop.org/Standards/basedir-spec</ulink>.</para>

<para><literal role="extension">.desktop</literal> files describe the
applications and are stored in: <filename
class="directory">$<envar>TDEDIR</envar>/share/applications</filename>,
<filename class="directory">/usr/share/applications</filename>,
<filename
class="directory">/usr/local/share/applications</filename>. These are
the system-wide application <literal
role="extension">.desktop</literal> files which are controlled by
$<envar>XDG_DATA_DIRS</envar>.</para>

<para><filename
class="directory">$<envar>HOME</envar>/.local/applications</filename>
contains user-specific <literal role="extension">.desktop</literal>
files and user-specific changes. It is controlled by
$<envar>XDG_DATA_HOME</envar>. For more information, see <ulink
url="http://www.freedesktop.org/Standards/basedir-spec">http://www.freedesktop.org/Standards/basedir-spec</ulink></para>


<para><literal role="extension">.directory</literal> files describing
the sub-menus are stored in: <filename
class="directory">$<envar>TDEDIR</envar>/share/desktop-directories</filename>,
<filename class="directory">/usr/share/desktop-directories</filename>, <filename
class="directory">/usr/local/share/desktop-directories</filename>.
These are the system-wide menu <literal
role="extension">.directory</literal> files, controlled by
$<envar>XDG_DATA_DIRS</envar>. The user-specific changes are stored in <filename class="directory">$<envar>HOME</envar>/.local/desktop-directories</filename>.
These are controlled by $<envar>XDG_DATA_HOME</envar>. For more
information, see <ulink url="http://www.freedesktop.org/Standards/basedir-spec">http://www.freedesktop.org/Standards/basedir-spec</ulink></para>

<informalexample>
<para>Example from <filename>kde-applications.menu</filename>:
<programlisting>
<markup>
             &lt;Menu&gt;
                        &lt;Name&gt;Art&lt;/Name&gt;
                        &lt;Directory&gt;suse-edutainment-art.directory&lt;/Directory&gt;
                        &lt;Include&gt;
                                &lt;Category&gt;X-SuSE-Art&lt;/Category&gt;
                        &lt;/Include&gt;
                &lt;/Menu&gt;
</markup>
</programlisting>
</para>

<para><literal>Art</literal> is the internal name for this
menu. <filename>suse-edutainment-art.directory</filename> defines the
name and icon for this menu, and the menu includes all applications
that have <literal>X-SuSE-Art</literal> listed as a category, &eg;:
<programlisting>
Categories=Qt;KDE;Education;X-SuSE-Art
</programlisting></para>

<para><filename>suse-edutainment-art.directory</filename> defines the
name and icon for this menu:
<programlisting>
[Desktop Entry]
Name=Art and Culture
Icon=kcmsystem
</programlisting>
</para>
</informalexample>
</sect2>

<sect2 id="common-pitfalls">
<title>Common Pitfalls</title>

<para>Applications <emphasis>not</emphasis> in the menu do
<emphasis>not</emphasis> exist with regard to other applications or
file associations: If you remove an application from the menu, &kde; assumes you don't want to use it.</para>

<para>When applications are unwanted in the menu, either place them in
<filename>.hidden</filename> menu or a dedicated menu with 
<programlisting>
NoDisplay=true
</programlisting> in the <literal
role="extension">.directory</literal> file</para>
</sect2>

<sect2 id="essential-menus">
<title>Essential Menus</title>

<para><filename
class="directory">$<envar>TDEDIR</envar>/etc/xdg/menus/applications-merged/</filename>
contains <filename>kde-essential.menu</filename> which includes some
essential menus that are normally not shown in the &kde; menu itself:
<itemizedlist>
<listitem><para>Control Center has a hidden Settings menu whose
contents are defined by <filename>kde-settings.menu</filename> and
whose icon and name are defined by <filename>kde-settings.directory</filename></para>
</listitem>
<listitem><para>Info Center has a hidden Information menu whose
contents are defined by <filename>kde-information.menu</filename> and
whose icon and  name are  defined by <filename>kde-information.directory</filename>.</para>
</listitem>

<listitem><para>Screensavers contains a hidden System/Screensavers menu,
whose contents are defined by
<filename>kde-screensavers.menu</filename> and whose icon and  name
are defined by
<filename>kde-system-screensavers.directory</filename>.
<filename>$<envar>TDEDIR</envar>/share/desktop-directories/kde-system-screensavers.directory</filename>
contains:
<programlisting>
NoDisplay=true
</programlisting>
</para>
</listitem>
</itemizedlist></para>
</sect2>

<sect2 id="old-style-menus">
<title>Old-Style Menus</title>

<para>&kde; continues to support old-style menus that are defined by
the directory structures in <filename
class="directory">$<envar>TDEDIR</envar>/share/applnk</filename>
(system wide) and <filename
class="directory">$<envar>HOME</envar>/.kde/share/applnk</filename>
(user specific). This is observed unless the <literal role="extension">.desktop</literal> file has a  <varname>Categories</varname>= line. In that case the categories determine the location in the menu.</para>
</sect2>

<sect2 id="ksycoca">
<title><application>KSycoca</application></title>
<para><application>KSycoca</application> caches menu structure and
information about all available applications. You can rebuild the
database with
<userinput><command>kbuildsycoca</command></userinput>. The database
which is built lives in <filename
class="directory">/var/tmp/kdecache-${<envar>USER</envar>}/ksycoca</filename>.
It is automatically updated by <application>KDED</application>,
checked during &kde; login, and <application>KDED</application>
watches for changes while logged in.</para>

<para>To disable watching for changes (since it may hurt over NFS) add
the following to <filename>kdedrc</filename>:
<programlisting>
[General]
CheckSycoca=false
</programlisting>
</para>

<para>To force regeneration, run <userinput><command>touch $<envar>TDEDIR</envar>/share/services/update_ksycoca</command></userinput>.</para>

</sect2>

<sect2 id="kmenuedit">
<title>&kmenuedit;</title>

<para>&kmenuedit; is aimed at a single user setup. Changes to menu
structure are saved to
<filename>~/.config/menus/applications-kmenuedit.menu</filename>,
changes to applications are saved in <filename
class="directory">~/.local/share/applications/</filename> and changes
to sub-menus (icon, name) are saved in <filename
class="directory">~/.local/share/desktop-directories/</filename>. The
KIOSK Admin Tool uses &kmenuedit; and copies the above changes to
profile- or system-wide locations.
</para>

</sect2>

</sect1>

<!-- This section might be redundant. If it isn't, it needs some screenies -->
<sect1 id="kde-panel">
<title>&kde; Panel</title>

<para>The &kde; panel is also known as &kicker;. It is modular and
consists of the following components:
<itemizedlist>
<listitem><para>Applets</para></listitem>
<listitem><para>Application buttons</para></listitem>
<listitem><para>Special Buttons</para></listitem>
</itemizedlist>
</para>

<para>By default, the panel contains the following applets:
<itemizedlist>
<listitem><para>Pager - shows the virtual desktops</para></listitem>
<listitem><para>Taskbar</para></listitem>
<listitem><para>System Tray</para></listitem>
<listitem><para>Clock</para></listitem>
</itemizedlist>
and the following special buttons:
<itemizedlist>
<listitem><para>&kde; menu</para></listitem>
<listitem><para>Desktop Button</para></listitem>
</itemizedlist>
</para>

<para>Various application buttons are also added, space permitting:
<itemizedlist>
<listitem><para>Home Button</para></listitem>
<listitem><para>Browser Button</para></listitem>
<listitem><para>KMail Button</para></listitem>
</itemizedlist>
</para>
</sect1>

<sect1 id="file-associations">
<title>File Associations</title>

<para>File associations associate a file type with an application or
applications. The type of a file is established by determining its
&MIME; type. &MIME; types known by &kde; are stored in <filename
class="directory">$<envar>TDEDIR</envar>/share/mimelnk</filename> and
each application's <literal role="extension">.desktop</literal> file
contains a list of &MIME; types supported by that application.</para>

<informalexample>
<para><filename>kview.desktop</filename>:
<programlisting>
MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;
image/x-bmp;image/png;image/x-ico;image/x-portable-bitmap;
image/x-portable-pixmap;image/x-portable-greymap;
image/tiff;image/jp2
</programlisting>
</para>

<para><filename>kuickshow.desktop</filename>:
<programlisting>
MimeType=image/gif;image/x-xpm;image/x-xbm;image/jpeg;
image/png;image/tiff;image/x-bmp;image/x-psd;image/x-eim;
image/x-portable-bitmap;image/x-portable-pixmap;
image/x-portable-greymap
</programlisting>
</para>

<para>Both can open image/gif Which one is used to open a <literal role="extension">.gif</literal> file?</para>

<para>The application with highest
preference!. <filename>kview.desktop</filename> contains
<programlisting>
InitialPreference=3
</programlisting>
whereas <filename>kuickshow.desktop</filename> contains
<programlisting>
InitialPreference=6
</programlisting>
Therefore, &kuickshow; will be used to open <literal
role="extension">.gif</literal> files.
</para>

<para>How can we make &kview;  default?</para>

<para>A user can change file association in the
&kcontrolcenter;. These changes are stored in
<filename>$<envar>HOME</envar>/.kde/share/config/profilerc</filename>.
To use the same settings for multiple users, store these settings in
user profile directory or the global &kde; config directory to use as
default for multiple users.</para>

</informalexample>

</sect1>

</chapter>

<chapter id="locking-down-kde">
<title>Locking Down &kde;</title>

<sect1 id="how-it-works-the-basics">
<title>How It Works - The Basics</title>

<para>&kde;'s lock down features are centered around the following
options:</para>

<itemizedlist>
<listitem><para><link linkend="immutable-configuration-options">Make
configuration options immutable</link></para></listitem>
<listitem><para><link linkend="action-restrictions">Restriction of specific
actions</link></para></listitem>
<listitem><para><link linkend="url-restrictions">Restrict access to certain
&URL;s</link></para></listitem>
<listitem><para><link linkend="configuration-modules">Restrict access to
certain configuration modules</link></para></listitem>
</itemizedlist>

</sect1>

<sect1 id="immutable-configuration-options">
<title>Immutable Configuration Options</title>
<subtitle>Locking Down &kde;</subtitle>

<para>Immutable options allow system administrator to provide default
settings that can not be changed by the user.</para>

<para>Pre-existing configuration options of the user will be ignored once a
configuration option is made immutable.</para>

<para>Options can be controlled either on a per entry basis, per group of
entries or on a file by file basis.</para>

<para>If a file or group is immutable, all configuration options for that
file or group are immutable, even those options for which the system
administrator has no default provided.</para>

<note><para>The support in applications for immutable options may vary from
application to application. Although the user will not be able to make
permanent changes to immutable configuration options, the user may still be
presented with an user interface option to make such change.</para></note>

</sect1>

<sect1 id="action-restrictions">
<title>Action Restrictions</title>

<para>&kde; applications are built around the action-concept. Actions can be
activated in various ways, typically via the menu-bar, one of the toolbars
or a keyboard shortcut. <action>Save Document</action> is an example of an
action.  If you know the internal action name it is possible to restrict an
action. When an action is restricted it will no longer appear in the
menu-bar or toolbar. The internal name for the <action>Save
Document</action> action is <option>action/file_save</option>.  The lock
down framework also provides a set of more abstract restrictions which can
be used to disable functionality not covered by a single action. An example
is the <option>shell_access</option> restriction which disables all
functionality that would offer the user access to a &UNIX; shell.</para>

<example>
<title>Restrict User Access to Shells</title>

<para>In order to prevent the user access to a command shell we can restrict
the <option>shell_access</option> action by adding the following to
<filename>kdeglobals</filename>:
</para> 

<screen>[KDE Action Restrictions]
shell_access=false</screen>

<para>Since this affects the &kde; menu and the available applications, we
must force an update of the sycoca database:</para>

<screen><userinput><command>touch</command> <filename>$<envar>TDEDIR</envar>/share/services/update_ksycoca</filename></userinput></screen>

<para>Now re-login to &kde; and check the following points:</para>

<itemizedlist>
<listitem><para>The &kmenu;</para></listitem>
<listitem><para>In &konqueror;,
<menuchoice><guimenu>Tools</guimenu><guimenuitem>Open
Terminal</guimenuitem></menuchoice></para></listitem>
<listitem><para>The <keycombo
action="simul">&Alt;<keycap>F2</keycap></keycombo> run
command</para></listitem>
</itemizedlist>
</example>
<para>Full documentation about available actions can be found on <ulink
url="http://www.kde.org/areas/sysadmin/">http://www.kde.org/areas/sysadmin/</ulink>.</para>

<para>A few of the more interesting actions are listed below:</para>

<variablelist>
<varlistentry>
<term><option>action/options_configure</option></term>
<listitem><para>The <guimenuitem>Configure</guimenuitem> option form the
<guimenu>Settings</guimenu> menu</para></listitem>
</varlistentry>
<varlistentry>
<term><option>action/help_report_bug</option></term>
<listitem><para>The <guimenuitem>Report Bug</guimenuitem> option from the
<guimenu>Help</guimenu> menu.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>action/kdesktop_rmb</option></term>
<listitem><para>&RMB; mouse button menu on the desktop.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>action/kicker_rmb</option></term>
<listitem><para>&RMB; mouse button menu on the panel.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>user/root</option></term>
<listitem><para>Hide all actions or applications that require <systemitem
class="username">root</systemitem> access.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>shell_access</option></term>
<listitem><para>Hides all actions or applications that provide shell
access.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>print/system</option></term>
<listitem><para>Disables the option to select the printing system
(backend).</para></listitem>
</varlistentry>
<varlistentry>
<term><option>lock_screen</option></term>
<listitem><para>Whether the user will be able to lock the
screen</para></listitem>
</varlistentry>
<varlistentry>
<term><option>start_new_session</option></term>
<listitem><para>Whether the user may start a second X session (see also
&kdm;)</para></listitem>
</varlistentry>
<varlistentry>
<term><option>opengl_screensavers</option></term>
<listitem><para>Whether OpenGL screensavers are allowed to be
used.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>manipulatescreen_screensavers</option></term>
<listitem><para>Permit screensavers that do not hide the entire
screen</para></listitem>
</varlistentry>
</variablelist>

</sect1>

<sect1 id="url-restrictions">
<title>&URL; Restrictions</title>

<para>There are three types of restrictions that can be applied to
&URL;s:</para>

<variablelist>
<varlistentry>
<term>list</term>
<listitem><para>To control whether a directory listing is
allowed.</para></listitem>
</varlistentry>
<varlistentry>
<term>open</term>
<listitem><para>To control whether certain &URL;s can be
opened</para></listitem>
</varlistentry>
<varlistentry>
<term>Redirect</term>
<listitem><para>To control whether one &URL; can open another &URL;, either
automatically or via a hyperlink.</para></listitem>
</varlistentry>
</variablelist>

<para>Rules are checked in the order in which they are defined.  The last
rule that is applicable to a &URL; defines whether the &URL; may be
accessed.</para>

<para>The following rules disable opening http and https &URL;s outside
<systemitem class="domainname">.ourcompany.com</systemitem>:</para>

<screenco><areaspec>
<area id="url_commas" coords="3"/>
<area id="url_rule1" coords="3"/>
<area id="url_rule2" coords="4"/>
</areaspec>
<screen>[KDE URL Restrictions]
rule_count=2
rule_1=open,,,,http,,,false
rule_2=open,,,,http,*.ourcompany.com,,true</screen></screenco>

<calloutlist>
<callout arearefs="url_commas">
<para>The first four commas skip over the selection criteria with respect to
the originating &URL;. This part is only needed with redirect type
rules.</para> 
</callout>
<callout arearefs="url_rule1"><para><option>rule_1</option> forbids the
opening of any http or https &URL;</para></callout>
<callout arearefs="url_rule2"><para><option>rule_2</option> allows the
opening of any http and https &URL; in the <systemitem
class="domainname">.ourcompany.com</systemitem> domain.  Note the wildcard
<token>*</token> is only allowed at the start of a domain.</para></callout>
</calloutlist>

<para>The following rules makes that the user can no longer browse
directories on the local file system that are outside his
$<envar>HOME</envar> directory:</para>

<screenco><areaspec>
<area id="home_rule1" coords="3"/>
<area id="home_rule2" coords="4"/>
</areaspec>
<screen>[KDE URL Restrictions]
rule_count=2
rule_1=list,,,,file,,,false
rule_2=list,,,,file,,$HOME,true</screen></screenco>

<calloutlist>
<callout arearefs="home_rule1"><para><option>rule_1</option> forbids the
listing of any local directory</para></callout>
<callout arearefs="home_rule2"><para><option>rule_2</option> allows listing
directories under the users own $<envar>HOME</envar>
directory.</para></callout>
</calloutlist>

<para>$<envar>HOME</envar> and $<envar>TMP</envar> are special values to
indicate the users home directory and the &kde; temporary directory of the
user, &eg; <filename class="directory">/tmp/kde-bastian</filename></para>

<para>The following rules makes that the user can no longer open local files
that are outside his $<envar>HOME</envar> directory:</para>

<screenco><areaspec>
<area id="local_rule1" coords="3"/>
<area id="local_rule2" coords="4"/>
<area id="local_rule3" coords="5"/>
</areaspec>
<screen>[KDE URL Restrictions]
rule_count=3
rule_1=open,,,,file,,,false
rule_2=open,,,,file,,$HOME,true
rule_3=open,,,,file,,$TMP,true</screen></screenco>

<calloutlist>
<callout arearefs="local_rule1"><para><option>rule_1</option> forbids the
opening of any local file</para></callout>
<callout arearefs="local_rule2"><para><option>rule_2</option> allows opening
files under the users own $<envar>HOME</envar> directory.</para></callout>
<callout arearefs="local_rule3"><para><option>rule_3</option> allows opening
files in the &kde; temporary directory of the user.  This is needed by
certain &kde; applications that first download a file or document to the
temporary directory and then open it in an application.</para></callout>
</calloutlist>


<para>The redirection option controls whether documents from a certain
location can refer, either automatically or manually via a hyperlink, to a
certain other location.  A set of default rules is present as a general
security measure. For example documents located on the Internet may not
refer to locally stored documents.</para>

<para>For example, if we want to give the intranet-server <systemitem
class="systemname">www.mycompany.com</systemitem> the possibility to refer
to local files we could add the following rule:</para>

<screen>[KDE URL Restrictions]
rule_count=1
rule_1=redirect,http,www.mycompany.com,,file,,,true</screen>

<para>Instead of listing a protocol by name, it is also possible to specify
a whole group of protocols. For that the following groups have been
defined:</para>

<variablelist>
<varlistentry>
<term>:local</term>
<listitem><para>Protocols that access locally stored information, examples
are file:/, man:/, fonts:/, floppy:/</para></listitem>
</varlistentry>
<varlistentry>
<term>:internet</term>
<listitem><para>Common internet protocols such as http and
ftp</para></listitem>
</varlistentry>
</variablelist>

<para>Information about protocols is stored in <literal
role="extension">*.protocol</literal> files stored in
<filename
class="directory">$<envar>TDEDIR</envar>/share/services</filename>.</para>

<para>The <option>Class</option>= entry defines the group a protocol is part
of:
<userinput><command>grep</command> <option>Class=</option>
<filename>$<envar>TDEDIR</envar>/share/services/*.protocol</filename></userinput></para>

<para>General rules:</para>

<itemizedlist>
<listitem><para>The :local protocols may refer to any other
protocol</para></listitem>
<listitem><para>It's always allowed to refer to an :internet
protocol</para></listitem>
<listitem><para>Not all protocols are part of a group, fish:/ for
example.</para></listitem>
</itemizedlist>

</sect1>

<sect1 id="configuration-modules">
<title>Configuration Modules</title>

<para>&kde; has configuration modules to configure various aspects of the
&kde; environment. Configuration modules appear in the Control Center, in the
Configuration dialog of an application or in both.</para>

<informalexample>
<para>The proxy configuration module appears in the Control Center but also
as part of the <guilabel>Configure Konqueror</guilabel> dialog in
&konqueror;</para>

<para>Individual configuration modules can be started with
<command>kcmshell</command> <replaceable>module</replaceable></para>

<para>To start the Proxy module use:</para>
<itemizedlist>
<listitem><para><command>kcmshell</command>
<filename>kde-proxy.desktop</filename></para></listitem>
<listitem><para><command>kcmshell</command> proxy</para></listitem>
</itemizedlist>

<para><note><para>Not all applications use configuration modules, often the
configuration dialog is an integral part of the application
itself.</para></note></para>
</informalexample>

<para>All configuration modules are strictly speaking part of the &kde;
menu.</para>

<itemizedlist>
<listitem>
<para>The modules that are visible in the Control Center normally
have a <literal role="extension">.desktop</literal> file in <filename
class="directory">$<envar>TDEDIR</envar>/share/applications/kde</filename>
and are sorted under the hidden <guimenu>Settings-Modules</guimenu> menu by
the <filename>kde-settings.menu</filename>, included from 
<filename>kde-essential.menu</filename></para>
<screen><userinput><command>kbuildsycoca</command> <option>--menutest</option> 2&gt; /dev/null | <command>grep</command> Settings-Modules</userinput></screen>
</listitem>
<listitem>
<para>Application specific modules normally have a <literal role="extension">.desktop</literal> file under
<filename>$<envar>TDEDIR</envar>/share/applnk/.hidden</filename> which
corresponds to the hidden .hidden menu, included as a result of
<markup>&lt;KDELegacyDirs/&gt;</markup></para>
<screen><userinput><command>kbuildsycoca</command> <option>--menutest</option> 2&gt; /dev/null | <command>grep</command> .hidden</userinput></screen>
</listitem>
<listitem><para>In &kde; 3.3 it is possible to edit the Control Center with
<application>kcontroledit</application>.
<application>kcontroledit</application> works just like
<application>kmenuedit</application>, changes for current user only. Use
<application>kiosktool</application> to make changes for
everyone.</para></listitem> 
</itemizedlist>

<para>Individual configuration modules can be disables by adding the
following to <filename>kdeglobals</filename>:</para>

<screen>[KDE Control Module Restrictions]
<replaceable>module-id</replaceable>=false</screen>
<para>For example, to disable the proxy module use</para>
<screen>[KDE Control Module Restrictions]
kde-proxy.desktop=false</screen>
<para>Check the Control Center and the <guilabel>Configure
Konqueror</guilabel> dialog if the proxy configuration is still
there.</para>

</sect1>
<!-- 
<sect1 id="making-it-work">
<title>Making it Work</title>

Making It Work
KDE 3.2: Set $TDEDIRS from starttde script
Distribute profiles to all clients

</para>
</sect1>
-->
</chapter>

<chapter id="the-lazy-admin">
<title>The Lazy Admin</title>

<!-- This section appears to need quite a lot of additional words to -->
<!-- make sense. Perhaps it would be better to comment it out if it -->
<!-- can't be updated before the next release (Phil) -->
<!-- FIXME: Commented it out until it's got some more content fleshing it -->
<!-- out (Lauri)

<sect1 id="lazy-admin-overview">
<title>Overview</title>

<para>
The Lazy Admin
Overview
Deployment
	How to get &kde; available on many clients
Remote Desktop Sharing
Take a look at someone else desktop
DCOP
	The DCOP command line tool makes it possible to control &kde; applications from the command line
KDialog
	A versatile tool to use standard &kde; dialogs in your own scripts



Deployment
Thin Clients
Installing Software
= AutoYaST
= KickStart
Maintaining Settings
= /etc/kderc, other settings
= Use rsync to copy files around
= Shared filesystem such as NFS
o store profiles themselves on NFS



http://www.suse.de/~nashif/autoinstall/index.html

</para>
</sect1>
-->
<sect1 id="remote-desktop-sharing">
<title>Remote Desktop Sharing</title>

<para>Remote desktop sharing allows remote users to view and optionally
control the desktop of the current user.  The remote user needs to be sent
an invitation, and it is possible to create a password protected standing
invitation. This is ideal for tech support teams or administrators to gain
access to users desktops in order to troubleshoot or remedy a problem or
guide a user through a procedure.</para>

<para>Remote desktop sharing involves two applications: &krfb; (&kde; remote
frame buffer, a VNC server) and &krdc; (&kde; remote desktop connection; a
VNC client.)</para>

<para>&krfb; can be used by any user to create and manage invitations.
Invitations create a one time password that allows the recipient to connect
to your desktop.  By default it is valid for only one successful connection,
and expires after one hour if not used.</para>

<para>Incoming connections are handled by the kinetd kded module.  You can
use the command <userinput><command>dcop</command> kded kinetd
services</userinput> to see if it is running. &krfb; waits for connections
on port 5900 by default.  When an incoming connection is made, a dialog will
appear to ask for confirmation by the current user.</para>

<!-- TODO: Write a bit more here, with a walk through maybe? -->

</sect1>

<sect1 id="kde-diy">
<title>&kde; DIY - Building Your Own Tools</title>

<sect2 id="dcop">
<title>DCOP</title>

<para>
Desktop COmmunication Protocol, <acronym>DCOP</acronym>, is a lightweight mechanism for inter-process communication.  
<acronym>DCOP</acronym> allows the user to interact with programs that are currently running.
&kde; supplies two programs to utilitize <acronym>DCOP</acronym>: 
<application>dcop</application>, a command-line program, and 
<application>kdcop</application>, a <acronym>GUI</acronym> program.
</para>
<para>
A few notes about using <command>dcop</command>:
</para>

<para>
<itemizedlist>
<listitem>
<para>
<command>dcop</command> [options] [application [object [function [arg1] [arg2] ... ] ] ]
</para>
</listitem>
<listitem>
<para>
Applications that can open more than one window at a time will be listed as 
&lt;application&gt;-<acronym>PID</acronym>
</para>
</listitem>
<listitem>
<para>
All the arguments are case-sensitve.  setFullScreen and setfullscreen are two different functions.
</para>
</listitem>
<listitem>
<para>
The regular expression token * can be used in the application and object arguments.
<screen><prompt>&percnt; </prompt><userinput><command>dcop</command><option> kon*</option></userinput>
konqueror-16006
konsole-8954
</screen>
</para>
</listitem>

</itemizedlist>

</para>

<para>Some example commands and their output are below:
</para>

<informalexample>
<screen><prompt>&percnt; </prompt><userinput><command>dcop</command><option> konsole*</option></userinput>
konsole-8954
</screen>
<para>One &konsole; is running with a <acronym>PID</acronym> of 8954.</para>

<screen><prompt>&percnt; </prompt><userinput><command>dcop</command><option> konsole-8954</option></userinput>
KBookmarkManager-.../share/apps/kfile/bookmarks.xml
KBookmarkManager-.../share/apps/konqueror/bookmarks.xml
KBookmarkNotifier
KDebug
MainApplication-Interface
konsole (default)
konsole-mainwindow#1
ksycoca
session-1
session-2
session-3
session-4
</screen>
<para>Here you see that there are four sessions running.</para>

<screen><prompt>&percnt; </prompt><userinput><command>dcop</command><option> konsole-8954</option><option> konsole</option></userinput>
QCStringList interfaces()
QCStringList functions()
int sessionCount()
QString currentSession()
QString newSession()
QString newSession(QString type)
QString sessionId(int position)
void activateSession(QString sessionId)
void nextSession()
void prevSession()
void moveSessionLeft()
void moveSessionRight()
bool fullScreen()
void setFullScreen(bool on)
ASYNC reparseConfiguration()
</screen>
<para>Here are the options for the main &konsole; program.
</para>

<screen><prompt>&percnt; </prompt><userinput><command>dcop</command><option> konsole-8954</option><option> session-1</option></userinput>
QCStringList interfaces()
QCStringList functions()
bool closeSession()
bool sendSignal(int signal)
void clearHistory()
void renameSession(QString name)
QString sessionName()
int sessionPID()
QString schema()
void setSchema(QString schema)
QString encoding()
void setEncoding(QString encoding)
QString keytab()
void setKeytab(QString keyboard)
QSize size()
void setSize(QSize size)
</screen>
<para>Here are the options for the first session, session-1.</para>

<screen><prompt>&percnt; </prompt><userinput><command>dcop</command><option> konsole-8954</option><option> konsole</option><option> setFullScreen</option><parameter> true</parameter></userinput>
</screen>
<para>This sets &konsole; to full screen.</para>

</informalexample>

<para>
When there is more than one application/object, which one should you use?
 Got a reference?
</para>
<screen><prompt>&percnt; </prompt><userinput><command>echo</command><option> $KONSOLE_DCOP</option></userinput>
DCOPRef(konsole-7547,konsole)

<prompt>&percnt; </prompt><userinput><command>dcop</command><option> $KONSOLE_DCOP</option><option> newSession</option></userinput>
session-6

<prompt>&percnt; </prompt><userinput><command>dcopstart</command><option> konsole</option></userinput>
konsole-9058


#!/bin/sh
konsole=$(dcopstart konsole-script)
session=$(dcop $konsole konsole currentSession)
dcop $konsole $session renameSession Local

session=$(dcop $konsole konsole newSession)
dcop $konsole $session renameSession Remote

session=$(dcop $konsole konsole newSession)
dcop $konsole $session renameSession Code
dcop $konsole $session sendSession 'cd /my/work/directory'

</screen>

</sect2>

<sect2 id="kdialog">
<title>KDialog</title>
<subtitle>&kde; DIY - Building Your Own Tools</subtitle>

<para>You can use &kde; dialogs from your own scripts, to combine the power
of &UNIX; shell scripting with the ease of use of &kde;.</para>

<screen><userinput><command>kdialog</command> <option>--msgbox 'You have new mail!'</option></userinput></screen>

<screen><userinput><command>kdialog</command> <option>--title 'New Mail'</option> <option>--msgbox 'You have new mail!'</option></userinput></screen>

<para>The <application>KDialog</application> part can be replaced via
<option>--caption</option> option</para>

<screen><userinput><command>kdialog</command> <option>--title 'New Mail'</option> <option>--msgbox 'You have new mail!'</option> <option>--dontagain myfile:mykey</option></userinput></screen>

<para>Saves whether to show again in
<filename>$<envar>TDEHOME</envar>/share/config/myfile</filename> (by writing
into this file the following lines:</para>

<screen>[Notification Messages]
mykey=false</screen>

<para>Instead of <option>--msgbox</option> you can also use
<option>--sorry</option> and <option>--error</option>, as appropriate.  For
instance, you might use <command>kdialog</command> <option>--sorry 'The
network can not be reached'</option> or <command>kdialog</command>
<option>--error 'Mail box can not be opened'</option>.</para>

<para>It is also possible to create message boxes that accept a yes or no
answer.</para>

<screen><command>kdialog</command> <option>--yesno 'Do you want to connect
to the Internet?'</option> <command>echo</command> <returnvalue>$?</returnvalue></screen>

<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>Return Value</entry>
<entry>Meaning</entry>
</row>
</thead>
<tbody>
<row><entry>0</entry><entry>Yes, OK, Continue</entry></row>
<row><entry>1</entry><entry>No</entry></row>
<row><entry>2</entry><entry>Cancel</entry></row>
</tbody>
</tgroup>
</informaltable>

<para>Make sure to store the result in a variable if you do not use it
directly, the next command will fill $? with a new value You can use
<option>--dontagain</option> here as well, it will remember the users choice
and returns it the next times without showing the dialog any more.</para>

<para>Further variations are:</para>

<variablelist>
<varlistentry>
<term><option>--warningyesno</option></term>
<listitem>
<para>like <option>--yesno</option> but with a different
icon</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--warningcontinuecancel</option></term>
<listitem><para>With <guibutton>Continue</guibutton> and
<guibutton>Cancel</guibutton> buttons.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--warningyesnocancel</option></term>
<listitem><para>With <guibutton>Yes</guibutton>, <guibutton>No</guibutton>
and <guibutton>Cancel</guibutton> button.  For example:</para>
<screen><command>kdialog</command> <option>--warningyesnocancel 'Do you want
to save the changes?'</option></screen>
</listitem>
</varlistentry>
</variablelist>

<screen><command>kdialog</command> <option>--inputbox "Enter your name:" "YourName"</option></screen>

<para>The result is printed to stdout, to put it in a variable you can use
<userinput>name=$(kdialog --inputbox "Enter your name:"
"YourName")</userinput>.  The last argument is optional, it is used to
pre-fill the dialog.</para>

<screen><userinput><varname>password</varname>=$(<command>kdialog</command> <option>--password "Enter your password:"</option>)</userinput></screen>

<para>The <option>--dontagain</option> option does not work with
<option>--inputbox</option> or <option>--password</option></para>

<para>There are two dialogs that let the user make a choice from a
list:</para>

<variablelist>
<varlistentry>
<term><option>--menu</option></term>
<listitem>
<para>Lets the user select a single item from a list.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--checklist</option></term>
<listitem>
<para>Lets the user select one or more items from a list.</para>
</listitem>
</varlistentry>
</variablelist>

<screen><userinput><varname>city</varname>=$(<command>kdialog</command> <option>--menu "Select a city" a London b Madrid c Paris d Berlin</option>)</userinput></screen>

<para><varname>$city</varname> will <returnvalue>a</returnvalue>, <returnvalue>b</returnvalue>, <returnvalue>c</returnvalue> or <returnvalue>d</returnvalue>.</para>

<screen><userinput><varname>city</varname>=$(<command>kdialog</command> <option>--checklist "Select cities" a London off b Madrid on c Paris on d Berlin off</option>)</userinput></screen>

<para>Madrid and Paris will be pre-selected.  The result with Madrid and
Paris selected will be <returnvalue>"b"</returnvalue>
<returnvalue>"c"</returnvalue>.</para>

<para>If you add the <option>--separate-output</option> option, it will put
<returnvalue>b</returnvalue> and <returnvalue>c</returnvalue> each on a line
of its own, making the result easier to process.</para>

<screen>file=$(kdialog --getopenfilename $HOME)
file=$(kdialog --getopenfilename $HOME "*.png *.jpg|Image Files")
file=$(kdialog --getsavefilename $HOME/SaveMe.png)
file=$(kdialog --getexistingdirectory $HOME)</screen>

</sect2>

</sect1>

</chapter>

&groupware-with-kontact;

</part>

<!-- Keep this comment at the end of the file
Local variables:
mode: xml
sgml-omittag:nil
sgml-shorttag:nil
sgml-namecase-general:nil
sgml-general-insert-case:lower
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:0
sgml-indent-data:true
sgml-parent-document:("index.docbook" "book" "part")
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->