From 60d7d214c1081fe25aed14ce172e4b79b857bdc8 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 21 Jul 2022 22:34:54 -0700 Subject: [PATCH] Add open-wezterm-here script The .deb package registers that script as the alternative for a terminal emulator in the hope that various "open terminal here..." functions in other tools will use that to detect wezterm and run thing in the cwd. refs: https://github.com/wez/wezterm/issues/2103 --- assets/open-wezterm-here | 5 +++++ ci/deploy.sh | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100755 assets/open-wezterm-here diff --git a/assets/open-wezterm-here b/assets/open-wezterm-here new file mode 100755 index 000000000..7e1229c16 --- /dev/null +++ b/assets/open-wezterm-here @@ -0,0 +1,5 @@ +#!/bin/sh +# This script is a helper that starts a new terminal window +# in the cwd of the calling process, rather than using the +# default cwd which is usually the home directory. +wezterm start --cwd $PWD -- "$@" diff --git a/ci/deploy.sh b/ci/deploy.sh index 94b5d534a..fd64235c2 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -159,6 +159,7 @@ echo "Doing the build bit here" set -x cd ${HERE} mkdir -p %{buildroot}/usr/bin %{buildroot}/etc/profile.d +install -Dsm755 assets/open-wezterm-here -t %{buildroot}/usr/bin install -Dsm755 target/release/wezterm -t %{buildroot}/usr/bin install -Dsm755 target/release/wezterm-mux-server -t %{buildroot}/usr/bin install -Dsm755 target/release/wezterm-gui -t %{buildroot}/usr/bin @@ -172,6 +173,7 @@ install -Dm644 assets/wezterm.appdata.xml %{buildroot}/usr/share/metainfo/org.we install -Dm644 assets/wezterm-nautilus.py %{buildroot}/usr/share/nautilus-python/extensions/wezterm-nautilus.py %files +/usr/bin/open-wezterm-here /usr/bin/wezterm /usr/bin/wezterm-gui /usr/bin/wezterm-mux-server @@ -211,7 +213,7 @@ EOF #!/bin/sh set -e if [ "\$1" = "configure" ] ; then - update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/wezterm 20 + update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/open-wezterm-here 20 fi EOF @@ -219,13 +221,14 @@ EOF #!/bin/sh set -e if [ "\$1" = "remove" ]; then - update-alternatives --remove x-terminal-emulator /usr/bin/wezterm + update-alternatives --remove x-terminal-emulator /usr/bin/open-wezterm-here fi EOF install -Dsm755 -t pkg/debian/usr/bin target/release/wezterm-mux-server install -Dsm755 -t pkg/debian/usr/bin target/release/wezterm-gui install -Dsm755 -t pkg/debian/usr/bin target/release/wezterm + install -Dsm755 -t pkg/debian/usr/bin assets/open-wezterm-here install -Dsm755 -t pkg/debian/usr/bin target/release/strip-ansi-escapes deps=$(cd pkg && dpkg-shlibdeps -O -e debian/usr/bin/*) @@ -283,6 +286,7 @@ source=" target/release/wezterm target/release/wezterm-gui target/release/wezterm-mux-server + assets/open-wezterm-here assets/wezterm.desktop assets/wezterm.appdata.xml assets/icon/terminal.png @@ -296,6 +300,7 @@ build() { } package() { + install -Dm755 -t "\$pkgdir"/usr/bin "\$srcdir"/open-wezterm-here install -Dm755 -t "\$pkgdir"/usr/bin "\$srcdir"/wezterm install -Dm755 -t "\$pkgdir"/usr/bin "\$srcdir"/wezterm-gui install -Dm755 -t "\$pkgdir"/usr/bin "\$srcdir"/wezterm-mux-server