Vicinae

Utilities

System-level functions for opening files, running terminal commands, querying applications, and controlling the launcher window.

open

Open a URL or file with the default application, or a specific one.

import { open } from "@vicinae/api";

await open("https://vicinae.org");
await open("/path/to/file.pdf");
await open("/path/to/file.txt", "code");

runInTerminal

Run a command in a new terminal window. The arguments are not interpreted by a shell.

import { runInTerminal } from "@vicinae/api";

await runInTerminal(["journalctl", "--user", "-u", "vicinae", "-f"]);

To run a shell command, wrap it explicitly:

await runInTerminal(["/bin/bash", "-c", "echo $HOME"], { hold: true });

Options

OptionDescription
holdKeep the terminal open after the command finishes
workingDirectorySet the working directory
appIdOverride the application ID for the terminal window
titleOverride the window title

Options are hints to the terminal emulator and may not be honored by all terminals. Vicinae follows the xdg-terminal-exec specification.

showInFileBrowser

Reveal a file or folder in the system file browser.

import { showInFileBrowser } from "@vicinae/api";

await showInFileBrowser("/path/to/file.txt");
await showInFileBrowser("/path/to/file.txt", { select: true });

trash

Move files to the system trash.

import { trash } from "@vicinae/api";

await trash("/path/to/file.txt");
await trash(["/path/to/a.txt", "/path/to/b.txt"]);

Applications

Query installed applications on the system.

import { getApplications, getDefaultApplication, getFrontmostApplication } from "@vicinae/api";

const apps = await getApplications();
const defaultApp = await getDefaultApplication("/path/to/file.pdf");
const frontmost = await getFrontmostApplication();

Each Application has id, name, path, and an optional icon.

closeMainWindow

Close the launcher window. Useful after performing an action that doesn't need further user interaction.

import { closeMainWindow } from "@vicinae/api";

await closeMainWindow();

showHUD

Close the launcher window and show a brief heads-up message.

import { showHUD } from "@vicinae/api";

await showHUD("Copied to clipboard!");

popToRoot

Reset the navigation stack to the root view of the current command.

import { popToRoot } from "@vicinae/api";

await popToRoot();

getSelectedText

Get the currently selected text. Often combined with Clipboard.paste to replace the selected text with something else.

import { getSelectedText, Clipboard } from "@vicinae/api";

const selected = await getSelectedText();
await Clipboard.paste(selected.toUpperCase());