These reference docs are not complete yet, some symbols and types are missing completely.
For a full reference, see the types file that Glide generates.
Glide also exposes the browser Web Extensions API, the browser UI document, and the browser UI window.
Index
glide.ctx
glide.ctx.mode
glide.ctx.version
glide.ctx.firefox_version
glide.ctx.url
glide.ctx.os
glide.ctx.is_editing()
glide.o
glide.o.mapping_timeout
glide.o.yank_highlight
glide.o.yank_highlight_time
glide.o.which_key_delay
glide.o.jumplist_max_entries
glide.o.hint_size
glide.o.hint_chars
glide.o.hint_label_generator
glide.o.switch_mode_on_focus
glide.o.scroll_implementation
glide.o.native_tabs
glide.bo
glide.options
glide.options.get()
glide.env
glide.env.get()
glide.env.set()
glide.env.delete()
glide.process
glide.process.spawn()
glide.process.execute()
glide.autocmds
glide.autocmds.remove()
glide.styles
glide.styles.add()
glide.styles.remove()
glide.styles.has()
glide.styles.get()
glide.prefs
glide.prefs.set()
glide.prefs.get()
glide.prefs.clear()
glide.g
glide.g.mapleader
glide.tabs
glide.tabs.active()
glide.tabs.get_first()
glide.tabs.query()
glide.commandline
glide.commandline.show()
glide.commandline.is_active()
glide.excmds
glide.excmds.execute()
glide.excmds.create()
glide.content
glide.content.fn()
glide.content.execute()
glide.keymaps
glide.keymaps.set()
glide.keymaps.del()
glide.keymaps.list()
glide.hints
glide.hints.show()
glide.hints.label_generators
glide.hints.label_generators.prefix_free
glide.hints.label_generators.numeric
glide.buf
glide.buf.prefs
glide.buf.prefs.set()
glide.buf.keymaps
glide.buf.keymaps.set()
glide.buf.keymaps.del()
glide.addons
glide.addons.install()
glide.addons.list()
glide.search_engines
glide.search_engines.add()
glide.keys
glide.keys.send()
glide.keys.next()
glide.keys.next_passthrough()
glide.keys.next_str()
glide.keys.parse()
glide.unstable
glide.unstable.split_views
glide.unstable.split_views.create()
glide.unstable.split_views.get()
glide.unstable.split_views.separate()
glide.unstable.split_views.has_split_view()
glide.unstable.include()
glide.path
glide.path.cwd
glide.path.home_dir
glide.path.temp_dir
glide.path.profile_dir
glide.path.join()
glide.fs
glide.fs.read()
glide.fs.write()
glide.fs.exists()
glide.fs.stat()
glide.messengers
glide.messengers.create()
glide.modes
glide.modes.register()
glide.modes.list()
glide.SpawnOptions
glide.Process
glide.CompletedProcess
glide.RGBString
glide.TabWithID
glide.AddonInstallOptions
glide.Addon
glide.AddonInstall
glide.AddonType
glide.KeyEvent
glide.KeySendOptions
glide.KeymapCallback
glide.KeymapContentCallback
glide.KeymapCallbackProps
glide.HintLabelGenerator
glide.HintLabelGeneratorProps
glide.HintPicker
glide.HintPickerProps
glide.HintLocation
glide.HintAction
glide.HintActionProps
glide.SplitViewCreateOpts
glide.SplitView
glide.KeyNotation
glide.Keymap
glide.KeymapOpts
glide.KeymapDeleteOpts
glide.CommandLineShowOpts
glide.CommandLineCustomOption
glide.FileInfo
DOM.create_element()
glide #
• glide.ctx #
glide.ctx.mode: GlideMode #
The currently active mode.
glide.ctx.version: string #
The current glide version.
@example "0.1.53a"
glide.ctx.firefox_version: string #
The firefox version that glide is based on.
@example "145.0b6"
glide.ctx.url: URL #
The URL of the currently focused tab.
glide.ctx.os #
The operating system Glide is running on.
glide.ctx.is_editing(): Promise<boolean> #
glide.ctx.is_editing(): Promise<boolean> #Whether or not the currently focused element is editable.
This includes but is not limited to <textarea>, <input>, contenteditable=true.
• glide.o: GlideOptions #
Set browser-wide options.
You can define your own options by declaration merging GlideOptions:
declare global {
interface GlideOptions {
my_custom_option?: boolean;
}
}
glide.o.mapping_timeout: number #
How long to wait until cancelling a partial keymapping execution.
For example, glide.keymaps.set('insert', 'jj', 'mode_change normal'), after pressing j once, this option determines how long the delay should be until the j key is considered fully pressed and the mapping sequence is reset.
note: this only applies in insert mode.
@default 200
glide.o.yank_highlight: glide.RGBString #
Color used to briefly highlight text when it's yanked.
@example "#ff6b35" // Orange highlight
@example "rgb(255, 0, 0)" // Red highlight
@default "#edc73b"
glide.o.yank_highlight_time: number #
How long, in milliseconds, to highlight the selection for when it's yanked.
@default 150
glide.o.which_key_delay: number #
The delay, in milliseconds, before showing the which key UI.
@default 300
glide.o.jumplist_max_entries: number #
The maximum number of entries to include in the jumplist, i.e. how far back in history will the jumplist store.
@default 100
glide.o.hint_size: string #
The font size of the hint label, directly corresponds to the font-size property.
@default "11px"
glide.o.hint_chars: string #
The characters to include in hint labels.
@default "hjklasdfgyuiopqwertnmzxcvb"
glide.o.hint_label_generator: glide.HintLabelGenerator #
A function to produce labels for the given hints. You can provide your own function or use an included one:
glide.hints.label_generators.prefix_free; this is the default.
For example:
glide.o.hint_label_generator = ({ hints }) =>
Array.from({ length: hints.length }, (_, i) => String(i));
Or using data from the hinted elements through content.execute():
glide.hints.show({
async label_generator({ content }) {
const texts = await content.execute((element) =>
element.textContent
);
return texts.map((text) =>
text.trim().toLowerCase().slice(0, 2)
);
},
});
note: the above example is a very naive implementation and will result in issues if there are multiple elements that start with the same text.
glide.o.switch_mode_on_focus: boolean #
Determines if the current mode will change when certain element types are focused.
For example, if true then Glide will automatically switch to insert mode when an editable element is focused.
This can be useful for staying in the same mode while switching tabs.
@default true
glide.o.scroll_implementation #
Configure the strategy for implementing scrolling, this affects the h, j, k, l,<C-u>, <C-d>, G, and gg mappings.
This is exposed as the current keys implementation can result in non-ideal behaviour if a website overrides arrow key events.
This will be removed in the future when the kinks with the keys implementation are ironed out.
@default "keys"
glide.o.native_tabs #
Configure the behavior of the native tab bar.
- show
- hide
- autohide (animated) shows the bar when the cursor is hovering over its default position
This works for both horizontal and vertical tabs.
For vertical tabs, the default collapsed width can be adjusted like this:
glide.o.native_tabs = "autohide";
// fully collapse vertical tabs
glide.styles.add(css`
:root {
--uc-tab-collapsed-width: 2px;
}
`);
See firefox-csshacks for more information.
warning: autohide does not work on MacOS at the moment.
@default "show"
• glide.bo: Partial<glide.Options> #
Set buffer specific options.
This has the exact same API as glide.o.
• glide.options #
glide.options.get(name): glide.Options[Name] #
glide.options.get(name): glide.Options[Name] #Returns either a buffer-specific option, or the global version. In that order
• glide.env #
glide.env.get(name): string | null #
glide.env.get(name): string | null #Get the value of an environment variable.
If it does not exist null is returned.
glide.env.set(name, value): void #
glide.env.set(name, value): void #Set the value of an environment variable.
glide.env.delete(name): string | null #
glide.env.delete(name): string | null #Remove an environment variable.
Does not error if the environment variable did not already exist.
Returns the value of the deleted environment variable, if it did not exist null is returned.
• glide.process #
glide.process.spawn(command, args?, opts?): Promise<glide.Process> #
glide.process.spawn(command, args?, opts?): Promise<glide.Process> #Spawn a new process. The given command can either be the name of a binary in the PATH or an absolute path to a binary file.
If the process exits with a non-zero code, an error will be thrown, you can disable this check with { check_exit_code: false }.
const proc = await glide.process.spawn("kitty", [
"nvim",
"glide.ts",
], { cwd: "~/.dotfiles/glide" });
console.log("opened kitty with pid", proc.pid);
note: on macOS, the PATH environment variable is likely not set to what you'd expect, as applications do not inherit your shell environment. you can update it with glide.env.set("PATH", "/usr/bin:/usr/.local/bin").
glide.process.execute(command, args?, opts?): Promise<glide.CompletedProcess> #
glide.process.execute(command, args?, opts?): Promise<glide.CompletedProcess> #Spawn a new process and wait for it to exit.
See glide.process.spawn for more information.
• glide.autocmds #
glide.autocmds.remove(event, callback): boolean #
glide.autocmds.remove(event, callback): boolean #Remove a previously created autocmd.
e.g. to create an autocmd that is only invoked once:
glide.autocmds.create(
"UrlEnter",
/url/,
function autocmd() {
// ... do things
glide.autocmds.remove("UrlEnter", autocmd);
},
);
If the given event/callback does not correspond to any previously created autocmds, then false is returned.
• glide.styles #
glide.styles.add(styles, opts?): void #
glide.styles.add(styles, opts?): void #Add custom CSS styles to the browser UI.
glide.styles.add(css`
#TabsToolbar {
visibility: collapse !important;
}
`);
If you want to remove the styles later on, you can pass an ID with glide.styles.add(..., { id: 'my-id'}, and then remove it with glide.styles.remove('my-id').
glide.styles.remove(id): boolean #
glide.styles.remove(id): boolean #Remove custom CSS that has previously been added.
glide.styles.add(
css`
#TabsToolbar {
visibility: collapse !important;
}
`,
{ id: "disable-tab-bar" },
);
// ...
glide.styles.remove("disable-tab-bar");
If the given ID does not correspond to any previously registered styles, then false is returned.
glide.styles.has(id): boolean #
glide.styles.has(id): boolean #Returns whether or not custom CSS has been registered with the given id.
glide.styles.get(id): string | undefined #
glide.styles.get(id): string | undefined #Returns the CSS string for the given id, or undefined if no styles have been registered with that ID.
• glide.prefs #
glide.prefs.set(name, value): void #
glide.prefs.set(name, value): void #Set a preference. This is an alternative to prefs.js / about:config so that all customisation can be represented in a single glide.ts file.
warning: this function is expected to be called at the top-level of your config, there is no guarantee that calling glide.prefs.set in callbacks will result in the pref being properly applied everywhere.
warning: there is also no guarantee that these settings will be applied when first loaded, sometimes a restart is required.
glide.prefs.get(name): string | number | boolean | undefined #
glide.prefs.get(name): string | number | boolean | undefined #Get the value of a pref.
If the pref is not defined, then undefined is returned.
glide.prefs.clear(name): void #
glide.prefs.clear(name): void #Reset the pref value back to its default.
• glide.g: GlideGlobals #
Equivalent to vim.g.
You can also store arbitrary data here in a typesafe fashion with:
declare global {
interface GlideGlobals {
my_prop?: boolean;
}
}
glide.g.my_prop = true;
glide.g.mapleader: string #
The key notation that any <leader> mapping matches against.
For example, a mapping defined with <leader>r would be matched when Space + r is pressed.
@default "<Space>"
• glide.tabs #
glide.tabs.active(): Promise<glide.TabWithID> #
glide.tabs.active(): Promise<glide.TabWithID> #Returns the active tab for the currently focused window.
This is equivalent to:
const tab = await browser.tabs.query({
active: true,
currentWindow: true,
})[0];
But with additional error handling for invalid states.
glide.tabs.get_first(query): Promise<Browser.Tabs.Tab | undefined> #
glide.tabs.get_first(query): Promise<Browser.Tabs.Tab | undefined> #Find the first tab matching the given query filter.
This is the same API as browser.tabs.get, but returns the first tab instead of an Array.
glide.tabs.query(query): Promise<Browser.Tabs.Tab[]> #
glide.tabs.query(query): Promise<Browser.Tabs.Tab[]> #Gets all tabs that have the specified properties, or all tabs if no properties are specified.
This is the same API as browser.tabs.get,
• glide.commandline #
glide.commandline.show(opts?): Promise<void> #
glide.commandline.show(opts?): Promise<void> #Show the commandline UI.
By default this will list all excmds, but you can specify your own options, e.g.
glide.commandline.show({
title: "my options",
options: ["option 1", "option 2", "option 3"].map((
label,
) => ({
label,
execute() {
console.log(`label ${label} was selected`);
},
})),
});
glide.commandline.is_active(): boolean #
glide.commandline.is_active(): boolean #If the commandline is open and focused.
• glide.excmds #
glide.excmds.execute(cmd): Promise<void> #
glide.excmds.execute(cmd): Promise<void> #Execute an excmd, this is the same as typing :cmd --args.
glide.excmds.create(info, fn): Excmd #
glide.excmds.create(info, fn): Excmd #Create a new excmd.
e.g.
const cmd = glide.excmds.create({
name: "my_excmd",
description: "...",
}, () => {
// ...
});
declare global {
interface ExcmdRegistry {
my_excmd: typeof cmd;
}
}
• glide.content #
glide.content.fn(wrapped): glide.ContentFunction<F> #
glide.content.fn(wrapped): glide.ContentFunction<F> #Mark a function so that it will be executed in the content process instead of the main proces.
This is useful for APIs that are typically executed in the main process, for example:
glide.excmds.create(
{ name: "focus_page" },
glide.content.fn(() => {
document.body!.focus();
}),
);
glide.content.execute(func, opts): Promise<Return> #
glide.content.execute(func, opts): Promise<Return> #Execute a function in the content process for the given tab.
await glide.content.execute(() => {
document.body!.appendChild(DOM.create_element("p", [
"this will show up at the bottom of the page!",
]));
}, { tab_id: await glide.tabs.active() });
The given function will be stringified before being sent across processes, which means it cannot capture any outside variables.
If you need to pass some context into the function, use args, e.g.
function set_body_border_style(css: string) {
document.body.style.setProperty("border", css);
}
await glide.content.execute(set_body_border_style, {
tab_id,
args: ["20px dotted pink"],
});
Note: all args must be JSON serialisable.
• glide.keymaps #
glide.keymaps.set(modes, lhs, rhs, opts?): void #
glide.keymaps.set(modes, lhs, rhs, opts?): void #glide.keymaps.del(modes, lhs, opts?): void #
glide.keymaps.del(modes, lhs, opts?): void #Remove the mapping of {lhs} for the {modes} where the map command applies.
The mapping may remain defined for other modes where it applies.
glide.keymaps.list(modes?): glide.Keymap[] #
glide.keymaps.list(modes?): glide.Keymap[] #List all global key mappings.
If a key mapping is defined for multiple modes, multiple entries will be returned for each mode.
• glide.hints #
glide.hints.show(opts?): void #
glide.hints.show(opts?): void #Find and show hints for "clickable" elements in the content frame.
An optional action() function can be passed that will be invoked when a hint is selected.
glide.hints.label_generators #
glide.hints.label_generators.prefix_free: glide.HintLabelGenerator #
Use with glide.o.hint_label_generator to generate prefix-free combinations of the characters in glide.o.hint_chars.
glide.hints.label_generators.numeric: glide.HintLabelGenerator #
Use with glide.o.hint_label_generator to generate sequential numeric labels, starting at 1 and counting up. Ignores glide.o.hint_chars.
• glide.buf #
glide.buf.prefs #
glide.buf.prefs.set(name, value): void #
glide.buf.prefs.set(name, value): void #Set a preference for the current buffer. When navigating to a new buffer, the pref will be reset to the previous value.
See glide.prefs.set for more information.
glide.buf.keymaps #
glide.buf.keymaps.set(modes, lhs, rhs, opts?): void #
glide.buf.keymaps.set(modes, lhs, rhs, opts?): void #glide.buf.keymaps.del(modes, lhs, opts?): void #
glide.buf.keymaps.del(modes, lhs, opts?): void #Remove the mapping of {lhs} for the {modes} where the map command applies.
The mapping may remain defined for other modes where it applies.
• glide.addons #
glide.addons.install(xpi_url, opts?): Promise<glide.AddonInstall> #
glide.addons.install(xpi_url, opts?): Promise<glide.AddonInstall> #Installs an addon from the given XPI URL if that addon has not already been installed.
If you want to ensure the addon is reinstalled, pass { force: true }.
You can obtain an XPI URL from addons.mozilla.org by finding the extension you'd like to install, right clicking on "Add to Firefox" and selecting "Copy link".
glide.addons.list(types?): Promise<glide.Addon[]> #
glide.addons.list(types?): Promise<glide.Addon[]> #List all installed addons.
The returned addons can be filtered by type, for example to only return extensions:
await glide.addons.list("extension");
• glide.search_engines #
glide.search_engines.add(props): Promise<void> #
glide.search_engines.add(props): Promise<void> #Adds or updates a custom search engine.
The format matches chrome_settings_overrides.search_provider 0 from WebExtension manifests.
The search_url must contain {searchTerms} as a placeholder for the search query.
glide.search_engines.add({
name: "Discogs",
keyword: "disc",
search_url:
"https://www.discogs.com/search/?q={searchTerms}",
favicon_url: "https://www.discogs.com/favicon.ico",
});
note: search engines you add are not removed when this call is removed, you will need to manually remove them using about:preferences#search for now.
note: not all properties in the chrome_settings_overrides.search_provider manifest are supported, as they are not all supported by Firefox, e.g. instant_url, and image_url.
• glide.keys #
glide.keys.send(keyseq, opts?): Promise<void> #
glide.keys.send(keyseq, opts?): Promise<void> #Send a key sequence to the browser, simulating physical key presses.
The key sequence can include multiple regular keys, special keys, and modifiers.
For example:
// Send a simple key sequence, each char is sent separately
await glide.keys.send("hello");
// Send with modifiers, results in two events
// - { ctrlKey: true, key: 'a' }
// - { ctrlKey: true, key: 'c' }
await glide.keys.send("<C-a><C-c>");
glide.keys.next(): Promise<glide.KeyEvent> #
glide.keys.next(): Promise<glide.KeyEvent> #Returns a Promise that resolves to a glide.KeyEvent when the next key is pressed.
This also prevents the key input from being processed further and does not invoke any associated mappings.
If you want to inspect keys without preventing any default behaviour, you can use glide.keys.next_passthrough.
Note: there can only be one Promise registered at any given time.
Note: this does not include modifier keys by themselves, e.g. just pressing ctrl will not resolve until another key is pressed, e.g. <C-a>.
glide.keys.next_passthrough(): Promise<glide.KeyEvent> #
glide.keys.next_passthrough(): Promise<glide.KeyEvent> #Returns a Promise that resolves to a glide.KeyEvent when the next key is pressed.
Unlike glide.keys.next, this does not prevent key events from passing through into their original behaviour.
Note: this does not include modifier keys by themselves, e.g. just pressing ctrl will not resolve until another key is pressed, e.g. <C-a>.
glide.keys.next_str(): Promise<string> #
glide.keys.next_str(): Promise<string> #Returns a Promise that resolves to a string representation of the key, when the next key is pressed.
This also prevents the key input from being processed further and does not invoke any associated mappings.
If you want to inspect keys without preventing any default behaviour, you can use glide.keys.next_passthrough.
Note: there can only be one Promise registered at any given time.
Note: this does not include modifier keys by themselves, e.g. just pressing ctrl will not resolve until another key is pressed, e.g. <C-a>.
@example 'd'
@example '<C-l>'
glide.keys.parse(key_notation): glide.KeyNotation #
glide.keys.parse(key_notation): glide.KeyNotation #Parse a single key notation into a structured object.
This normalises special keys to be consistent but otherwise the parsed object only containers modifiers that were in the input string.
Shifted keys are not special cased, the returned key is whatever was given in in the input.
@example "<Space>" -> { key: "<Space>" }
@example "H" -> { key: "H" }
@example "<S-h>" -> { key: "h", shift: true }
@example "<S-H>" -> { key: "H", shift: true }
@example "<C-S-a>" -> { key: "A", shift: true, ctrl: true }
@example "<M-a>" -> { key: "a", meta: true }
• glide.unstable #
glide.unstable.split_views #
Manage tab split views.
note: split views are experimental in Firefox, there will be bugs.
glide.unstable.split_views.create(tabs, opts?): glide.SplitView #
glide.unstable.split_views.create(tabs, opts?): glide.SplitView #Start a split view with the given tabs.
At least 2 tabs must be passed.
note: this will not work if one of the given tabs is pinned.
glide.unstable.split_views.get(tab): glide.SplitView | null #
glide.unstable.split_views.get(tab): glide.SplitView | null #Given a tab, tab ID, or a splitview ID, return the corresponding split view.
glide.unstable.split_views.separate(tab): void #
glide.unstable.split_views.separate(tab): void #Revert a tab in a split view to a normal tab.
If the given tab is not in a split view, then an error is thrown.
glide.unstable.split_views.has_split_view(tab): boolean #
glide.unstable.split_views.has_split_view(tab): boolean #Whether or not the given tab is in a split view.
glide.unstable.include(path): Promise<void> #
glide.unstable.include(path): Promise<void> #Include another file as part of your config. The given file is evluated as if it was just another Glide config file.
note: this function cannot be called from inside a file that has been included itself, i.e. nested glide.unstable.include calls are not supported.
@example glide.unstable.include("shared.glide.ts")
• glide.path #
glide.path.cwd #
glide.path.home_dir #
glide.path.temp_dir #
glide.path.profile_dir #
glide.path.join(...parts): string #
glide.path.join(...parts): string #Join all arguments together and normalize the resulting path.
Throws an error on non-relative paths.
• glide.fs #
glide.fs.read(path, encoding): Promise<string> #
glide.fs.read(path, encoding): Promise<string> #Read the file at the given path.
Relative paths are resolved relative to the config directory, if no config directory is defined then relative paths are not allowed.
The encoding must currently be set to "utf8" as that is the only supported encoding.
@example await glide.fs.read("github.css", "utf8");
glide.fs.write(path, contents): Promise<void> #
glide.fs.write(path, contents): Promise<void> #Write to the file at the given path.
Relative paths are resolved relative to the config directory, if no config directory is defined then relative paths are not allowed.
If the path has parent directories that do not exist, they will be created.
The contents are written in utf8.
@example await glide.fs.write("github.css", ".copilot { display: none !important }");
glide.fs.exists(path): Promise<boolean> #
glide.fs.exists(path): Promise<boolean> #Determine if the given path exists.
Relative paths are resolved relative to the config directory, if no config directory is defined then relative paths are not allowed.
@example await glide.fs.exists(\${glide.path.home_dir}/.config/foo`);`
glide.fs.stat(path): Promise<glide.FileInfo> #
glide.fs.stat(path): Promise<glide.FileInfo> #Obtain information about a file, such as size, modification dates, etc.
Relative paths are resolved relative to the config directory, if no config directory is defined then relative paths are not allowed.
const stat = await glide.fs.stat("userChrome.css");
stat.last_modified; // 1758835015092
stat.type; // "file"
• glide.messengers #
glide.messengers.create(receiver): glide.ParentMessenger<Messages> #
glide.messengers.create(receiver): glide.ParentMessenger<Messages> #Create a glide.ParentMessenger that can be used to communicate with the content process.
Communication is currently uni-directional, the content process can communicate with the main process, but not the other way around.
Sending and receiving messages is type safe & determined from the type variable passed to this function. e.g. in the example below, the only message that can be sent is my_message.
// create a messenger and pass in the callback that will be invoked
// when `messenger.send()` is called below
const messenger = glide.messengers.create<
{ my_message: null }
>((message) => {
switch (message.name) {
case "my_message": {
// ...
break;
}
}
});
glide.keymaps.set("normal", "gt", ({ tab_id }) => {
// note the `messenger.content.execute()` function intead of
// the typical `glide.content.execute()` function.
messenger.content.execute((messenger) => {
document.addEventListener("focusin", (event) => {
if (event.target.id === "my-element") {
messenger.send("my_message");
}
});
}, { tab_id });
});
• glide.modes #
glide.modes.register(mode, opts): void #
glide.modes.register(mode, opts): void #Register a custom mode.
note: you must also register it as a type like so:
declare global {
interface GlideModes {
leap: "leap";
}
}
glide.modes.register("leap", { caret: "block" });
glide.modes.list(): GlideMode[] #
glide.modes.list(): GlideMode[] #List all registered modes.
Types #
• glide.SpawnOptions #
cwd?: string;
env?: Record<string, string | null>;
extend_env?: boolean;
success_codes?: number[];
/**
* If `false`, do not throw an error for non-zero exit codes.
*
* @default true
*/
check_exit_code?: boolean;
/**
* Control where the stderr output is sent.
*
* If `"pipe"` then sterr is accessible through `process.stderr`.
* If `"stdout"` then sterr is mixed with stdout and accessible through `process.stdout`.
*
* @default "pipe"
*/
stderr?: "pipe" | "stdout";
• glide.Process #
pid: number;
/**
* The process exit code.
*
* `null` if it has not exited yet.
*/
exit_code: number | null;
/**
* A `ReadableStream` of `string`s from the stdout pipe.
*/
stdout: ReadableStream<string>;
/**
* A `ReadableStream` of `string`s from the stderr pipe.
*
* This is `null` if the `stderr: 'stdout'` option was set as the pipe will be forwarded
* to `stdout` instead.
*/
stderr: ReadableStream<string> | null;
/**
* Wait for the process to exit.
*/
wait(): Promise<glide.CompletedProcess>;
/**
* Kill the process.
*
* On platforms which support it, the process will be sent a `SIGTERM` signal immediately,
* so that it has a chance to terminate gracefully, and a `SIGKILL` signal if it hasn't exited
* within `timeout` milliseconds.
*
* @param {integer} [timeout=300]
* A timeout, in milliseconds, after which the process will be forcibly killed.
*/
kill(timeout?: number): Promise<glide.CompletedProcess>;
• glide.CompletedProcess #
Represents a process that has exited.
glide.Process & {
exit_code: number;
}
• glide.RGBString: '#${string} | rgb(${string})' #
• glide.TabWithID #
A web extension tab that is guaranteed to have the id property present.
Omit<Browser.Tabs.Tab, "id"> & {
id: number;
}
• glide.AddonInstallOptions #
/**
* If `true`, always install the given addon, even if it is already installed.
*
* @default false
*/
force?: boolean;
• glide.Addon #
readonly id: string;
readonly name: string;
readonly description: string;
readonly version: string;
readonly active: boolean;
readonly source_uri: URL | null;
uninstall(): Promise<void>;
• glide.AddonInstall #
glide.Addon & {
cached: boolean;
}
• glide.AddonType #
"extension" | "theme" | "locale" | "dictionary"
| "sitepermission";
• glide.KeyEvent #
KeyboardEvent & {
/**
* The vim notation of the KeyEvent, e.g.
*
* `{ ctrlKey: true, key: 's' }` -> `'<C-s>'`
*/
glide_key: string;
}
• glide.KeySendOptions #
/**
* Send the key event(s) directly through to the builtin Firefox
* input handler and skip all of the mappings defined in Glide.
*/
skip_mappings?: boolean;
• glide.KeymapCallback #
(props: glide.KeymapCallbackProps) => void
• glide.KeymapContentCallback #
glide.ContentFunction<() => void>;
• glide.KeymapCallbackProps #
/**
* The tab that the callback is being executed in.
*/
tab_id: number;
• glide.HintLabelGenerator #
(ctx: HintLabelGeneratorProps) => string[] | Promise<string[]>
• glide.HintLabelGeneratorProps #
hints: glide.Hint[];
content: {
/**
* Executes the given callback in the content process to extract properties
* from the all elements that are being hinted.
*
* For example:
* ```typescript
* const texts = await content.map((target) => target.textContent);
* ```
*/
map<R>(cb: (target: HTMLElement, index: number) => R | Promise<R>): Promise<Awaited<R>[]>;
};
• glide.HintPicker #
(props: glide.HintPickerProps) => glide.Hint[] | Promise<glide.Hint[]>
• glide.HintPickerProps #
hints: glide.Hint[];
content: {
/**
* Executes the given callback in the content process to extract properties
* from the all elements that are being hinted.
*
* For example:
* ```typescript
* const areas = await content.map((element) => element.offsetWidth * element.offsetHeight);
* ```
*/
map<R>(cb: (target: HTMLElement, index: number) => R | Promise<R>): Promise<Awaited<R>[]>;
};
• glide.HintLocation: "content" | "browser-ui" #
• glide.HintAction: "click" | "newtab-click" | ((props: glide.HintActionProps) => Promise<void> | void) #
• glide.HintActionProps #
/**
* The resolved hint that is being executed.
*/
hint: glide.ResolvedHint;
content: {
/**
* Execute the given callback in the content process to extract properties
* from the hint element.
*
* For example:
* ```typescript
* const href = await content.execute((target) => target.href);
* ```
*/
execute<R>(cb: (target: HTMLElement) => R | Promise<R>): Promise<R extends Promise<infer U> ? U : R>;
};
• glide.SplitViewCreateOpts #
id?: string;
• glide.SplitView #
id: string;
tabs: Browser.Tabs.Tab[];
• glide.KeyNotation #
/**
* @example <leader>
* @example h
* @example j
* @example K
* @example L
* @example <Tab>
*/
key: string;
// modifiers
alt: boolean;
ctrl: boolean;
meta: boolean;
shift: boolean;
• glide.Keymap #
sequence: string[];
lhs: string;
rhs: glide.ExcmdValue;
description: string | undefined;
mode: GlideMode;
• glide.KeymapOpts #
description?: string | undefined;
/**
* If `true`, applies the mapping for the current buffer instead of globally.
*
* @default {false}
*/
buffer?: boolean;
/**
* If true, the key sequence will be displayed even after the mapping is executed.
*
* This is useful for mappings that are conceptually chained but are not *actually*, e.g. `diw`.
*
* @default false
*/
retain_key_display?: boolean;
• glide.KeymapDeleteOpts #
Pick<glide.KeymapOpts, "buffer">;
• glide.CommandLineShowOpts #
/**
* Fill the commandline with this input by default.
*/
input?: string;
/**
* Configure the text shown at the top of the commandline.
*
* This is *only* used when `options` are provided.
*
* If `options` are given and this is not, then it defaults to `"options"`.
*/
title?: string;
/**
* Replace the default commandline options.
*
* For example:
*
* ```typescript
* ["option 1", "option 2", "option 3"].map((label) => ({
* label,
* execute() {
* console.log(`label ${label} was selected`);
* },
* })),
* ```
*/
options?: glide.CommandLineCustomOption[];
• glide.CommandLineCustomOption #
/** Primary text shown for this option. */
label: string;
/** Optional secondary text rendered next to the label. */
description?: string;
/**
* Optional callback used to display this option in the UI.
*
* If provided, this _replaces_ the default rendering, which is placing `label` / `description` in two columns.
*
* @example
* ```typescript
* render() {
* return DOM.create_element("div", {
* style: { display: "flex", alignItems: "center", gap: "8px" },
* children: [bookmark.title],
* });
* }
* ```
*/
render?(): HTMLElement;
/**
* Optional callback used to determine if this option matches the input entered in the commandline.
*
* This is called every time the input changes.
*
* `null` can be returned to defer to the default matcher.
*
* @example
* ```typescript
* matches({ input }) {
* return my_fuzzy_matcher(input, [bookmark.title]);
* }
* ```
*/
matches?(props: {
input: string;
}): boolean | null;
/**
* Callback that is invoked when `<enter>` is pressed while this option is focused.
*
* The `input` corresponds to the text entered in the commandline.
*/
execute(props: {
input: string;
}): void;
• glide.FileInfo #
type: "file" | "directory" | null;
permissions: number | undefined;
last_accessed: number | undefined;
last_modified: number | undefined;
creation_time: number | undefined;
path: string | undefined;
size: number | undefined;
DOM #
Helper functions for interacting with the DOM.
note: this is currently only available in the main process, for updating the browser UI itself. it is not available in content processes.
DOM.create_element(tag_name, props_or_children?, props?): TagName extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TagName] : HTMLElement #
DOM.create_element(tag_name, props_or_children?, props?): TagName extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[TagName] : HTMLElement #Wrapper over document.createElement() providing a more ergonomic API.
Element properties that can be assigned directly can be provided as props:
DOM.create_element("img", { src: "..." });
You can also pass a children array, or property, which will use .replaceChildren():
DOM.create_element("div", [
"text content",
DOM.create_element("img", { alt: "hint" }),
]);
// or
DOM.create_element("div", {
children: [
"text content",
DOM.create_element("img", { alt: "hint" }),
],
});