summarylogtreecommitdiffstats
path: root/envy.sh
diff options
context:
space:
mode:
authorPieter Lexis2018-03-07 12:50:57 +0100
committerPieter Lexis2018-03-07 12:50:57 +0100
commit4378a86ff2ece4722ba8c265313f3f862e098704 (patch)
tree878f23d5971299c834ed35caa4bb768ffec5a13c /envy.sh
downloadaur-envy.tar.gz
Initial import of envy (v0.1.0)
Diffstat (limited to 'envy.sh')
-rw-r--r--envy.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/envy.sh b/envy.sh
new file mode 100644
index 00000000000..864de7995cd
--- /dev/null
+++ b/envy.sh
@@ -0,0 +1,37 @@
+# Copyright © 2018 Pieter Lexis <pieter+AUR@plexis.eu>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+ENVY_BIN='/usr/bin/envy'
+
+# Not bash or zsh?
+[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] || return 0
+
+# Not an interactive shell?
+[[ $- == *i* ]] || return 0
+
+# Do we have envy?
+[ -r "${ENVY_BIN}" ] || return 0
+
+__envy_session_command() {
+ eval $("${ENVY_BIN}" session)
+}
+
+[ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__envy_session_command"
+[ -n "$ZSH_VERSION" ] && precmd_functions+=(__envy_session_command)