diff --git a/packages/client-api/src/desktop/desktop-commands.ts b/packages/client-api/src/desktop/desktop-commands.ts index a546a8e9..bc45979e 100644 --- a/packages/client-api/src/desktop/desktop-commands.ts +++ b/packages/client-api/src/desktop/desktop-commands.ts @@ -9,15 +9,15 @@ import type { ProviderConfig } from '~/providers'; const logger = createLogger('desktop-commands'); export const desktopCommands = { - startWidget, + openWidgetDefault, listenProvider, unlistenProvider, setAlwaysOnTop, setSkipTaskbar, }; -function startWidget(configPath: string): Promise { - return invoke('start_widget', { configPath }); +function openWidgetDefault(configPath: string): Promise { + return invoke('open_widget_default', { configPath }); } function listenProvider(args: { diff --git a/packages/client-api/src/desktop/widgets.ts b/packages/client-api/src/desktop/widgets.ts index 3df46f03..dc996e14 100644 --- a/packages/client-api/src/desktop/widgets.ts +++ b/packages/client-api/src/desktop/widgets.ts @@ -44,9 +44,11 @@ export function currentWidget(): Widget { } /** - * Opens a new widget instance by a relative path to its config file. + * Opens a widget by its config path. Uses its default placements. + * + * Config path is relative within the Zebar config directory. */ -export async function startWidget(configPath: string) { +export async function openWidgetDefault(configPath: string) { // Ensure the config path ends with '.zebar.json'. const filePath = configPath.endsWith('.zebar.json') ? configPath @@ -58,5 +60,5 @@ export async function startWidget(configPath: string) { filePath, ); - return desktopCommands.startWidget(absolutePath); + return desktopCommands.openWidgetDefault(absolutePath); } diff --git a/packages/client-api/src/index.ts b/packages/client-api/src/index.ts index 8b013ad1..3f42d41b 100644 --- a/packages/client-api/src/index.ts +++ b/packages/client-api/src/index.ts @@ -2,7 +2,7 @@ export * from './providers'; export { currentWidget, currentWindow, - startWidget, + openWidgetDefault, type Widget, type Window, } from './desktop'; diff --git a/packages/desktop/src/cli.rs b/packages/desktop/src/cli.rs index ad35a31d..2b35ae16 100644 --- a/packages/desktop/src/cli.rs +++ b/packages/desktop/src/cli.rs @@ -22,10 +22,10 @@ pub enum CliCommand { /// Opens a widget by its config path. Uses its default placements. /// /// Config path is relative within the Zebar config directory (e.g. - /// `zebar open-widget ./material/config.yaml`). + /// `zebar open-widget-default ./material/config.yaml`). /// /// Starts Zebar if it is not already running. - OpenWidgetDefaults(OpenWidgetDefaultsArgs), + OpenWidgetDefault(OpenWidgetDefaultArgs), /// Opens all widgets that are set to launch on startup. /// @@ -47,7 +47,7 @@ pub enum CliCommand { } #[derive(Args, Clone, Debug, PartialEq)] -pub struct OpenWidgetDefaultsArgs { +pub struct OpenWidgetDefaultArgs { /// Relative file path to widget config within the Zebar config /// directory. pub config_path: PathBuf, diff --git a/packages/desktop/src/commands.rs b/packages/desktop/src/commands.rs index f8ccf75d..2168aee3 100644 --- a/packages/desktop/src/commands.rs +++ b/packages/desktop/src/commands.rs @@ -10,7 +10,7 @@ use crate::{ }; #[tauri::command] -pub async fn start_widget( +pub async fn open_widget_default( config_path: String, config: State<'_, Arc>, widget_factory: State<'_, Arc>, diff --git a/packages/desktop/src/main.rs b/packages/desktop/src/main.rs index af5e7925..3d6389e6 100644 --- a/packages/desktop/src/main.rs +++ b/packages/desktop/src/main.rs @@ -95,7 +95,7 @@ fn start_app(cli: Cli) -> anyhow::Result<()> { task::block_in_place(|| { block_on(async move { let config_dir_override = match cli.command() { - CliCommand::OpenWidgetDefaults(args) => args.config_dir, + CliCommand::OpenWidgetDefault(args) => args.config_dir, CliCommand::Startup(args) => args.config_dir, _ => None, }; @@ -166,7 +166,7 @@ fn start_app(cli: Cli) -> anyhow::Result<()> { }) }) .invoke_handler(tauri::generate_handler![ - commands::start_widget, + commands::open_widget_default, commands::listen_provider, commands::unlisten_provider, commands::set_always_on_top, @@ -273,7 +273,7 @@ async fn open_widgets_by_cli_command( widget_factory: Arc, ) -> anyhow::Result<()> { let widget_configs = match cli.command() { - CliCommand::OpenWidgetDefaults(args) => { + CliCommand::OpenWidgetDefault(args) => { let widget_config = config .widget_config_by_path(&config.join_config_dir(&args.config_path)) .await?