mirror of
https://github.com/wez/wezterm.git
synced 2024-12-27 07:18:13 +03:00
b224aa1b56
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
93 lines
2.4 KiB
TOML
93 lines
2.4 KiB
TOML
[package]
|
|
name = "window"
|
|
version = "0.1.0"
|
|
authors = ["Wez Furlong"]
|
|
edition = "2018"
|
|
repository = "https://github.com/wez/wezterm"
|
|
description = "Cross platform window setup and render"
|
|
license = "MIT"
|
|
build = "build.rs"
|
|
|
|
[dev-dependencies]
|
|
k9 = "0.11.0"
|
|
|
|
[build-dependencies]
|
|
gl_generator = "0.14"
|
|
|
|
[features]
|
|
wayland = ["wayland-client", "smithay-client-toolkit", "wayland-egl", "wayland-protocols"]
|
|
|
|
[dependencies]
|
|
async-channel = "1.6"
|
|
async-io = "1.1"
|
|
async-task = "4.0"
|
|
async-trait = "0.1"
|
|
anyhow = "1.0"
|
|
bytes = "1.0"
|
|
config = { path = "../config" }
|
|
downcast-rs = "1.0"
|
|
thiserror = "1.0"
|
|
bitflags = "1.3"
|
|
euclid = "0.22"
|
|
guillotiere = "0.6"
|
|
lazy_static = "1.4"
|
|
libloading = "0.6"
|
|
line_drawing = "0.8"
|
|
log = "0.4"
|
|
metrics = { version="0.17", features=["std"]}
|
|
promise = { path = "../promise" }
|
|
raw-window-handle = "0.5"
|
|
resize = "0.5"
|
|
serde = {version="1.0", features = ["rc", "derive"]}
|
|
tiny-skia = "0.8"
|
|
glium = { version = "0.31", default-features = false }
|
|
url = "2"
|
|
wezterm-bidi = { path = "../bidi" }
|
|
wezterm-color-types = { path = "../color-types" }
|
|
wezterm-font = { path = "../wezterm-font" }
|
|
wezterm-input-types = { path = "../wezterm-input-types" }
|
|
|
|
[target."cfg(windows)".dependencies]
|
|
clipboard-win = "2.2"
|
|
shared_library = "0.1"
|
|
winapi = { version = "0.3", features = [
|
|
"dwmapi",
|
|
"handleapi",
|
|
"imm",
|
|
"libloaderapi",
|
|
"synchapi",
|
|
"sysinfoapi",
|
|
"winerror",
|
|
"winuser",
|
|
]}
|
|
windows = { version="0.33.0", features = [
|
|
"UI_ViewManagement",
|
|
"Win32_Devices_Display",
|
|
]}
|
|
winreg = "0.10"
|
|
|
|
[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
|
|
dirs-next = "2.0"
|
|
filedescriptor = { version="0.8", path = "../filedescriptor" }
|
|
x11 = {version ="2.19", features = ["xlib_xcb", "xlib"]}
|
|
xcb = {version="1.2", features=["render", "randr", "dri2", "xkb", "xlib_xcb", "present"]}
|
|
xkbcommon = { version = "0.5.0", features = ["x11", "wayland"] }
|
|
mio = {version="0.8", features=["os-ext"]}
|
|
libc = "0.2"
|
|
smithay-client-toolkit = {version = "0.15", default-features=false, optional=true}
|
|
wayland-protocols = {version="0.29", optional=true}
|
|
wayland-client = {version="0.29", optional=true}
|
|
wayland-egl = {version="0.29", optional=true}
|
|
xcb-imdkit = { version="0.2", git="https://github.com/wez/xcb-imdkit-rs.git", branch="hangfix"}
|
|
zbus = "3.0"
|
|
zvariant = "3.6"
|
|
futures-util = "0.3"
|
|
|
|
[target.'cfg(target_os="macos")'.dependencies]
|
|
cocoa = "0.20"
|
|
objc = "0.2"
|
|
clipboard_macos = "0.1"
|
|
core-foundation = "0.7"
|
|
core-graphics = "0.19"
|
|
cgl = "0.3"
|