summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2015-02-06 15:17:51 -0500
committerLuke Shumaker <shumakl@purdue.edu>2015-02-06 15:17:51 -0500
commitdab097d5000c4697761b6985cb3512f7bce0147f (patch)
tree7b81b7826a1e23822955560f0f73dc09cda6c8e8 /.local
parentf50b49ef26f5c692bda1f3f13cd38f9f4f395300 (diff)
parenta6f973687fb4a1a4558f74f7da595b6902a5dce0 (diff)
Merge remote-tracking branch 'origin/master' into purdue-cs/master
Conflicts: .config/X11/clientrc .config/bash/rc.d/emacs.sh .config/cron/make-config .config/emacs/custom.el .config/emacs/init.el .config/git/config .config/login.sh .config/selected_editor .local/bin/config-path
Diffstat (limited to '.local')
-rw-r--r--.local/.gitignore1
-rwxr-xr-x.local/bin/config-path61
-rwxr-xr-x.local/bin/pick10
-rwxr-xr-x.local/bin/x-pdf3
-rwxr-xr-x.local/bin/x-terminal-emulator3
-rwxr-xr-x.local/bin/x-www-browser3
-rwxr-xr-x.local/bin/xmessage2
-rw-r--r--.local/lib/path.sh9
-rw-r--r--.local/lib/xdg.sh23
9 files changed, 39 insertions, 76 deletions
diff --git a/.local/.gitignore b/.local/.gitignore
new file mode 100644
index 0000000..8d0c87d
--- /dev/null
+++ b/.local/.gitignore
@@ -0,0 +1 @@
+/share/
diff --git a/.local/bin/config-path b/.local/bin/config-path
index d0afa4a..7cd1fcd 100755
--- a/.local/bin/config-path
+++ b/.local/bin/config-path
@@ -3,17 +3,13 @@
# All the prefixes to consider
prefixes=(
"$HOME"
- "$HOME/.local.`uname -m`"
+ "$HOME/.local.$(uname -m)"
"$HOME/.local"
- "$HOME/.prefix.`uname -m`"
+ "$HOME/.prefix.$(uname -m)"
"$HOME/.prefix"
"$HOME"/.gem/ruby/*
)
-######################################################################
-
-IFS=:
-
in_array() {
local needle=$1; shift
local haystack=("$@")
@@ -46,32 +42,33 @@ var_done() {
declare -p $1
}
-######################################################################
-
-# Import existing values
-var_init PATH
-var_init MANPATH
-var_init LD_LIBRARY_PATH
-var_init RUBYLIB
-var_init PERL5LIB
-
-# Scan through prefixes
-for prefix in "${prefixes[@]}"; do
- var_add PATH "$prefix/bin" "$prefix/sbin"
- var_add MANPATH "$prefix/share/man"
- var_add LD_LIBRARY_PATH "$prefix"/lib{,32,64}
- var_add RUBYLIB "$prefix"/lib{,32,64}
- var_add PERL5LIB "$prefix"/lib{,32,64}/perl5
-done
+main() {
+ IFS=:
+ # Import existing values
+ var_init PATH
+ var_init MANPATH
+ var_init LD_LIBRARY_PATH
+ var_init RUBYLIB
+ var_init PERL5LIB
+ # Scan through prefixes
+ for prefix in "${prefixes[@]}"; do
+ var_add PATH "$prefix/bin" "$prefix/sbin"
+ var_add MANPATH "$prefix/share/man"
+ var_add LD_LIBRARY_PATH "$prefix"/lib{,32,64}
+ var_add RUBYLIB "$prefix"/lib{,32,64}
+ var_add PERL5LIB "$prefix"/lib{,32,64}/perl5
+ done
+ # Finally, print the values
+ # The `sed` bit here is the only time we call an external program
+ {
+ var_done PATH
+ var_done MANPATH
+ var_done LD_LIBRARY_PATH
+ var_done RUBYLIB
+ var_done PERL5LIB
+ } | sed 's/^declare \(-\S* \)*//'
+}
-# Finally, print our values
-# The `sed` bit here is the only time we call an external program
-{
- var_done PATH
- var_done MANPATH
- var_done LD_LIBRARY_PATH
- var_done RUBYLIB
- var_done PERL5LIB
-} | sed 's/^declare \(-\S* \)*//'
+main "$@"
diff --git a/.local/bin/pick b/.local/bin/pick
index ed2d44d..7458041 100755
--- a/.local/bin/pick
+++ b/.local/bin/pick
@@ -19,8 +19,8 @@ if [[ $1 = -s ]]; then
shift
# Scan to find a running instance
for prog in "$@"; do
- if [[ -n "`pgrep $prog`" ]]; then
- printf '%s\n' "$prog"
+ if [[ -n "$(pgrep "${prog%% *}")" ]]; then
+ printf -- '%s\n' "$prog"
exit 0
fi
done
@@ -28,11 +28,11 @@ fi
# Scan to find one that is installed
for prog in "$@"; do
- if [[ -x "`which $prog 2>/dev/null`" ]]; then
- printf '%s\n' "$prog"
+ if [[ -x "$(which "${prog%% *}" 2>/dev/null)" ]]; then
+ printf -- '%s\n' "$prog"
exit 0
fi
done
-printf '%s\n' "$cmd: no suitable program found"
+printf -- '%s\n' "$cmd: no suitable program found" >&2
exit 1
diff --git a/.local/bin/x-pdf b/.local/bin/x-pdf
index 1b23a3d..8f9ef60 100755
--- a/.local/bin/x-pdf
+++ b/.local/bin/x-pdf
@@ -1,4 +1,3 @@
#!/bin/sh
-`pick evince okular xpdf` "$@"
-exit $?
+exec $(pick atril zathura mupdf okular evince xpdf 'emacsclient -c') "$@"
diff --git a/.local/bin/x-terminal-emulator b/.local/bin/x-terminal-emulator
index 049b081..2e158cf 100755
--- a/.local/bin/x-terminal-emulator
+++ b/.local/bin/x-terminal-emulator
@@ -1,4 +1,3 @@
#!/bin/sh
-`pick emacsterm urxvt gnome-terminal xterm` "$@"
-exit $?
+exec $(pick 'emacsterm -c' 'urxvt' 'xterm' 'gnome-terminal') "$@"
diff --git a/.local/bin/x-www-browser b/.local/bin/x-www-browser
index bbd8943..b0b05e0 100755
--- a/.local/bin/x-www-browser
+++ b/.local/bin/x-www-browser
@@ -1,4 +1,3 @@
#!/bin/sh
-`pick -s conkeror iceweasel icecat firefox` "$@"
-exit $?
+exec $(pick -s iceweasel icecat firefox conkeror) "$@"
diff --git a/.local/bin/xmessage b/.local/bin/xmessage
index bd30b5e..46647e0 100755
--- a/.local/bin/xmessage
+++ b/.local/bin/xmessage
@@ -1,2 +1,2 @@
#!/bin/sh
-gxmessage $@ -fn 'Monospace'
+exec gxmessage "$@" -fn 'Monospace'
diff --git a/.local/lib/path.sh b/.local/lib/path.sh
deleted file mode 100644
index a45f8fd..0000000
--- a/.local/lib/path.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-if type config-path &>/dev/null; then
- config_path=config-path
-else
- # Bootstrap finding config-path
- config_path="$HOME/.local/bin/config-path"
-fi
-eval "$("$config_path" | sed 's/^/export /')"
diff --git a/.local/lib/xdg.sh b/.local/lib/xdg.sh
deleted file mode 100644
index 2241d2e..0000000
--- a/.local/lib/xdg.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-# This should be readable by /bin/sh, but I'm going to assume bash.
-
-# Sets up XDG environmental variables, so programs using them don't have to
-# worry about checking if they are set.
-# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
-
-[[ -n $XDG_DATA_HOME ]] || export XDG_DATA_HOME="$HOME/.local/share"
-[[ -n $XDG_CONFIG_HOME ]] || export XDG_CONFIG_HOME="$HOME/.config"
-[[ -n $XDG_DATA_DIRS ]] || export XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
-[[ -n $XDG_CONFIG_DIRS ]] || export XDG_CONFIG_DIRS="/etc/xdg"
-[[ -n $XDG_CACHE_HOME ]] || export XDG_CACHE_HOME="$HOME/.cache"
-
-# Check if XDG_RUNTIME_DIR is set, but has a bogus setting
-if [[ -n $XDG_RUNTIME_DIR ]] && [[ ! -d $XDG_RUNTIME_DIR ]]; then
- unset XDG_RUNTIME_DIR
-fi
-
-# Set XDG_RUNTIME_DIR if we can
-if [[ -z $XDG_RUNTIME_DIR ]] && [[ -n $TMPDIR ]]; then
- export XDG_RUNTIME_DIR="$TMPDIR/xdg-runtime"
- install -dm0700 "$XDG_RUNTIME_DIR"
-fi