]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
xdg-autostart: Generate autostart services with templated name
authorDavid Edmundson <kde@davidedmundson.co.uk>
Wed, 3 Feb 2021 12:29:28 +0000 (12:29 +0000)
committerLennart Poettering <lennart@poettering.net>
Thu, 4 Feb 2021 15:41:22 +0000 (16:41 +0100)
The "XDG standardization for applications" specification states that
services should be in the form:

app[-<launcher>]-<ApplicationID>[@<RANDOM>].service or
app[-<launcher>]-<ApplicationID>-<RANDOM>.scope

In this case "autostart" takes the place of [RANDOM] to provide a unique
identifier if the same app is launched elsewhere. As it is a service
that means it should be set as a template not using a hyphen delimiter.

src/xdg-autostart-generator/test-xdg-autostart.c
src/xdg-autostart-generator/xdg-autostart-service.c

index a437e2cfedda3d5bd5da87e6a6bf81a35581f3b3..5108beeaa9331ba652ff2a5cdec170d6fe620b0b 100644 (file)
@@ -13,7 +13,7 @@ static void test_translate_name(void) {
         _cleanup_free_ char *t;
 
         assert_se(t = xdg_autostart_service_translate_name("a-b.blub.desktop"));
-        assert_se(streq(t, "app-a\\x2db.blub-autostart.service"));
+        assert_se(streq(t, "app-a\\x2db.blub@autostart.service"));
 }
 
 static void test_xdg_format_exec_start_one(const char *exec, const char *expected) {
index 671d16d2d9efb06b1d6d82c608fbff980886226a..ed9301d809cee0678a4331aca4d53d039b976357 100644 (file)
@@ -58,7 +58,7 @@ char *xdg_autostart_service_translate_name(const char *name) {
         if (!escaped)
                 return NULL;
 
-        return strjoin("app-", escaped, "-autostart.service");
+        return strjoin("app-", escaped, "@autostart.service");
 }
 
 static int xdg_config_parse_bool(