commit eba562c9bc9b2f7a5a698351870d2f814b63a6d9
parent 0c8fd0423db8a53f77b59cfe6a3e458345a0ed61
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
@@ -2490,12 +2490,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;