Skip to main content
The glide.ctx object provides read-only access to runtime context information about the current browser state.

Properties

mode

glide.ctx.mode: GlideMode
The currently active mode. Example:
if (glide.ctx.mode === 'normal') {
  console.log('Currently in normal mode');
}

version

glide.ctx.version: string
The current Glide version. Example:
console.log(glide.ctx.version); // "0.1.53a"

firefox_version

glide.ctx.firefox_version: string
The Firefox version that Glide is based on. Example:
console.log(glide.ctx.firefox_version); // "145.0b6"

url

glide.ctx.url: URL
The URL of the currently focused tab. Example:
if (glide.ctx.url.hostname === 'github.com') {
  // Apply GitHub-specific configuration
}
Implementation:
get url() {
  const url = (gBrowser?.selectedBrowser?.currentURI as nsIURI)?.spec;
  if (!url) {
    throw new Error("Could not resolve the current URL.");
  }
  return new GlideBrowser.sandbox_window.URL(url);
}

os

glide.ctx.os: "linux" | "win" | "macosx" | "ios" | "android" | "other"
The operating system Glide is running on. Example:
if (glide.ctx.os === 'macosx') {
  // macOS-specific keybindings
  glide.keymaps.set('normal', '<D-c>', 'yank');
}
Implementation:
get os() {
  const { AppConstants } = ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs");
  return GlideBrowser.testing.override_os ?? AppConstants.platform;
}

Methods

is_editing()

glide.ctx.is_editing(): Promise<boolean>
Returns whether the currently focused element is editable. This includes but is not limited to:
  • <textarea> elements
  • <input> elements
  • Elements with contenteditable="true"
Example:
const editing = await glide.ctx.is_editing();
if (editing) {
  console.log('User is editing text');
}
Implementation:
async is_editing() {
  return await GlideBrowser.get_focused_actor().send_query("Glide::Query::IsEditing");
}

Usage Examples

Conditional Configuration Based on OS

if (glide.ctx.os === 'macosx') {
  glide.keymaps.set('normal', '<D-t>', 'tab_new');
} else {
  glide.keymaps.set('normal', '<C-t>', 'tab_new');
}

URL-Based Autocmds

glide.autocmds.create('UrlEnter', { hostname: 'github.com' }, () => {
  console.log('Navigated to:', glide.ctx.url.href);
});

Mode-Aware Behavior

glide.keymaps.set('normal', '<leader>m', () => {
  console.log('Current mode:', glide.ctx.mode);
  console.log('Glide version:', glide.ctx.version);
  console.log('Firefox version:', glide.ctx.firefox_version);
});