5 XDG app configuration

Tomloader is able to run XDG Destop entries as systemd user units. Without further configuration, an XDG destop entry named xdg_app will be executed as a systemd service unit named app-tomloader-xdg_app@random.service (with random a random ASCII string) with the following general structure:

[Unit]
Description=comment
PartOf=graphical-session.target
After=graphical-session.target
Requisite=graphical-session.target

[Service]
Type=exec
ExecStart=cmdline
Slice=app.slice

with comment and cmdline respectively the content of the fields Comment= and Exec= (accordingly sanitized) in the XDG Desktop entry.

If you want to customize the generated systemd unit, or you want to generate a different unit for an application, then you can use the XDG app configuration file config_dir/xdg-apps.kdl (see config-dir) to control the behaviour of tomloader sd-xdg-v0.3 (see The sd-xdg-v0.3 subcommand). This file is KDL formatted and contained the following top-level nodes, which can appear at most once in the file:

default

default model to use for apps not listed inside apps, it follows the same syntax of Unit configuration file but additionally you can use the positional parameters ${0}, ${1} which will expand respectively to the (sanitized) command line to execute and the comment field;

apps

list of apps for which a different user unit should be generated instead of the one provided by default, each child node mush have the target XDG Desktop ID as name and the content must follow the same rules of default.


default {
    pull {
        GroupA
    }
    sd {
        section Service {
            set Type exec
            set ExecStart "${0}"
            set NoNewPrivileges yes
        }
        section Unit {
            set Description "${1}"
        }
    }
}

apps {
    "org.mantainer.GUIShell" {
        sd {
            section Service {
                set Type exec
                set ExecStart "${0}"
                set NoNewPrivileges no
            }
            section Unit {
                set Description "${1}"
            }
        }
    }
}

Tip: All groups defined in config_dir/groups.kdl are still available. If you need to share several fields between XDG app configurations then you could put all of them inside a group and then use it just for desired applications.