diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2019-04-01 22:41:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-01 22:41:20 +0000 |
commit | 6f4d1afcf88e275f4a6b8c73cfc904e3833d0dd0 (patch) | |
tree | bd2c870aea77c683e0725a59d1c8ce1f817dba7d /scripts | |
parent | 5523f64c6f939ced94d55c569f592320442e8eb9 (diff) | |
download | alacritty-6f4d1afcf88e275f4a6b8c73cfc904e3833d0dd0.tar.gz alacritty-6f4d1afcf88e275f4a6b8c73cfc904e3833d0dd0.zip |
Add official logov0.3.0-rc2
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/spawn-alacritty-cwd | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/scripts/spawn-alacritty-cwd b/scripts/spawn-alacritty-cwd deleted file mode 100755 index b0008a50..00000000 --- a/scripts/spawn-alacritty-cwd +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -# Spawn a new instance of Alacritty using the CWD of the currently focused -# Alacritty process. -# -# This is useful in environment like i3 where terminals are opened using a -# key-combination while another terminal is already focused. -# -# If the script is run with a non-Alacritty window in focus or a non-compliant -# version of Alacritty, the script will exit with code 1. This makes it possible -# to use the script like -# -# spawn-alacritty-cwd || alacritty -# - -ACTIVE_WINDOW=$(xdotool getactivewindow) -ACTIVE_WM_CLASS=$(xprop -id $ACTIVE_WINDOW | grep WM_CLASS) - -if [[ $ACTIVE_WM_CLASS == *"Alacritty"* ]] -then - # Get PID. If _NET_WM_PID isn't set, bail. - PID=$(xprop -id $ACTIVE_WINDOW | grep _NET_WM_PID | grep -oP "\d+") - if [[ "$PID" == "" ]] - then - exit 1 - fi - - # Get first child of terminal - CHILD_PID=$(pgrep -P $PID) - if [[ "$PID" == "" ]] - then - exit 1 - fi - - # Get current directory of child. The first child should be the shell. - pushd "/proc/${CHILD_PID}/cwd" - SHELL_CWD=$(pwd -P) - popd - - # Start alacritty with the working directory - alacritty --working-directory $SHELL_CWD -else - exit 1 -fi |