]> code.delx.au - dotfiles/blobdiff - .bashrc
install.sh
[dotfiles] / .bashrc
diff --git a/.bashrc b/.bashrc
index 69754e69d36ab052302e96de39ddb691ead7db29..7a37f4925a240c1b46e13a540a7301d64d4d3fd2 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -30,6 +30,18 @@ if [ -z "$SSH_AUTH_SOCK" ]; then
     fi
 fi
 
+# Look for XDG_RUNTIME_DIR
+if [ -z "$XDG_RUNTIME_DIR" ] && [ -d "/run/user/$(id -u)" ]; then
+    XDG_RUNTIME_DIR="/run/user/$(id -u)"
+    export XDG_RUNTIME_DIR
+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 #
@@ -205,7 +217,7 @@ alias _psresources='ps -wAo pid,user,%cpu,%mem,stat,start,time,args'
 if [ "$(uname)" = "Linux" ]; then
     aliasf pscpu '_psresources --sort -%cpu|less -S'
     aliasf psmem '_psresources --sort -%mem|less -S'
-    aliasf pstree 'ps --forest -weo pid,user:16,args --sort start_time|less -S'
+    aliasf pstree 'ps --forest -weo pid,user:16,args|less -S'
     aliasf pstime 'ps -wAo pid,user,lstart,args --sort start_time|less -S'
 else
     aliasf pscpu '_psresources -r|less -S'
@@ -229,12 +241,8 @@ aliasf sudosu 'sudo su -l -s /bin/bash'
 aliasf python 'PYTHONSTARTUP=~/.pythonrc.py python3'
 aliasf webshare 'python3 -mhttp.server'
 
-if ! command -v pbcopy &> /dev/null; then
-    alias pbcopy='xsel --clipboard --input'
-    alias pbcopym='xsel --input'
-    alias pbpaste='xsel --clipboard --output'
-    alias pbpastem='xsel --output'
-fi
+export EDITOR='vim'
+aliasf edit "$EDITOR"
 
 # man with coloured headings and a terminal title
 function man {
@@ -265,19 +273,6 @@ function ssh_unsafe {
 }
 
 
-##################
-# Editor aliases #
-##################
-
-if emacsclient --version &> /dev/null; then
-    export ALTERNATE_EDITOR='vim'
-    export EDITOR='emacsclient --tty'
-else
-    export EDITOR='vim'
-fi
-aliasf edit "$EDITOR"
-
-
 #########################
 # Optional local config #
 #########################
@@ -293,7 +288,7 @@ aliasf edit "$EDITOR"
 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\\'
@@ -316,10 +311,11 @@ PROMPT_COMMAND=prompt_command
 # bashrc to avoid running the trap on commands in the bashrc
 function print_title_exec {
     [ "$BASH_COMMAND" = "$PROMPT_COMMAND" ] && return
+    [ "$BASH_COMMAND" = "__vte_osc7" ] && return
 
     printf '\e]0;%s (%s)\a' \
         "$(tr -cd '[:graph:] ' <<< "$BASH_COMMAND")" \
-        "$(hostname -s)"
+        "$(cat /etc/hostname)"
 
     if [[ "$TERM" == screen* ]]; then
         printf '\ek%s\e\\' \