aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe2017-06-13 13:15:35 +0200
committerGiuseppe2017-06-13 13:15:35 +0200
commitaa92ef2c6cf8c4740552427e537d9bbd54f0be5b (patch)
tree16c6f872d35b60531e457defc4ea3cc390b692a7
parentbf5a987f6ca3ff50e0b9d827726edd31f0743a87 (diff)
downloadaur-aa92ef2c6cf8c4740552427e537d9bbd54f0be5b.tar.gz
Do not mess with bash-preexec if DISPLAY is not set.
-rw-r--r--preexec.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/preexec.sh b/preexec.sh
index b09718cc71c8..769bda6f810f 100644
--- a/preexec.sh
+++ b/preexec.sh
@@ -3,7 +3,10 @@ __nwd_previous_focused=
__nwd_when_started=
__nwd_precmd() {
- [[ -z $__nwd_cmd ]] && return
+ local abort
+ abort=0
+ [[ -z $DISPLAY || $(pgrep i3|wc -l) -eq 0 ]] && abort=1
+ [[ $abort -eq 1 && -z $__nwd_cmd ]] && return
local current_focused
current_focused=$(python3 /usr/share/nwd/focused_window.py)
@@ -19,6 +22,11 @@ __nwd_precmd() {
}
__nwd_preexec() {
+ local abort
+ abort=0
+ [[ -z $DISPLAY || $(pgrep i3|wc -l) -eq 0 ]] && abort=1
+ [[ $abort -eq 1 && -z $__nwd_cmd ]] && return
+
__nwd_cmd=$1
__nwd_previous_focused=$(python3 /usr/share/nwd/focused_window.py)
__nwd_when_started=$(date +%s)