aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2024-06-25 18:01:36 -0600
committerJosh Rahm <rahm@google.com>2024-08-14 15:42:42 -0600
commit001a0da746c695721490c7cf6f3153c6351603f3 (patch)
tree8b6f9a3f27437de460292d6901671a7f93cae9b8
parent026c1af550bf65e9116344f931f3cfdc1e6193f5 (diff)
downloadr-alacritty-rahm2.tar.gz
r-alacritty-rahm2.tar.bz2
r-alacritty-rahm2.zip
Add alacritty extension script support.rahm2
This allows an escape code to invoke user-defined extensions found in /home/rahm/.local/bin/alacritty-ext.sh. The terminal passes to this script the escape-code arguments. This allows things like opening links in the browser even through an ssh connection.
-rw-r--r--Cargo.lock19
-rw-r--r--alacritty_terminal/Cargo.toml8
-rw-r--r--alacritty_terminal/src/term/mod.rs11
3 files changed, 29 insertions, 9 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 92fe281f..38f364cf 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -149,7 +149,7 @@ dependencies = [
"anstyle-query",
"anstyle-wincon",
"colorchoice",
- "utf8parse",
+ "utf8parse 0.2.1",
]
[[package]]
@@ -164,7 +164,7 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c"
dependencies = [
- "utf8parse",
+ "utf8parse 0.2.1",
]
[[package]]
@@ -2001,6 +2001,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
+name = "utf8parse"
+version = "0.2.2"
+source = "git+ssh://git@git.josher.dev/~git/r-alacritty-vte.git?branch=rahm#bef8771129622df371bc731f344134add371b286"
+
+[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2029,22 +2034,20 @@ dependencies = [
[[package]]
name = "vte"
version = "0.13.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40eb22ae96f050e0c0d6f7ce43feeae26c348fc4dea56928ca81537cfaa6188b"
+source = "git+ssh://git@git.josher.dev/~git/r-alacritty-vte.git?branch=rahm#bef8771129622df371bc731f344134add371b286"
dependencies = [
"bitflags 2.5.0",
"cursor-icon",
"log",
"serde",
- "utf8parse",
+ "utf8parse 0.2.2",
"vte_generate_state_changes",
]
[[package]]
name = "vte_generate_state_changes"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff"
+version = "0.1.2"
+source = "git+ssh://git@git.josher.dev/~git/r-alacritty-vte.git?branch=rahm#bef8771129622df371bc731f344134add371b286"
dependencies = [
"proc-macro2",
"quote",
diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml
index 79e7c05b..5ff89fbc 100644
--- a/alacritty_terminal/Cargo.toml
+++ b/alacritty_terminal/Cargo.toml
@@ -24,9 +24,15 @@ parking_lot = "0.12.0"
polling = "3.0.0"
regex-automata = "0.4.3"
unicode-width = "0.1"
-vte = { version = "0.13.0", default-features = false, features = ["ansi", "serde"] }
serde = { version = "1", features = ["derive", "rc"], optional = true }
+[dependencies.vte]
+version = "0.13.0"
+default-features = false
+features = ["ansi","serde"]
+git = 'ssh://git@git.josher.dev/~git/r-alacritty-vte.git'
+branch = 'rahm'
+
[target.'cfg(unix)'.dependencies]
rustix-openpty = "0.1.1"
signal-hook = "0.3.10"
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 4113ed9c..b0c1dab7 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -1,6 +1,7 @@
//! Exports the `Term` type which is a high-level API for the Grid.
use std::ops::{Index, IndexMut, Range};
+use std::process::Command;
use std::sync::Arc;
use std::{cmp, mem, ptr, slice, str};
@@ -1716,6 +1717,16 @@ impl<T: EventListener> Handler for Term<T> {
}
#[inline]
+ fn extension_script(&mut self, args: &Vec<String>) {
+ match Command::new("/home/rahm/.local/bin/alacritty-ext.sh").args(args).output() {
+ Ok(_) => {},
+ Err(v) => {
+ println!("Failed to run alacritty command. {}", v);
+ },
+ }
+ }
+
+ #[inline]
fn clear_screen(&mut self, mode: ansi::ClearMode) {
trace!("Clearing screen: {:?}", mode);
let bg = self.grid.cursor.template.bg;