1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-23 23:21:08 +03:00
Commit Graph

853 Commits

Author SHA1 Message Date
Jalil David Salamé Messina
cb9dc3a800 fix(clippy): Remove unnecessary clone/to_string calls 2023-03-16 07:40:12 -07:00
Jalil David Salamé Messina
c6dc38b7f3 fix(clippy): Derive Default where possible 2023-03-15 10:21:11 -07:00
Wez Furlong
508ea437df
window: negative caching for xdg-portal
When it outright doesn't work, just cache that state rather than
repeatedly querying it.

refs: https://github.com/wez/wezterm/issues/3082
2023-02-09 08:49:35 -07:00
Wez Furlong
fd5c6dceb1
window: use a shorter timeout for xdg portal reads
A user reported this:

08:47:13.372  DEBUG  window::os::x11::connection        > Unable to
   resolve appearance using xdg-desktop-portal: Read:
   org.freedesktop.DBus.Error.TimedOut: Failed to activate service
   'org.freedesktop.portal.Desktop': timed out
   (service_start_timeout=120000ms)

which is an issue with their xdg-portal service.

Rather than have wezterm block for 2 minutes on startup, we give it
1 second, and log the issue as a warning.
2023-02-08 09:19:28 -07:00
Wez Furlong
3eede5c248
macos: make initial position consistent with window:set_position
refs: https://github.com/wez/wezterm/issues/2976
2023-02-07 13:02:59 -07:00
Wez Furlong
d1d48444f9
x11: avoid "Unhandled" log line for focus events
refs: #2959
2023-02-06 08:48:38 -07:00
Wez Furlong
5dff4b1bfb
macos: fixup open_untitled_file handling
This event is not triggered unless invoking the bundle via open,
and we need to gate it until after we've finished launching, otherwise
we will open two windows on startup.

closes: https://github.com/wez/wezterm/issues/3064
refs:  https://github.com/wez/wezterm/issues/3057
2023-02-06 05:37:07 -07:00
Wez Furlong
d2fd2c6b1a
remove some debug prints
These are no longer needed
2023-02-05 18:00:22 -07:00
Wez Furlong
2271c3ae59
macos: spawn new window when clicking on dock icon
If there are no windows, clicking on the dock icon will spawn a new
window.

Requires that `quit_when_all_windows_are_closed=false`

refs:  https://github.com/wez/wezterm/issues/3057
2023-02-05 17:56:01 -07:00
Val Packett
6a47bbaf32 wayland: set scale factor without wegl_surface (for WebGpu)
This fixes wrong scale with the WebGpu backend.
2023-02-05 09:53:18 -08:00
Hong Minhee
7bc15b668f macos: Add "New Window" to the dock menu 2023-02-05 08:26:24 -08:00
Wez Furlong
1fad5b5249
deps: sctk -> 0.16 2023-02-04 07:49:30 -07:00
Wez Furlong
8ffcf546cf
wayland: improve error when no seats have pointers
I don't know why that might be the case, but this error is better
than the unwrap.

refs: https://github.com/wez/wezterm/issues/3050
2023-02-04 07:44:47 -07:00
Michael Bikovitsky
397f1d0dc9 Detect ALT key for mouse events on Windows 2023-02-04 06:37:13 -08:00
Wez Furlong
8cff8fc918
x11: simplify focus event matching
refs: #2959
2023-02-02 08:25:53 -07:00
NBonaparte
3bee573bf8 x11: ignore pointer focus events 2023-02-02 07:24:28 -08:00
Wez Furlong
f4096803e3
window_decorations: add MACOS_FORCE_(EN|DIS)ABLE_SHADOW
Evidence:
* https://github.com/wez/wezterm/issues/310#issuecomment-718288028
* https://github.com/wez/wezterm/issues/2669#issuecomment-1379829866
* https://github.com/wez/wezterm/issues/2669#issuecomment-1408144931

seems to suggest that window shadows hurt performance,
so add a way to disable them independently from window opacity.

You may use:

```
config.window_decorations = "TITLE|RESIZE|MACOS_FORCE_DISABLE_SHADOW"
```

for this.

