commit cb88d225e2d3195dd43eb8090d2fe4190242dbe2
parent d85416e96669aac7762ee6d5752ebd79a01a1260
Author: Santtu Lakkala <inz@inz.fi>
Date: Tue, 6 Aug 2019 09:58:41 +0300
Start gnome-keyring-daemon and set env vars
Diffstat:
M | dwm.c | | | 45 | +++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 45 insertions(+), 0 deletions(-)
diff --git a/dwm.c b/dwm.c
@@ -2500,12 +2500,57 @@ zoom(const Arg *arg)
}
void
+start_keyring(void) {
+ FILE *gkd = popen("gnome-keyring-daemon --start", "r");
+
+ while (gkd && !feof(gkd)) {
+ char line[4096];
+ char *sep;
+ char *val;
+
+ if (!fgets(line, sizeof(line), gkd))
+ continue;
+
+ sep = strchr(line, '=');
+
+ if (sep)
+ *sep = '\0';
+ else
+ continue;
+
+ val = sep + 1;
+
+ if (*val == '"') {
+ sep = strchr(++val, '"');
+ if (sep)
+ *sep = '\0';
+ } else {
+ sep = strchr(val, ' ');
+ if (sep)
+ *sep = '\0';
+ sep = strchr(val, '\t');
+ if (sep)
+ *sep = '\0';
+ sep = strchr(val, '\n');
+ if (sep)
+ *sep = '\0';
+ }
+
+ setenv(line, val, 1);
+ }
+ if (gkd)
+ pclose(gkd);
+}
+
+void
startup(void) {
char buffer[4096];
const char *home = getenv("HOME");
const char *args[] = { NULL, NULL };
Arg arg;
+ start_keyring();
+
snprintf(buffer, sizeof(buffer), "%s/%s", home, ".dwmsession");
args[0] = buffer;
arg.v = args;