]> code.delx.au - dotfiles/blobdiff - .bashrc
bash: pick up DBUS_SESSION_BUS_ADDRESS in case it isn't set automatically
[dotfiles] / .bashrc
diff --git a/.bashrc b/.bashrc
index 3cdd83ca39fda8315525605f404db8a0f7ddb643..6a5588ed8a071d342f03a1ab416c72aa79594c8b 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -15,7 +15,7 @@ fi
 # Add ~/bin and subdirs to PATH if needed
 while read -r p; do
     echo "$PATH" | tr ':' '\n' | grep -qxF "$p" || PATH="${p}:$PATH"
-done < <(find -L ~/bin -maxdepth 1 -type d 2> /dev/null)
+done < <(find -L ~/bin -depth -maxdepth 1 -type d 2> /dev/null)
 
 # Set environment variables, eg EMAIL, LANG
 eval "$(cat 2> /dev/null /etc/default/locale /etc/locale.conf ~/.config/environment.d/*.conf | awk -F= '/^[^# ]/ {print $0 ";export " $1}')"
@@ -30,6 +30,12 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
     fi
 fi
 
+# Look for DBUS
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -S "/run/user/$(id -u)/bus" ]; then
+    DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(id -u)/bus"
+    export DBUS_SESSION_BUS_ADDRESS
+fi
+
 
 ###########################
 # Interactive shells only #
@@ -165,7 +171,7 @@ trap print_exit_code ERR
 
 # This prevents long/ugly command lines from showing up in xterm titles
 function aliasf {
-    eval "function $1 { $2 \$@; }"
+    eval "function $1 { $2 \"\$@\"; }"
 }
 
 
@@ -229,6 +235,9 @@ aliasf sudosu 'sudo su -l -s /bin/bash'
 aliasf python 'PYTHONSTARTUP=~/.pythonrc.py python3'
 aliasf webshare 'python3 -mhttp.server'
 
+export EDITOR='vim'
+aliasf edit "$EDITOR"
+
 if ! command -v pbcopy &> /dev/null; then
     alias pbcopy='xsel --clipboard --input'
     alias pbcopym='xsel --input'
@@ -265,25 +274,6 @@ function ssh_unsafe {
 }
 
 
-##################
-# Editor aliases #
-##################
-
-if emacsclient --version &> /dev/null; then
-    export ALTERNATE_EDITOR='vim'
-    export EDITOR='emacsclient --tty'
-
-    if [[ "$TERM" == screen* ]]; then
-        aliasf edit 'emacsclient --tty'
-    else
-        aliasf edit 'emacsclient --create-frame --no-wait'
-    fi
-else
-    export EDITOR='vim'
-    aliasf edit 'vim'
-fi
-
-
 #########################
 # Optional local config #
 #########################
@@ -299,7 +289,7 @@ fi
 function print_title_prompt {
     printf '\e]0;bash:%s (%s)\a' \
         "${PWD/$HOME/\~}" \
-        "$(hostname -s)"
+        "$(cat /etc/hostname)"
 
     if [[ "$TERM" == screen* ]]; then
         printf '\ekbash\e\\'
@@ -325,7 +315,7 @@ function print_title_exec {
 
     printf '\e]0;%s (%s)\a' \
         "$(tr -cd '[:graph:] ' <<< "$BASH_COMMAND")" \
-        "$(hostname -s)"
+        "$(cat /etc/hostname)"
 
     if [[ "$TERM" == screen* ]]; then
         printf '\ek%s\e\\' \