From f1c64ec67f69006288e7cff152d4588cc8b7282b Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Fri, 24 Aug 2018 15:28:52 -0500
Subject: [PATCH] wmstartup, xob: Clean up initialization, use XDG_RUNTIME_DIR

---
 .config/compton.conf            |  1 -
 .config/dtfscripts/wmstartup.sh | 26 ++++++++------------------
 .config/xob/styles.cfg          |  6 +++---
 3 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/.config/compton.conf b/.config/compton.conf
index fd0d9474..2e484958 100644
--- a/.config/compton.conf
+++ b/.config/compton.conf
@@ -81,7 +81,6 @@ shadow-opacity = 0.5;
 # (most applications are fine, only apps that do weird things with xshapes or argb are affected).
 # This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher.
 shadow-exclude = [
-    "! name~=''",
     "name = 'oneko'",
     "name = 'Notification'",
     "name = 'Plank'",
diff --git a/.config/dtfscripts/wmstartup.sh b/.config/dtfscripts/wmstartup.sh
index 1f30bb15..413d6c51 100755
--- a/.config/dtfscripts/wmstartup.sh
+++ b/.config/dtfscripts/wmstartup.sh
@@ -36,10 +36,6 @@ unset PB_MODULE_WLAN_INTERFACE
 # bspwm monitorset.sh
 unset BSPWM_DESKTOPS_TOTAL
 unset BSPWM_DESKTOPS_PRIMARY
-# xob
-unset XOB_PIPE_BRIGHTNESS
-unset XOB_PIPE_VOLUME
-unset XOB_PIPE_MISC
 
 ## Patch path, if not already done
 if [[ "$PATH" != "*$HOME/.local/bin*" ]]; then
@@ -47,6 +43,11 @@ if [[ "$PATH" != "*$HOME/.local/bin*" ]]; then
 	export PATH="$HOME/.local/bin:$PATH"
 fi
 
+## Set the runtime directory, if not already
+if [[ "$XDG_RUNTIME_DIR" == "" ]]; then
+	export XDG_RUNTIME_DIR="/run/user/$UID"
+fi
+
 ## Load device-specific scripts
 if [[ -x "$HOME/.config/dtfscripts/$(hostname).rc" ]]; then
 	printf "[INFO] Sourcing ~/.config/dtfscripts/$(hostname).rc\n"
@@ -129,20 +130,9 @@ fi
 # XOB
 if which xob > /dev/null 2>&1; then
 	printf "  [INFO] Starting xob instances\n"
-	pipes="XOB_PIPE_BRIGHTNESS XOB_PIPE_VOLUME XOB_PIPE_MISC"
-	# Clean up earlier temp folders
-	for file in /tmp/$USER-xob-*; do
-		printf "    [INFO] Found old xob directory \"$file\"\n"
-		for pipe in $pipes; do
-			if [ -p "$file/$pipe" ]; then
-				printf "      [INFO] Contained old pipe \"$pipe\". Removing\n"
-				rm "$file/$pipe"
-			fi
-		done
-		rmdir "$file" && printf "    [INFO] Successfully cleaned up\n" || printf "    [WARN] Failed to clean up\n"
-	done
-	# Set up new pipes
-	export XOB_PIPE_DIR="/tmp/$USER-xob-$(date +%s)-$(uuidgen)"
+	pipes="brightness volume misc"
+	# Set up pipes
+	export XOB_PIPE_DIR="$XDG_RUNTIME_DIR/xob"
 	printf "    [INFO] Using pipe directory \"$XOB_PIPE_DIR\"\n"
 	mkdir -m 700 "$XOB_PIPE_DIR"
 	for pipe in $pipes; do
diff --git a/.config/xob/styles.cfg b/.config/xob/styles.cfg
index f97e22fa..843a68b2 100644
--- a/.config/xob/styles.cfg
+++ b/.config/xob/styles.cfg
@@ -39,7 +39,7 @@ default = {
 		};
 	};
 };
-XOB_PIPE_VOLUME = {
+volume = {
 	x = {
 		relative = 0.5;
 		offset = 0;
@@ -80,7 +80,7 @@ XOB_PIPE_VOLUME = {
 		};
 	};
 };
-XOB_PIPE_BRIGHTNESS = {
+brightness = {
 	x = {
 		relative = 0.5;
 		offset = 0;
@@ -111,7 +111,7 @@ XOB_PIPE_BRIGHTNESS = {
 		};
 	};
 };
-XOB_PIPE_MISC = {
+misc = {
 	x = {
 		relative = 0.5;
 		offset = 0;