refs: https://github.com/wez/wezterm/issues/2669
2023-01-31 22:47:59 -07:00
Wez Furlong
f15bb186f4
macos: maybe fix window positioning for multi-monitor systems
refs: https://github.com/wez/wezterm/issues/2958
2023-01-25 18:06:46 -07:00
Wez Furlong
9350795f33
x11: always update selection ownership
refs: https://github.com/wez/wezterm/issues/2926
2023-01-21 18:24:29 -07:00
Wez Furlong
730c41b7e3
cargo fmt 2023-01-19 07:47:37 -07:00
Wez Furlong
5dbdd36a72
macos: implement window:focus()
refs: https://github.com/wez/wezterm/issues/2973
2023-01-18 23:25:19 -07:00
Wez Furlong
6d2b42c95e
windows: implement focus method
refs: https://github.com/wez/wezterm/issues/2973
2023-01-18 23:19:22 -07:00
Wez Furlong
b01aa129f7
add WindowOps::focus, ActivateWindow, window:focus()
Only implemented on X11 so far.
Note that Wayland doesn't support this action at all.

refs: https://github.com/wez/wezterm/issues/2973
2023-01-18 22:58:48 -07:00
Jared Baur
88b49c9da0 wayland: hide mouse cursor when typing 2023-01-18 19:13:44 -08:00
Wez Furlong
14c749e51d
macos: ensure menubar is visible when switching away from a fullscreen window 2023-01-13 21:08:39 -07:00
Wez Furlong
a145a140f1
macos: retain menu menu when retrieving it from NSApp
refs: https://github.com/wez/wezterm/issues/2940
2023-01-12 19:29:40 -07:00
Wez Furlong
5da0ef4c12
macos: fixup application termination
The recently added app delegate was telling cocoa that we'd decide
to quit later in response to termination requests, blocking
shutdown/logout/restart.

This commit introduces a macos native modal alert to let the user
decide whether to quit or not.

While testing this, I noticed that in some cases, our internal choice
to quit had no effect.  Reading the fine print of NSApp::stop, it sounds
like calling it from a modal context will only stop a modal rather then
exit out of NSApp::run, so we explicitly bounce through an event
callback to try to make it exit from the right place.

I'm not 100% convinced by this.  I've left some debug prints in for
now to see if those give some insight in the future.

refs: https://github.com/wez/wezterm/issues/2944
2023-01-12 16:49:19 -07:00
NBonaparte
1999d2f0fc x11: determine active screen by using max intersecting area with active window 2023-01-11 08:07:52 -08:00
NBonaparte
5d5efa04fc x11: use TranslateCoordinates to get the root coordinates of focused window 2023-01-11 08:07:52 -08:00
NBonaparte
f77763275f x11: clean up active screen detection 2023-01-11 08:07:52 -08:00
NBonaparte
e31ff587f9 x11: implement active screen detection 2023-01-11 08:07:52 -08:00
Wez Furlong
890bff7faf
macos: add version info to system name 2023-01-10 18:58:35 -07:00
Wez Furlong
c19b65054f
gui: include x11 window manager in connection name 2023-01-09 16:22:48 -07:00
Wez Furlong
81f1979cd4
gui: describe connection and show it in debug overlay
Also helpful to understand the user's environment in problem reports
2023-01-09 15:59:54 -07:00
Wez Furlong
b1c3103a08
macos: update menubar when the config reloads
This is moderately painful to do, because of some objc/cocoa lifetime
concern that causes a crash when attempting to simply replace the
entire menubar, so we try to find/update items instead.

refs: https://github.com/wez/wezterm/issues/1485
2022-12-24 00:10:04 -07:00
Wez Furlong
85afd9b599
tidy up macos menubar key assignment
This commit safely registers key equivalents with the menubar.  Safe in
this context means "doesn't override a key assignment from a key table".
For example, it would suck to define an application-wide key assignment
for a key combination that has a different assignment in a key table
that may be activated conditionally by some user-defined state/mode.

refs: https://github.com/wez/wezterm/issues/1485
2022-12-23 19:59:35 -07:00
Wez Furlong
37b5dd91a5
move OpenInBrowser -> KeyAssignment
This allows defining those help actions that open URLs in the main
commands list, and not just for the macOS Help menu.

