aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md18
-rw-r--r--alacritty.yml5
-rw-r--r--alacritty_macos.yml4
-rw-r--r--src/config.rs10
-rw-r--r--src/input.rs17
-rw-r--r--src/main.rs2
-rw-r--r--src/tty.rs19
7 files changed, 58 insertions, 17 deletions
diff --git a/README.md b/README.md
index 269c3d61..4683b35a 100644
--- a/README.md
+++ b/README.md
@@ -45,11 +45,15 @@ will walk you through how to build from source on both macOS and Ubuntu.
cd alacritty
```
-3. Make sure you have the right Rust compiler installed. Alacritty is currently
- pinned to a certain Rust nightly, and the compiler/nightly dependencies are
- updated as needed. To install the correct compiler, run:
+3. Make sure you have the right Rust compiler installed. Alacritty requires nightly Rust. Run
```sh
+ rustup override set nightly
+ ```
+
+ If you run into problems, you can try a known-good version of the compiler by running
+
+ ```sh
rustup override set $(cat rustc-version)
```
@@ -94,6 +98,14 @@ still found to be missing, please open an issue.
zypper install freetype-devel fontconfig-devel xclip
```
+##### Void Linux
+
+On [Void Linux](https://voidlinux.eu), install following packages before compiling Alacritty:
+
+```sh
+xbps-install cmake freetype-devel freetype expat-devel fontconfig xclip
+```
+
##### Other
If you build Alacritty on another Linux distribution, we would love some help
diff --git a/alacritty.yml b/alacritty.yml
index abbb275f..14fea928 100644
--- a/alacritty.yml
+++ b/alacritty.yml
@@ -193,3 +193,8 @@ key_bindings:
mouse_bindings:
- { mouse: Middle, action: PasteSelection }
+
+# Shell
+#
+# You can set this to a path to your favorite shell, e.g. /bin/fish
+shell:
diff --git a/alacritty_macos.yml b/alacritty_macos.yml
index add0c5dd..7a533e56 100644
--- a/alacritty_macos.yml
+++ b/alacritty_macos.yml
@@ -193,3 +193,7 @@ key_bindings:
mouse_bindings:
- { mouse: Middle, action: PasteSelection }
+# Shell
+#
+# You can set this to a path to your favorite shell, e.g. /bin/fish
+shell:
diff --git a/src/config.rs b/src/config.rs
index f36859c7..4511b227 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -196,6 +196,9 @@ pub struct Config {
#[serde(default="default_mouse_bindings")]
mouse_bindings: Vec<MouseBinding>,
+ /// Path to a shell program to run on startup
+ shell: Option<PathBuf>,
+
/// Path where config was loaded from
config_path: Option<PathBuf>,
}
@@ -228,6 +231,7 @@ impl Default for Config {
colors: Default::default(),
key_bindings: Vec::new(),
mouse_bindings: Vec::new(),
+ shell: None,
config_path: None,
}
}
@@ -879,6 +883,12 @@ impl Config {
.map(|p| p.as_path())
}
+ pub fn shell(&self) -> Option<&Path> {
+ self.shell
+ .as_ref()
+ .map(PathBuf::as_path)
+ }
+
fn load_from<P: Into<PathBuf>>(path: P) -> Result<Config> {
let path = path.into();
let raw = Config::read_file(path.as_path())?;
diff --git a/src/input.rs b/src/input.rs
index 8823b89e..47ce52fa 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -363,16 +363,17 @@ impl<'a, N: Notify + 'a> Processor<'a, N> {
return;
}
- // Didn't process a binding; print the provided character
- if let Some(mut string) = string {
- // from ST
- if string.len() == 1 && mods.contains(mods::ALT) {
- string.insert(0, '\x1b');
- }
+ }
- self.ctx.notifier.notify(string.into_bytes());
- self.ctx.selection.clear();
+ // Didn't process a binding; print the provided character
+ if let Some(mut string) = string {
+ // from ST
+ if string.len() == 1 && mods.contains(mods::ALT) {
+ string.insert(0, '\x1b');
}
+
+ self.ctx.notifier.notify(string.into_bytes());
+ self.ctx.selection.clear();
}
}
diff --git a/src/main.rs b/src/main.rs
index f6ccc966..fb305e7c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -93,7 +93,7 @@ fn run(mut config: Config, options: cli::Options) -> Result<(), Box<Error>> {
// The pty forks a process to run the shell on the slave side of the
// pseudoterminal. A file descriptor for the master side is retained for
// reading/writing to the shell.
- let mut pty = tty::new(display.size());
+ let mut pty = tty::new(&config, display.size());
// Create the pseudoterminal I/O loop
//
diff --git a/src/tty.rs b/src/tty.rs
index 9a4d4237..ad89397d 100644
--- a/src/tty.rs
+++ b/src/tty.rs
@@ -25,6 +25,7 @@ use libc::{self, winsize, c_int, pid_t, WNOHANG, WIFEXITED, WEXITSTATUS, SIGCHLD
use term::SizeInfo;
use display::OnResize;
+use config::Config;
/// Process ID of child process
///
@@ -202,14 +203,22 @@ fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd {
}
/// Exec a shell
-fn execsh() -> ! {
+fn execsh(config: &Config) -> ! {
let mut buf = [0; 1024];
let pw = get_pw_entry(&mut buf);
+ let shell = match config.shell() {
+ Some(shell) => match shell.to_str() {
+ Some(shell) => shell,
+ None => die!("Invalid shell value")
+ },
+ None => pw.shell
+ };
+
// setup environment
env::set_var("LOGNAME", pw.name);
env::set_var("USER", pw.name);
- env::set_var("SHELL", pw.shell);
+ env::set_var("SHELL", shell);
env::set_var("HOME", pw.dir);
env::set_var("TERM", "xterm-256color"); // sigh
@@ -223,7 +232,7 @@ fn execsh() -> ! {
}
// pw.shell is null terminated
- let shell = unsafe { CStr::from_ptr(pw.shell.as_ptr() as *const _) };
+ let shell = unsafe { CStr::from_ptr(shell.as_ptr() as *const _) };
let argv = [shell.as_ptr(), ptr::null()];
@@ -239,7 +248,7 @@ fn execsh() -> ! {
}
/// Create a new tty and return a handle to interact with it.
-pub fn new<T: ToWinsize>(size: T) -> Pty {
+pub fn new<T: ToWinsize>(config: &Config, size: T) -> Pty {
let win = size.to_winsize();
let (master, slave) = openpty(win.ws_row as _, win.ws_col as _);
@@ -265,7 +274,7 @@ pub fn new<T: ToWinsize>(size: T) -> Pty {
}
// Exec a shell!
- execsh();
+ execsh(config);
},
Relation::Parent(pid) => {
unsafe {