summaryrefslogtreecommitdiff
path: root/ar/.local/bin/tmuxdbussync
diff options
context:
space:
mode:
authorTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-06-19 14:12:02 +0900
committerTheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com>2025-06-19 14:12:02 +0900
commit55c70a1e4c1dd035e2c8f9d42c4471e630816d92 (patch)
treebc3e874d4d7753e3fb060db6bd5135cc6a822ca8 /ar/.local/bin/tmuxdbussync
parent41ee40356defa00fe2248065ad43ed7d6d44ea36 (diff)
modified plugins/urlview.lua, created bin/tmuxdbussync
Diffstat (limited to 'ar/.local/bin/tmuxdbussync')
-rwxr-xr-xar/.local/bin/tmuxdbussync18
1 files changed, 18 insertions, 0 deletions
diff --git a/ar/.local/bin/tmuxdbussync b/ar/.local/bin/tmuxdbussync
new file mode 100755
index 0000000..ffebff9
--- /dev/null
+++ b/ar/.local/bin/tmuxdbussync
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+TMUX_DBUS="$DBUS_SESSION_BUS_ADDRESS"
+BROWSER="${BROWSER:-firefox}"
+BROWSER_NAME=$(basename "$BROWSER")
+BROWSER_PID=$(pgrep -f "$BROWSER_NAME" | head -n1)
+
+if [ -z "$BROWSER_PID" ]; then
+ echo "No browser process found matching: $BROWSER_NAME"
+ exit 1
+fi
+
+BROWSER_DBUS=$(tr '\0' '\n' </proc/"$BROWSER_PID"/environ | grep DBUS_SESSION_BUS_ADDRESS)
+BROWSER_DBUS="${BROWSER_DBUS#DBUS_SESSION_BUS_ADDRESS=}"
+
+if [ "$TMUX_DBUS" != "$BROWSER_DBUS" ]; then
+ export DBUS_SESSION_BUS_ADDRESS="$BROWSER_DBUS"
+fi