LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.
C cdebiandesktop-environmentebpffirewalllandlocklinuxlinux-distributionopen-sourceprivacyquickjsraspberry-pi-5reactsecuritywaylandwayland-compositor
lord.apps.linux: also return the untranslated Name of each app (nameC)
Federico Pereira16711a90df3d
diff --git a/server/src/apps.c b/server/src/apps.cindex 7e8393e..a504b12 100644--- a/server/src/apps.c+++ b/server/src/apps.c@@ -167,7 +167,10 @@ static int parse_desktop(const char *file, const char *lang, Entry *e) {} else if (!loc && !strcmp(k, "Exec")) snprintf(act->exec, sizeof act->exec, "%s", v);continue;}- if (!strcmp(k, "Name")) { set_tr(e, 0, e->a.name, sizeof e->a.name, v, loc, lang); e->has_name = 1; }+ if (!strcmp(k, "Name")) {+ set_tr(e, 0, e->a.name, sizeof e->a.name, v, loc, lang); e->has_name = 1;+ if (!loc) snprintf(e->a.name_c, sizeof e->a.name_c, "%s", v);+ }else if (!strcmp(k, "GenericName")) set_tr(e, 1, e->a.generic, sizeof e->a.generic, v, loc, lang);else if (!strcmp(k, "Comment")) set_tr(e, 2, e->a.comment, sizeof e->a.comment, v, loc, lang);else if (!strcmp(k, "Keywords")) set_tr(e, 3, e->a.keywords, sizeof e->a.keywords, v, loc, lang);@@ -188,7 +191,7 @@ static int parse_desktop(const char *file, const char *lang, Entry *e) {else if (!strcmp(k, "Actions")) snprintf(e->actions, sizeof e->actions, "%s", v);}fclose(f);- unescape(e->a.name); unescape(e->a.generic); unescape(e->a.comment);+ unescape(e->a.name); unescape(e->a.name_c); unescape(e->a.generic); unescape(e->a.comment);for (int i = 0; i < e->nact; i++) unescape(e->act[i].label);snprintf(e->a.file, sizeof e->a.file, "%s", file);return 0;diff --git a/server/src/apps.h b/server/src/apps.hindex 3ca33d1..3b9c9df 100644--- a/server/src/apps.h+++ b/server/src/apps.h@@ -7,6 +7,7 @@typedef struct {char id[160]; /* "org.featherpad.FeatherPad" (.desktop name without the extension) */char name[160], generic[160], comment[320], keywords[320], categories[256];+ char name_c[160]; /* the untranslated Name ("Chromium" next to "Navegador web Chromium") */char wmclass[160]; /* StartupWMClass: to recognize its Wayland window */char mime[1024]; /* MimeType: file types it opens ("text/plain;…") */char icon[PATH_MAX]; /* PNG found, or "" */diff --git a/server/src/ui/js_sys.c b/server/src/ui/js_sys.cindex 44075ca..47c7b78 100644--- a/server/src/ui/js_sys.c+++ b/server/src/ui/js_sys.c@@ -1393,6 +1393,7 @@ static JSValue f_apps_linux(JSContext *c, JSValueConst this_val, int argc, JSValJSValue o = JS_NewObject(c);JS_SetPropertyStr(c, o, "id", JS_NewString(c, a->id));JS_SetPropertyStr(c, o, "name", JS_NewString(c, a->name));+ JS_SetPropertyStr(c, o, "nameC", JS_NewString(c, a->name_c));JS_SetPropertyStr(c, o, "genericName", JS_NewString(c, a->generic));JS_SetPropertyStr(c, o, "comment", JS_NewString(c, a->comment));JS_SetPropertyStr(c, o, "keywords", JS_NewString(c, a->keywords));