1
1
mirror of https://github.com/walles/moar.git synced 2024-09-11 12:15:43 +03:00

Auto configure mouse settings in more terminals

Tested all the Linux ones in Virtualbox. Yay Virtualbox!
This commit is contained in:
Johan Walles 2023-12-16 18:59:58 +01:00
parent 1d1454af43
commit b067a84b36
3 changed files with 32 additions and 6 deletions

View File

@ -22,6 +22,7 @@ other terminals will send nothing, making scrolling not work.
## Text Marking Workarounds in `scroll` Mode
- **Alacritty**: Use use <kbd>shift</kbd> + mouse selection to make it work. Cred to @chrisgrieser for this tip.
- **Foot**: Use use <kbd>shift</kbd> + mouse selection to make it work. Cred to @postsolar for this tip.
- **Hyper** on macOS: Set `macOptionSelectionMode: 'force'` in your config file, then hold the Option Key <kbd></kbd> while marking
- **iTerm**: Preferences / Profiles / Default / Terminal / uncheck "Report mouse clicks & drags"
- macOS **Terminal** on a laptop: Hold down the <kbd>fn</kbd> key while marking with the mouse

View File

@ -38,6 +38,8 @@ Doing the right thing includes:
- Renders [terminal
hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)
properly
- **Mouse Scrolling** works out of the box (but
[look here for tradeoffs](https://github.com/walles/moar/blob/master/MOUSE.md))
[For compatibility reasons](https://github.com/walles/moar/issues/14), `moar`
uses the formats declared in these environment variables if present:

View File

@ -204,15 +204,11 @@ func (screen *UnixScreen) hideCursor(hide bool) {
// See also: https://github.com/walles/moar/issues/53
func terminalHasArrowKeysEmulation() bool {
// Untested:
// * https://codeberg.org/dnkl/foot
// * Konsole
// * https://github.com/gnome-terminator/terminator
// * https://gnunn1.github.io/tilix-web/
// * The Windows terminal
// Better off with mouse tracking:
// * iTerm2
// * Terminal.app
// * iTerm2 (macOS)
// * Terminal.app (macOS)
// Hyper, tested on macOS, December 14th 2023
if os.Getenv("TERM_PROGRAM") == "Hyper" {
@ -234,6 +230,33 @@ func terminalHasArrowKeysEmulation() bool {
return true
}
// GNOME Terminal, tested on Ubuntu 22.04, December 16th 2023
if os.Getenv("GNOME_TERMINAL_SCREEN") != "" {
return true
}
// Tilix, tested on Ubuntu 22.04, December 16th 2023
if os.Getenv("TILIX_ID") != "" {
return true
}
// Konsole, tested on Ubuntu 22.04, December 16th 2023
if os.Getenv("KONSOLE_VERSION") != "" {
return true
}
// Terminator, tested on Ubuntu 22.04, December 16th 2023
if os.Getenv("TERMINATOR_UUID") != "" {
return true
}
// Foot, tested on Ubuntu 22.04, December 16th 2023
if os.Getenv("TERM") == "foot" {
// Note that this test isn't very good, somebody could be running Foot
// with some other TERM setting. Other suggestions welcome.
return true
}
return false
}