From f5c219983c0f60a07f1bd52b6f6071e86f35455e Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Mon, 25 Sep 2023 11:56:34 +0200 Subject: add os config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- os/etc/s6-rc/src/desktop-session-running/up | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 os/etc/s6-rc/src/desktop-session-running/up (limited to 'os/etc/s6-rc/src/desktop-session-running/up') diff --git a/os/etc/s6-rc/src/desktop-session-running/up b/os/etc/s6-rc/src/desktop-session-running/up new file mode 100644 index 0000000..de48622 --- /dev/null +++ b/os/etc/s6-rc/src/desktop-session-running/up @@ -0,0 +1,21 @@ +#!/bin/execlineb -P + +# get username from config +envfile /etc/s6-rc/config/user.conf +importas -iu USER USER +s6-envuidgid -i ${USER} +importas -iu UID UID + +# find first process with marker=true envvar set +backtick -E pid { sh /etc/s6-rc/src/desktop-session-running/find-marker-proc ${UID} } + +# create session-env directory +importas -D "/run" XDG_RUNTIME_DIR XDG_RUNTIME_DIR +define dir ${XDG_RUNTIME_DIR}/session-env +foreground { mkdir -p ${dir} } +cd ${dir} +pipeline { grep -zE "^(SWAY|I3|.*DISPLAY|DBUS|XDG|BEMENU|PATH|HOME|LANG)" /proc/${pid}/environ } +foreground { awk --assign=RS=\\0 -- "{idx=index($0,\"=\"); print substr($0,idx+1) > substr($0,0,idx-1)}" } + +# hack +foreground { sleep 0.5 } -- cgit 1.4.1