Make keymaps reusable across platforms (#10811)
This PR includes two relevant changes: - Platform binds (super, windows, cmd) will now parse on all platforms, regardless of which one is being used. While very counter-intuitive (this means that `cmd-d` will actually be triggered by `win-d` on windows) this makes it possible to reuse keymap files across platforms easily - There is now a KeyContext `os == linux`, `os == macos` or `os == windows` available in keymaps. This allows users to specify certain blocks of keybinds only for one OS, allowing you to minimize the amount of keymappings that you have to re-configure for each platform. Release Notes: - Added `os` KeyContext, set to either `linux`, `macos` or `windows` - Fixed keymap parsing errors when `cmd` was used on linux, `super` was used on mac, etc.
This commit is contained in:
parent
33baa377c7
commit
7f81bfb6b7
11 changed files with 24 additions and 15 deletions
|
@ -552,7 +552,7 @@ impl Dock {
|
|||
}
|
||||
|
||||
fn dispatch_context() -> KeyContext {
|
||||
let mut dispatch_context = KeyContext::default();
|
||||
let mut dispatch_context = KeyContext::new_with_defaults();
|
||||
dispatch_context.add("Dock");
|
||||
|
||||
dispatch_context
|
||||
|
|
|
@ -1944,7 +1944,7 @@ impl FocusableView for Pane {
|
|||
|
||||
impl Render for Pane {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let mut key_context = KeyContext::default();
|
||||
let mut key_context = KeyContext::new_with_defaults();
|
||||
key_context.add("Pane");
|
||||
if self.active_item().is_none() {
|
||||
key_context.add("EmptyPane");
|
||||
|
|
|
@ -3945,7 +3945,7 @@ struct DraggedDock(DockPosition);
|
|||
|
||||
impl Render for Workspace {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
let mut context = KeyContext::default();
|
||||
let mut context = KeyContext::new_with_defaults();
|
||||
context.add("Workspace");
|
||||
let centered_layout = self.centered_layout
|
||||
&& self.center.panes().len() == 1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue