summaryrefslogtreecommitdiff
path: root/sxhkd/run
diff options
context:
space:
mode:
Diffstat (limited to 'sxhkd/run')
-rwxr-xr-xsxhkd/run24
1 files changed, 24 insertions, 0 deletions
diff --git a/sxhkd/run b/sxhkd/run
new file mode 100755
index 0000000..82504bb
--- /dev/null
+++ b/sxhkd/run
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+xdg_runtime_dir=$(id -ur | sed 's:^:/run/user/:')
+test -d "$xdg_runtime_dir" || exit -1;
+
+mkdir -p env
+
+echo "$xdg_runtime_dir" \
+ > env/XDG_RUNTIME_DIR
+
+ls /tmp/.X11-unix | tr 'X' ':' | head -n1 \
+ > env/DISPLAY
+
+user_home=$(id -urn | xargs getent passwd | cut -d: -f6)
+local_bin="$user_home/.local/bin"
+path="/bin:/usr/bin"
+test -d "$local_bin" && path="$path:$local_bin"
+echo "$path" \
+ > env/PATH
+
+env_full_path=$PWD/env
+
+cd $HOME
+exec s6-envdir $env_full_path sxhkd