Skip to content

0.1.59a

Choose a tag to compare

@RobertCraigie RobertCraigie released this 17 Feb 00:22
4e9a77a

Breaking change: diacritic keymaps on macOS

Previously on macOS if you wanted to define a keymap with the Option key, then you would have to use the diacritic version of the key as macOS uses Option to enable diacritics.

By default Glide will now use the physical key pressed instead of the diacritic, for example:

/// before
glide.keymaps.set("normal", "<A-π>", "tab_pin");

/// after
glide.keymaps.set("normal", "<A-p>", "tab_pin");

For more information see the Key codes docs.

Findbar API

This release includes support for programmatically operating the Firefox findbar. You can now open / close the findbar, and traverse through findbar matches directly from the config.

For example, a keymap that opens the findbar to search for the text that is currently selected:

glide.keymaps.set("normal", "~", async ({ tab_id }) => {
  const selected = await glide.content.execute(
    () => window.getSelection()?.toString(),
    { tab_id },
  );
  if (!selected) {
    throw new Error("No text selected in the page");
  }
  await glide.findbar.open({ query: selected });
});

The full API includes:

Previous / next link following

This release adds the [[ and ]] default keymappings in normal mode that will automatically follow "previous" and "next" links respectively.

For example, entering ]] while on https://lobste.rs/active will take you to https://lobste.rs/page/2, then [[ will take you to https://lobste.rs/page/1.

This works by searching for link elements (e.g. <a>, <div role="link">) that contain specific text (e.g. "next", "more"). If multiple elements are found, then the element at the bottom of the page is selected.

You can customise the text strings to search for with glide.o.go_next_patterns and glide.o.go_previous_patterns.
Or use different keymappings by mapping :go_next and :go_previous.

Customisable keyboard layouts

Added support for resolving keymaps from the physical key pressed instead of whatever key string your software layout resolved it to.

This is particularly important for users with multiple keyboard layouts, as you no longer have to define keymaps multiple times for each layout, e.g.

/// before
// english
glide.keymaps.set("normal", "<C-t>", "tab_prev");
// russian
glide.keymaps.set("normal", "<C-т>", "tab_prev");

You can now tell Glide to use the physical key code instead:

/// after
glide.o.keyboard_layout = "qwerty";
glide.o.keymaps_use_physical_layout = "force";

glide.keymaps.set("normal", "<C-t>", "tab_prev");

Note

Glide still needs a way to map the key code to the corresponding key string in mappings. For example, what should pressing Shift + Digit2 be matched against?

The answer can change depending on your specific keyboard. On a US keyboard with a qwerty layout you would expect it to match against keymaps using @, but on a German keyboard it should be ".

The default keyboard layout is US qwerty. If you use a different layout, see the glide.o.keyboard_layouts option.

Half page scrolling

The <C-d> and <C-u> keymaps now scroll half pages instead of full pages like they did before. This was changed to match Vim behaviour more closely.

Changes

  • Bumped Firefox from 148.0b4 to 148.0b15
  • Blocked AI link previews by default
  • Enabled Firefox's experimental AI controls UI
  • Added glide.tabs.unload()
  • Added glide.prefs.scoped() for temporarily settings prefs with the new using keyword
  • Added DOM.listeners.has() for checking if an element has a specific event listener type registered
  • Added support for installing addons in private browsing mode with glide.addons.install('...', { private_browsing_allowed: true })
  • Added a --glide-current-mode-color CSS variable for easier mode-specific UI customisation
    • Thanks to @45Hnri for the contribution!
  • Added :tab_reopen to open the most recently closed tab
  • Added the ^ motion in normal mode
  • Fixed the I motion crossing multiple lines
  • Fixed (partially) an issue where glide.keys.next() promises could hang around after config reloads