|
878 | 878 | <filename>sound.target</filename>.</para> |
879 | 879 | </refsect1> |
880 | 880 |
|
| 881 | + <refsect1> |
| 882 | + <title>Special Passive User Units</title> |
| 883 | + |
| 884 | + <refsect2> |
| 885 | + <title>graphical-session.target</title> |
| 886 | + |
| 887 | + <para>This target is active whenever any graphical session is running. It |
| 888 | + is used to stop user services which only apply to a graphical (X, |
| 889 | + Wayland, etc.) session when the session is terminated. Such services |
| 890 | + should have <literal>PartOf=graphical-session.target</literal> in their |
| 891 | + <literal>[Unit]</literal> section. A target for a particular session |
| 892 | + (e. g. <filename>gnome-session.target</filename>) starts and stops |
| 893 | + <literal>graphical-session.target</literal> with |
| 894 | + <literal>BindsTo=graphical-session.target</literal>.</para> |
| 895 | + |
| 896 | + <para>Which services are started by a session target is determined by the |
| 897 | + <literal>Wants=</literal> and <literal>Requires=</literal> dependencies. |
| 898 | + For services that can be enabled independently, symlinks in |
| 899 | + <literal>.wants/</literal> and <literal>.requires/</literal> should be |
| 900 | + used, see |
| 901 | + <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. |
| 902 | + Those symlinks should either be shipped in packages, or should be added |
| 903 | + dynamically after installation, for example using <literal>systemctl add-wants</literal>, see |
| 904 | + <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>. |
| 905 | + </para> |
| 906 | + |
| 907 | + <example> |
| 908 | + <title>Nautilus as part of a GNOME session</title> |
| 909 | + |
| 910 | + <para><literal>gnome-session.target</literal> pulls in Nautilus as |
| 911 | + top-level service:</para> |
| 912 | + |
| 913 | + <programlisting>[Unit] |
| 914 | +Description=User systemd services for GNOME graphical session |
| 915 | +Wants=nautilus.service |
| 916 | +BindsTo=graphical-session.target |
| 917 | + </programlisting> |
| 918 | + |
| 919 | + <para><literal>nautilus.service</literal> gets stopped when the session stops:</para> |
| 920 | + |
| 921 | + <programlisting>[Unit] |
| 922 | +Description=Render the desktop icons with Nautilus |
| 923 | +PartOf=graphical-session.target |
| 924 | + |
| 925 | +[Service] |
| 926 | +... |
| 927 | + </programlisting> |
| 928 | + </example> |
| 929 | + </refsect2> |
| 930 | + </refsect1> |
| 931 | + |
881 | 932 | <refsect1> |
882 | 933 | <title>Special Slice Units</title> |
883 | 934 |
|
|
0 commit comments