refs: https://github.com/wez/wezterm/issues/1485
2022-12-21 07:04:51 -07:00
Wez Furlong
787f6550b8
macos: link to helpful resources from Help menu 2022-12-21 00:31:58 -07:00
Wez Furlong
b5aea795ca
fixup tests
refs: https://github.com/wez/wezterm/issues/162
refs: https://github.com/wez/wezterm/issues/1485
2022-12-20 20:48:44 -07:00
Wez Furlong
b224aa1b56
macOS: add MenuBar
This took a decent amount of effort to thread through with context;
wrappers around NSMenu and NSMenuItem are added to reduce some of
the objc usability warts, and an additional NSObject wrapper is
added to help copy the KeyAssignment from the existing list
of command palette commands and associate it with the menu item.

When a menu item is selected, macOS will walk through the responder
chain and look for a responder that responds to the selector associated
with the menu item.  In practice that means that our window/view class
will be tried first, and then later, our app delegate will be tried.

This commit implements routing from both of these: the window case
routes to the associated TermWindow and drops into the existing
perform_key_assignment method.

In case there is no window (not currently possible, but will be
in the future), the app delegate also has a placeholder for dispatching
key assignments, although it will only be able to perform a subset
of the possible actions.

A couple of things to note:

* Items aren't smart enough to disable themselves or adjust their
  caption based on the context. To make that work, we either need
  to recreate the entire menubar when any possible context changes
  (doable, but feels heavy), or we need to assign a target to each
  menu item and implement a validation handler on that target.
  That seemed to mess with the responder chain when I briefly
  experimented with it.

* There's some disabled code to add a Services menu. It is disabled
  because when it is enabled, accessing either Services or Help
  from the menu bar sends the process into a busy loop somewhere
  in macOS's internals.  It's unclear what it is unhappy with.

* No keyboard accelerators are associated with the menubar yet.
  That needs some thought, as they would essentially become global
  keyboard shortcuts and take precedence over the shortcuts defined
  for other keys in the config.  This feels like it should be something
  that the user has control over, so there needs to be something to
  allow that before we go ahead and wire those up.

refs: https://github.com/wez/wezterm/issues/162
refs: https://github.com/wez/wezterm/issues/1485
2022-12-20 19:46:08 -07:00
Wez Furlong
30238acb1b
x11: potential fix for hanging IME
refs: https://github.com/H-M-H/xcb-imdkit-rs/issues/5
refs: https://github.com/wez/wezterm/issues/2819
2022-12-19 12:23:04 -07:00
Wez Furlong
28c7c0ba19
macos: allow association with .command file type
Implement an app delegate to receive a callback when the system
requests that we open `.command` files, and then ask the mux
layer to spawn a window for it and execute it via the shell.

Also allow handling `.sh`, `.zsh`, `.bash`, `.fish` and `.tool`,
per kitty.

refs: https://github.com/wez/wezterm/issues/2741
refs: https://github.com/wez/wezterm/issues/2871
2022-12-19 11:06:12 -07:00
Wez Furlong
1f7a34f8b2
fix resizing on windows when wgpu is enabled 2022-11-18 10:03:49 -07:00
Wez Furlong
883e2d11d7
make drawRect work on macos when using webgpu 2022-11-18 10:03:49 -07:00
Wez Furlong
09f1ecbf82
erase generic T from Atlas, Sprite, CachedGlyph etc.
This will make it easier to use the same impl for webgpu and opengl
for a bunch of this stuff.
2022-11-18 10:03:49 -07:00
Wez Furlong
8479be7465
Basic useless wgpu based rendering foundation 2022-11-18 10:03:49 -07:00
Wez Furlong
eaa91e9314
deps: update raw-window-handle 2022-11-18 10:03:49 -07:00
Wez Furlong
387d0ad3e3
rustdoc markdown fences-- 2022-11-15 09:40:10 -07:00
Wez Furlong
9569028d98
xcursor: parse and follow theme inheritance
A couple of users ran into an issue where wezterm couldn't find
their mouse cursor icons.

Looking more deeply into this, we weren't looking at `index.theme`
files and following the inheritance chain from them.

This commit addresses that!

refs: https://github.com/wez/wezterm/issues/2687
refs: https://github.com/wez/wezterm/issues/2743
2022-11-15 09:15:43 -07:00
Wez Furlong
cd386804c4 macos: remove UNHANDLED: IME: do_command_by_selector warnings
We handle this the same whether we know the selector or not these days,
so just remove the warning.
2022-10-22 20:03:15 -07:00