summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/tty
AgeCommit message (Collapse)Author
2023-02-02Prefer environment variables over passwdJovan Gerodetti
2022-10-22Fix startup failure on macOS with dash as /bin/shKirill Chibisov
The dash's exec doesn't have `-a` argument we rely on when running login shell, so use zsh instead. Fixes #6426.
2022-09-30Migrate from winapi to windows-syskillian
2022-09-01Add IPC config subcommandChristian Duerr
This patch adds a new mechanism for changing configuration options without editing the configuration file, by sending options to running instances through `alacritty msg`. Each window will load Alacritty's configuration file by default and then accept IPC messages for config updates using the `alacritty msg config` subcommand. By default all windows will be updated, individual windows can be addressed using `alacritty msg config --window-id "$ALACRITTY_WINDOW_ID"`. Each option will replace the config's current value and cannot be reset until Alacritty is restarted or the option is overwritten with a new value. Configuration options are passed in the format `field.subfield=value`, where `value` is interpreted as yaml. Closes #472.
2022-07-24Register Alacritty shells as tty sessions on macOSChris Copeland
Unless the `shell` config is specified, launch the user's shell with: ```sh login -flp $USER /bin/sh -c "exec -a -shell /path/to/shell" ``` On macOS, just running a shell prefixed by `-` is not sufficient to be registered as a login session for things like `w` and `logname`. However, using the `login` command changes the directory to `$HOME` before running the program by default, which is not desired. The `-l` flag disables this behavior, but also skips prepending `-` to the executed program, so shells will not run as login shells. Instead we just do this part ourselves with `exec -a`. The result is login shells that run in the intended directory and are registered as tty sessions. Fixes #3420.
2022-07-20Remove panics from UNIX PTY initializationMikayla Maki
Co-authored-by: Mikayla Maki <mikayla.c.maki@icloud.com>
2022-07-20Replace `map().unwrap_or()` with `map_or()`Chris Copeland
Use a `map_or` instead of a `map().unwrap_or()` chain.
2022-06-02Fix a few minor clippy lintsYuri Astrakhan
2022-04-06Extract `SizeInfo` from alacritty_terminalKirill Chibisov
The `SizeInfo` is a SizeInfo used for rendering, which contains information about padding, and such, however all the terminal need is number of visible lines and columns.
2021-12-19Remove shared PID/FD variablesChristian Duerr
The existing PID/FD atomics in alacritty_terminal/src/tty/unix.rs were shared across all Alacritty windows, causing problem with the new multiwindow feature. Instead of sharing these between the different windows, the master FD and shell PID are now stored on the `window_context`. Unfortunately this makes spawning new daemons a little more complicated, having to pass through additional parameters. To ease this a little bit the helper method `spawn_daemon` has been defined on the `ActionContext`, making it accessible from most parts of Alacritty's event loop. Fixes #5700.
2021-11-22Add parameters to `msg create-window` subcommandKirill Chibisov
Alacritty's `msg create-window` subcommand would previously inherit all the CLI parameters from the original executable. However not only could this lead to unexpected behavior, it also prevents multi-window users from making use of parameters like `-e`, `--working-directory`, or `--hold`. This is solved by adding a JSON-based message format to the IPC socket messages which instructs the Alacritty server on which CLI parameters should be used to create the new window. Fixes #5562. Fixes #5561. Fixes #5560.
2021-11-15Update signal-hook to 0.3.10James McCoy
2021-10-23Add multi-window supportChristian Duerr
Previously Alacritty would always initialize only a single terminal emulator window feeding into the winit event loop, however some platforms like macOS expect all windows to be spawned by the same process and this "daemon-mode" can also come with the advantage of increased memory efficiency. The event loop has been restructured to handle all window-specific events only by the event processing context with the associated window id. This makes it possible to add new terminal windows at any time using the WindowContext::new function call. Some preliminary tests have shown that for empty terminals, this reduces the cost of additional terminal emulators from ~100M to ~6M. However at this point the robustness of the daemon against issues with individual terminals has not been refined, making the reliability of this system questionable. New windows can be created either by using the new `CreateNewWindow` action, or with the `alacritty msg create-window` subcommand. The subcommand sends a message to an IPC socket which Alacritty listens on, its location can be found in the `ALACRITTY_SOCKET` environment variable. Fixes #607.
2021-10-11Update rustfmt configurationChristian Duerr
In this change I went through all current rustfmt configuration options and expanded our existing configuration with overrides whenever deemed appropriate. The `normalize_doc_attributes` option is still unstable, but seems to work without any issues. Even when passing macros like `include_str!` that is recognized properly and not normalized. So while this wasn't an issue anywhere in the code, it should make sure it never will be. When it comes to imports there are two new major additions. The `imports_granularity` and `group_imports` options. Both mostly just incorporate unwritten rules that have existed in Alacritty for a long time. Unfortunately since `alacritty_terminal` imports in `alacritty` are supposed to be separate blocks, the `group_imports` option cannot be used.
2021-09-15Remove unused struct fieldsChristian Duerr
While it might be nice to have the full `Passwd` struct around should anything ever change in the future, there's really no reason why Alacritty would need this information. So just removing things for now makes more sense than adding `#[allow(unused)]`.
2021-03-30Unify the grid line indexing typesChristian Duerr
Previously Alacritty was using two different ways to reference lines in the terminal. Either a `usize`, or a `Line(usize)`. These indexing systems both served different purposes, but made it difficult to reason about logic involving these systems because of its inconsistency. To resolve this issue, a single new `Line(i32)` type has been introduced. All existing references to lines and points now rely on this definition of a line. The indexing starts at the top of the terminal region with the line 0, which matches the line 1 used by escape sequences. Each line in the history becomes increasingly negative and the bottommost line is equal to the number of visible lines minus one. Having a system which goes into the negatives allows following the escape sequence's indexing system closely, while at the same time making it trivial to implement `Ord` for points. The Alacritty UI crate is the only place which has a different indexing system, since rendering and input puts the zero line at the top of the viewport, rather than the top of the terminal region. All instances which refer to a number of lines/columns instead of just a single Line/Column have also been changed to use a `usize` instead. This way a Line/Column will always refer to a specific place in the grid and no confusion is created by having a count of lines as a possible index into the grid storage.
2021-01-01Remove Windows WinPTY backendChristian Duerr
2020-12-22Remove terminfo dependencyCaden Haustein
Fixes #4597. Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-09-27Add support for single line terminalsii41
This changes the minimum terminal dimensions from 2 lines and 2 columns, to 1 line and 2 columns. This also reworks the `SizeInfo` to store the number of columns and lines and consistently has only the terminal lines/columns stored, instead of including the message bar and search in some places of the Alacritty renderer/input. These new changes also make it easy to properly start the selection scrolling as soon as the mouse is over the message bar, instead of waiting until it is beyond it. Fixes #4207. Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-08-31Disable WinPTY with windows-gnu toolchainMateusz Mikuła
Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-08-06Use `tcgetpgrp` to get PID for SpawnNewInstanceChristian Duerr
Fixes #4082.
2020-07-28Bump minimum supported Rust version to 1.43.0Kirill Chibisov
2020-07-14Fallback to SHELL instead of passwd if presentMattbazooka
Instead of just always falling back to the shell specified in the passwd file when no config or cli shell was specified, Alacritty will not first look at the `$SHELL` environment variable. If this is unset, it will still read the passwd file. Since macOS is a bit peculiar and does not set the `$SHELL` environment variable by default, it is set manually to the shell used by Alacritty while any existing `$SHELL` variables are ignored. This matches the behavior of iTerm and Terminal.app. Co-authored-by: Christian Duerr <contact@christianduerr.com>
2020-07-11Remove gui dependencies from alacritty_terminalKirill Chibisov
This commit removes font dependency from alacritty_terminal, so it'll simplify the usage of alacritty_terminal as a library, since you won't link to system's libraries anymore. It also moves many alacritty related config options from it. Fixes #3393.
2020-06-06Remove copyright notice from filesChristian Duerr
Keeping the license as part of every file bloats up the files unnecessarily and introduces an additional overhead to the creation of new modules. Since cargo already provides excellent dependency management, most of the code-reuse of Alacritty should occur through Rust's dependency management instead of copying it source. If code is copied partially, copying the license from the main license file should be just as easy as copying from the top of the file and making some adjustments based on where it is used is likely necessary anyways.
2020-06-05Refactor Shell, Command, and Launcher to share implKirill Chibisov
2020-06-02Add cargo feature for WinPTYDavid Hewitt
2020-05-27Set IUTF8 input setting on supported platformsKirill Chibisov
Fixes #3769.
2020-05-05Extend style guideline documentationChristian Duerr
2020-02-10Revert "Fix backspace deleting chars when IME is open"Christian Duerr
This reverts commit 7f4dce2ee04859fb0b48f15cf808b60065778703. Originally it was assumed that macOS always sends the \x7f on backspace anyways, however this is not true. It seems like the character on backspace can change even within the same terminal session, so we need to have our own binding to reliably set the correct binding. A solution for #1606 should be implemented in cooperation with winit.
2020-01-28Fix inconsistent test module namingChristian Duerr
2020-01-15Remove Windows working directory canonicalizationDavid Hewitt
Fixes #3198.
2020-01-12Fix crash with invalid working directoryChristian Duerr
2020-01-02Clean up Windows PTY string handlingDavid Hewitt
Removes widestring and dunce dependencies, reduces some code duplication and corrects a few typos.
2019-12-29Remove outdated information from READMEKirill Chibisov
2019-12-22Remove unneeded NamedPipe::connect() callsDavid Hewitt
In the way the code was set up, these calls would always do nothing and return io::ErrorKind::WouldBlock, so they can be safely removed.
2019-12-21Default to ConPTY instead of WinPTYDavid Hewitt
2019-12-15Add conpty dynamic loading restrictions docssterlingjensen
2019-12-14Send PTY resize messages through event loopDavid Hewitt
This allows us to clean up the Arcs on windows, as well as tidy up the code on unix a little too. Fixes #3086.
2019-12-12Fix deadlock when closing on Windows using ConptyDavid Hewitt
Fixes #3042.
2019-12-05Remove unnecessary lifetimes from winptysterlingjensen
2019-11-16Fix WinPTY freeze on terminationMaciej Makowski
Fixes #2889.
2019-10-15Print launch command name on failureChristian Duerr
2019-10-14Add support for title stack escape sequencesDustin
This commit adds the concept of a "title stack" to the terminal. Some programs (e.g. vim) send control sequences `CSI 22 ; 0` (push title) and `CSI 23 ; 0` (pop title). The title stack is just a history of previous titles. Applications can push the current title onto the stack, and pop it back off (setting the window title in the process). Fixes #2840.
2019-10-05Update to winit/glutin EventLoop 2.0Christian Duerr
This takes the latest glutin master to port Alacritty to the EventLoop 2.0 rework. This changes a big part of the event loop handling by pushing the event loop in a separate thread from the renderer and running both in parallel. Fixes #2796. Fixes #2694. Fixes #2643. Fixes #2625. Fixes #2618. Fixes #2601. Fixes #2564. Fixes #2456. Fixes #2438. Fixes #2334. Fixes #2254. Fixes #2217. Fixes #1789. Fixes #1750. Fixes #1125.
2019-09-13Fix empty block selection detectionChristian Duerr
Fixes #2789.
2019-09-10Replace uninitialized with MaybeUninitMatthias Krüger
2019-08-04Remove errno depedencyChristian Duerr
2019-07-30Bump minimum supported Rust version to 1.34.0Christian Duerr
2019-06-16Unset DESKTOP_STARTUP_ID environment variableChristian Duerr
This unsets the DESKTOP_STARTUP_ID environment variable at startup, to prevent child processes from inheriting it. This solves problems with child windows not properly spawning in the foreground with KDE. More information can be found here: https://specifications.freedesktop.org/startup-notification-spec/startup-notification-latest.txt