Skip to content

Commit

Permalink
Finish renaming Generated Command to Generated Entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Exidex committed Jan 7, 2025
1 parent 20fa211 commit b2094be
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 117 deletions.
6 changes: 3 additions & 3 deletions bundled_plugins/gauntlet/src/applications.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GeneratedCommand, GeneratorProps } from "@project-gauntlet/api/helpers";
import { GeneratedEntrypoint, GeneratorProps } from "@project-gauntlet/api/helpers";
import { walk, WalkOptions } from "@std/fs/walk";
import { debounce } from "@std/async/debounce";
import { current_os, wayland } from "gauntlet:bridge/internal-all";
Expand Down Expand Up @@ -202,8 +202,8 @@ export default async function Applications({ add, remove, get, getAll }: Generat
async function genericGenerator<DATA>(
directoriesToWatch: string[],
appFromPath: (path: string) => Promise<undefined | DesktopPathAction<DATA>>,
commandFromApp: (id: string, data: DATA) => GeneratedCommand,
add: (id: string, data: GeneratedCommand) => void,
commandFromApp: (id: string, data: DATA) => GeneratedEntrypoint,
add: (id: string, data: GeneratedEntrypoint) => void,
remove: (id: string) => void,
walkOpts?: WalkOptions
): Promise<() => void> {
Expand Down
14 changes: 7 additions & 7 deletions bundled_plugins/gauntlet/src/window/shared.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GeneratedCommand, GeneratedCommandAccessory, GeneratedCommandAction } from "@project-gauntlet/api/helpers";
import { GeneratedEntrypoint, GeneratedEntrypointAccessory, GeneratedEntrypointAction } from "@project-gauntlet/api/helpers";
import { List } from "@project-gauntlet/api/components";
import { linux_open_application } from "gauntlet:bridge/internal-linux";

Expand All @@ -14,7 +14,7 @@ export function applicationActions(
id: string,
openApplication: () => void,
focusWindow: (windowId: string) => void,
): GeneratedCommandAction[] {
): GeneratedEntrypointAction[] {
const appWindows = Object.entries(openWindows)
.filter(([_, windowData]) => windowData.appId == id)

Expand Down Expand Up @@ -69,7 +69,7 @@ export function applicationActions(
}
}

export function applicationAccessories(id: string): GeneratedCommandAccessory[] {
export function applicationAccessories(id: string): GeneratedEntrypointAccessory[] {
const appWindows = Object.entries(openWindows)
.filter(([_, windowData]) => windowData.appId == id)

Expand All @@ -86,12 +86,12 @@ export function applicationAccessories(id: string): GeneratedCommandAccessory[]

export function addOpenWindow(
appId: string,
generatedEntrypoint: GeneratedCommand,
generatedEntrypoint: GeneratedEntrypoint,
windowId: string,
windowTitle: string,
openApplication: () => void,
focusWindow: (windowId: string) => void,
add: (id: string, data: GeneratedCommand) => void,
add: (id: string, data: GeneratedEntrypoint) => void,
) {
if (generatedEntrypoint) {
openWindows[windowId] = {
Expand All @@ -112,8 +112,8 @@ export function deleteOpenWindow(
windowId: string,
openApplication: (appId: string) => (() => void),
focusWindow: (windowId: string) => void,
get: (id: string) => GeneratedCommand | undefined,
add: (id: string, data: GeneratedCommand) => void,
get: (id: string) => GeneratedEntrypoint | undefined,
add: (id: string, data: GeneratedEntrypoint) => void,
) {
const openWindow = openWindows[windowId];
if (openWindow) {
Expand Down
14 changes: 7 additions & 7 deletions bundled_plugins/gauntlet/src/window/wayland.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { addOpenWindow, deleteOpenWindow, openLinuxApplication } from "./shared";
import { GeneratedCommand } from "@project-gauntlet/api/helpers";
import { GeneratedEntrypoint } from "@project-gauntlet/api/helpers";
import { linux_wayland_focus_window, application_wayland_pending_event } from "gauntlet:bridge/internal-linux";


Expand All @@ -9,9 +9,9 @@ export function focusWaylandWindow(windowId: string) {

export function applicationEventLoopWayland(
focusWindow: (windowId: string) => void,
add: (id: string, data: GeneratedCommand) => void,
get: (id: string) => GeneratedCommand | undefined,
getAll: () => { [id: string]: GeneratedCommand },
add: (id: string, data: GeneratedEntrypoint) => void,
get: (id: string) => GeneratedEntrypoint | undefined,
getAll: () => { [id: string]: GeneratedEntrypoint },
) {
const knownWindows: Record<string, { title: string | undefined, appId: string | undefined }> = { };

Expand Down Expand Up @@ -95,9 +95,9 @@ function addOpenWindowWayland(
windowAppId: string,
windowTitle: string,
focusWindow: (windowId: string) => void,
add: (id: string, data: GeneratedCommand) => void,
get: (id: string) => GeneratedCommand | undefined,
getAll: () => { [id: string]: GeneratedCommand },
add: (id: string, data: GeneratedEntrypoint) => void,
get: (id: string) => GeneratedEntrypoint | undefined,
getAll: () => { [id: string]: GeneratedEntrypoint },
) {
let appId = windowAppId;
let generatedEntrypoint = get(windowAppId);
Expand Down
12 changes: 6 additions & 6 deletions bundled_plugins/gauntlet/src/window/x11.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GeneratedCommand } from "@project-gauntlet/api/helpers";
import { GeneratedEntrypoint } from "@project-gauntlet/api/helpers";
import { addOpenWindow, deleteOpenWindow, openLinuxApplication } from "./shared";
import { application_x11_pending_event, linux_x11_focus_window } from "gauntlet:bridge/internal-linux";

Expand Down Expand Up @@ -37,9 +37,9 @@ export function focusX11Window(windowId: string) {

export function applicationEventLoopX11(
focusWindow: (windowId: string) => void,
add: (id: string, data: GeneratedCommand) => void,
get: (id: string) => GeneratedCommand | undefined,
getAll: () => { [id: string]: GeneratedCommand },
add: (id: string, data: GeneratedEntrypoint) => void,
get: (id: string) => GeneratedEntrypoint | undefined,
getAll: () => { [id: string]: GeneratedEntrypoint },
) {
const windows: Record<string, X11WindowData> = {};

Expand Down Expand Up @@ -202,8 +202,8 @@ function validateAndAddOpenWindow(
windows: Record<string, X11WindowData>,
openApplication: (appId: string) => (() => void),
focusWindow: (windowId: string) => void,
add: (id: string, data: GeneratedCommand) => void,
getAll: () => { [id: string]: GeneratedCommand },
add: (id: string, data: GeneratedEntrypoint) => void,
getAll: () => { [id: string]: GeneratedEntrypoint },
) {

if (window.overrideRedirect) {
Expand Down
24 changes: 12 additions & 12 deletions js/api/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,45 +33,45 @@ export function showHud(display: string): void {
return showHudWindow(display)
}

export interface GeneratedCommand {
export interface GeneratedEntrypoint {
name: string
actions: GeneratedCommandAction[]
actions: GeneratedEntrypointAction[]
icon?: ArrayBuffer
accessories?: GeneratedCommandAccessory[]
accessories?: GeneratedEntrypointAccessory[]
}

export type GeneratedCommandAction = GeneratedCommandActionRun | GeneratedCommandActionView
export type GeneratedEntrypointAction = GeneratedEntrypointActionRun | GeneratedEntrypointActionView

export interface GeneratedCommandActionRun {
export interface GeneratedEntrypointActionRun {
ref?: string
label: string
run: () => void
}

export interface GeneratedCommandActionView {
export interface GeneratedEntrypointActionView {
ref?: string
label: string
view: FC
}

export type GeneratedCommandAccessory = GeneratedCommandTextAccessory | GeneratedCommandIconAccessory;
export type GeneratedEntrypointAccessory = GeneratedEntrypointTextAccessory | GeneratedEntrypointIconAccessory;

export interface GeneratedCommandTextAccessory {
export interface GeneratedEntrypointTextAccessory {
text: string
icon?: string
tooltip?: string
}

export interface GeneratedCommandIconAccessory {
export interface GeneratedEntrypointIconAccessory {
icon: string
tooltip?: string
}

export type GeneratorProps = {
add: (id: string, data: GeneratedCommand) => void,
add: (id: string, data: GeneratedEntrypoint) => void,
remove: (id: string) => void,
get: (id: string) => GeneratedCommand | undefined
getAll: () => { [id: string]: GeneratedCommand },
get: (id: string) => GeneratedEntrypoint | undefined
getAll: () => { [id: string]: GeneratedEntrypoint },
};

export const Clipboard: Clipboard = {
Expand Down
8 changes: 4 additions & 4 deletions js/core/src/core.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { FC } from "react";
import { runEntrypointGenerators, runGeneratedCommand, runGeneratedCommandAction } from "./entrypoint-generator";
import { runEntrypointGenerators, runGeneratedEntrypoint, runGeneratedEntrypointAction } from "./entrypoint-generator";
import { reloadSearchIndex } from "./search-index";
import { closeView, handleEvent, handlePluginViewKeyboardEvent, renderInlineView, renderView } from "./render";
import {
Expand All @@ -17,7 +17,7 @@ async function handleKeyboardEvent(event: NotReactsKeyboardEvent) {
op_log_trace("plugin_event_handler", `Handling keyboard event: ${Deno.inspect(event)}`);
switch (event.origin) {
case "MainView": {
runGeneratedCommandAction(event.entrypointId, event.key, event.modifierShift, event.modifierControl, event.modifierAlt, event.modifierMeta)
runGeneratedEntrypointAction(event.entrypointId, event.key, event.modifierShift, event.modifierControl, event.modifierAlt, event.modifierMeta)
break;
}
case "PluginView": {
Expand Down Expand Up @@ -104,9 +104,9 @@ export async function runPluginLoop() {
}
break;
}
case "RunGeneratedCommand": {
case "RunGeneratedEntrypoint": {
try {
runGeneratedCommand(pluginEvent.entrypointId, pluginEvent.actionIndex)
runGeneratedEntrypoint(pluginEvent.entrypointId, pluginEvent.actionIndex)
} catch (e) {
console.error("Error occurred when running a generated command", pluginEvent.entrypointId, e)
}
Expand Down
Loading

0 comments on commit b2094be

Please sign in to comment.