X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=.profile.d%2Faliases.sh;h=0b6338758e672b861cfab369cdcb716fddf61ebd;hb=942a43e2e16198361bee17df0077435a5064a2ed;hp=accde15f50b631b398679de2c03bebf42c42b5ee;hpb=9889577453147dc5eda3973d678c2650b12cde23;p=home.git diff --git a/.profile.d/aliases.sh b/.profile.d/aliases.sh index accde15..0b63387 100644 --- a/.profile.d/aliases.sh +++ b/.profile.d/aliases.sh @@ -27,10 +27,13 @@ alias quake4='quake4 +set s_driver oss' alias rrsync='rsync -Hav --inplace --progress' alias s='aspell -a' sss() { aspell -a <<<"$*"; } -smplayer() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec mplayer "$@" >/dev/null 2>&1' sh "$@" ; } -smpv() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec mpv "$@"' sh "$@" ; } -svlc() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec vlc "$@" >/dev/null 2>&1' sh "$@" ; } -svnc() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec x11vnc -q -nopw' ; } +sdisp() { sudo -u smriti sh -c 'export DISPLAY=:0; xset s reset; exec "$0" "$@"' "$@" ; } +smplayer() { sdisp mplayer "$@" ; } +smpv() { sdisp mpv "$@" ; } +svlc() { sdisp vlc "$@" ; } +svnc() { sdisp x11vnc -q -nopw ; } +sweb() { sdisp google-chrome-beta "$@" ; } +sxdg() { sdisp xdg-open "$@" ; } alias trc=transmission-remote-cli alias xine='xine -l' @@ -102,27 +105,34 @@ cd_history() { ;; esac fi + if command cd "$@" ; then pushd -n "${PWD}" >/dev/null - elif [[ $# -gt 1 ]] ; then - # The `cd` above should have shown an error message for us. - local arg first_arg="$1" - while [[ $# -gt 0 ]] ; do - arg="$1" - shift - if [[ -d ${arg} ]] ; then - if [[ $# -gt 0 ]] ; then - printf 'cd: remaining: %s\n' "$@" >&2 + else + local ret=$? + + if [[ $# -gt 1 ]] ; then + # The `cd` above should have shown an error message for us. + local arg first_arg="$1" + while [[ $# -gt 0 ]] ; do + arg="$1" + shift + if [[ -d ${arg} ]] ; then + if [[ $# -gt 0 ]] ; then + printf 'cd: remaining: %s\n' "$@" >&2 + fi + printf 'cd: entering: %s\n' "${arg}" >&2 + cd_history "${arg}" + return + else + printf 'cd: skipping: %s\n' "${arg}" >&2 fi - printf 'cd: entering: %s\n' "${arg}" >&2 - cd_history "${arg}" - return - else - printf 'cd: skipping: %s\n' "${arg}" >&2 - fi - done - # If we're still here, then we didn't cd anywhere. - echo "cd: cwd is unchanged!" >&2 + done + # If we're still here, then we didn't cd anywhere. + echo "cd: cwd is unchanged!" >&2 + fi + + return ${ret} fi } alias cd='cd_history'