summarylogtreecommitdiffstats
path: root/0009-Simplify-handling-of-XDG_RUNTIME_DIR.patch
diff options
context:
space:
mode:
authorArenM2022-04-28 22:22:10 -0400
committerArenM2023-04-05 21:20:25 -0400
commite39ac8fee0451598b8b9997962b935886a1cbcad (patch)
treeafde85b41017beb9a6154b67cac6e1cb51f84adf /0009-Simplify-handling-of-XDG_RUNTIME_DIR.patch
downloadaur-e39ac8fee0451598b8b9997962b935886a1cbcad.tar.gz
initial commit
This is forked from the sxmo-utils package in danctnix https://github.com/dreemurrs-embedded/Pine64-Arch/blob/master/PKGBUILDS/sxmo/sxmo-utils/PKGBUILD Notable changes include: - Add patches to use systemd instead of superd - Disable dwm variant. None of the sxmo versions of the suckless utilities are in the aur, and I don't want to maintain aur versions of them.
Diffstat (limited to '0009-Simplify-handling-of-XDG_RUNTIME_DIR.patch')
-rw-r--r--0009-Simplify-handling-of-XDG_RUNTIME_DIR.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/0009-Simplify-handling-of-XDG_RUNTIME_DIR.patch b/0009-Simplify-handling-of-XDG_RUNTIME_DIR.patch
new file mode 100644
index 000000000000..0dbeb28e1bbc
--- /dev/null
+++ b/0009-Simplify-handling-of-XDG_RUNTIME_DIR.patch
@@ -0,0 +1,88 @@
+From ad6b44cda0c8cc509abaff2634196b6edea66e13 Mon Sep 17 00:00:00 2001
+From: ArenM <aren@peacevolution.org>
+Date: Wed, 5 Apr 2023 18:55:53 -0400
+Subject: [PATCH sxmo-utils 9/9] Simplify handling of XDG_RUNTIME_DIR
+
+Previously if this detected that sxmo was not running, it would unset
+XDG_RUNTIME_DIR. This would prevent anyone from having sxmo installed
+but not using it.
+---
+ configs/profile.d/sxmo_init.sh | 36 +++++++++++++---------------------
+ 1 file changed, 14 insertions(+), 22 deletions(-)
+
+diff --git a/configs/profile.d/sxmo_init.sh b/configs/profile.d/sxmo_init.sh
+index fdf5dd9..a8bb2e2 100644
+--- a/configs/profile.d/sxmo_init.sh
++++ b/configs/profile.d/sxmo_init.sh
+@@ -9,9 +9,9 @@
+ _sxmo_is_running() {
+ unset SXMO_WM
+
+- if [ -f "${XDG_RUNTIME_DIR}"/sxmo.swaysock ]; then
++ if [ -f "${_RUNTIME_DIR}"/sxmo.swaysock ]; then
+ unset SWAYSOCK
+- if SWAYSOCK="$(cat "${XDG_RUNTIME_DIR}"/sxmo.swaysock)" \
++ if SWAYSOCK="$(cat "${_RUNTIME_DIR}"/sxmo.swaysock)" \
+ swaymsg 2>/dev/null; then
+ printf "Detected the Sway environment\n" >&2
+ export SXMO_WM=sway
+@@ -29,22 +29,6 @@ _sxmo_is_running() {
+ return 1
+ }
+
+-_sxmo_find_runtime_dir() {
+- # Take what we gave to you
+- if [ -n "$XDG_RUNTIME_DIR" ]; then
+- printf %s "$XDG_RUNTIME_DIR"
+- return
+- fi
+-
+- if [ -d "/var/run/user/$(id -u)" ]; then
+- printf "/var/run/user/%s" "$(id -u)"
+- return
+- fi
+-
+- # Fallback to a shared memory location
+- printf "/dev/shm/user/%s" "$(id -u)"
+-}
+-
+ _sxmo_load_environments() {
+ # Determine current operating system see os-release(5)
+ # https://www.linux.org/docs/man5/os-release.html
+@@ -60,7 +44,6 @@ _sxmo_load_environments() {
+ export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
+ export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
+ export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
+- XDG_RUNTIME_DIR="$(_sxmo_find_runtime_dir)"
+ export XDG_RUNTIME_DIR
+ export XDG_DATA_DIRS="${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
+ export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
+@@ -124,13 +107,22 @@ $PATH"
+ }
+
+ _sxmo_grab_session() {
+- XDG_RUNTIME_DIR="$(_sxmo_find_runtime_dir)"
+- export XDG_RUNTIME_DIR
++ if [ -n "$XDG_RUNTIME_DIR" ]; then
++ _RUNTIME_DIR="$XDG_RUNTIME_DIR"
++ elif [ -d "/var/run/user/$(id -u)" ]; then
++ _RUNTIME_DIR="/var/run/user/%s" "$(id -u)"
++ else
++ _RUNTIME_DIR="/dev/shm/user/%s" "$(id -u)"
++ fi
++
+ if ! _sxmo_is_running; then
+- unset XDG_RUNTIME_DIR
++ unset _RUNTIME_DIR
+ return
+ fi
+
++ export XDG_RUNTIME_DIR="$_RUNTIME_DIR"
++ unset _RUNTIME_DIR
++
+ _sxmo_load_environments
+
+ if [ -f "$XDG_RUNTIME_DIR"/dbus.bus ]; then
+--
+2.39.2
+