Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: minor cleanups #390

Merged
merged 1 commit into from
Feb 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions crates/deskulpt-core/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ pub enum ShowToastPayload {
pub trait EventsExt<R: Runtime>: Emitter<R> {
/// Emit the `show-toast` event to the canvas.
fn emit_show_toast_to_canvas(&self, payload: ShowToastPayload) -> Result<()> {
self.emit_to("canvas", "show-toast", payload)
.map_err(Into::into)
Ok(self.emit_to("canvas", "show-toast", payload)?)
}

/// Emit the `exit-app` event to the manager.
fn emit_exit_app_to_manager(&self) -> Result<()> {
self.emit_to("manager", "exit-app", ()).map_err(Into::into)
Ok(self.emit_to("manager", "exit-app", ())?)
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/deskulpt-core/src/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ use anyhow::Result;
use tauri::image::Image;
use tauri::menu::{MenuBuilder, MenuEvent, MenuItemBuilder};
use tauri::tray::{MouseButton, MouseButtonState, TrayIcon, TrayIconBuilder, TrayIconEvent};
use tauri::{App, AppHandle, Manager, Runtime};
use tauri::{App, AppHandle, Runtime};
use tokio::time::sleep;

use crate::events::EventsExt;
use crate::states::StatesExtCanvasClickThrough;
use crate::window::WindowExt;

/// Extention trait for system tray-related operations.
pub trait TrayExt<R: Runtime>: Manager<R> + StatesExtCanvasClickThrough<R> {
pub trait TrayExt<R: Runtime>: StatesExtCanvasClickThrough<R> {
/// Create the system tray.
fn create_tray(&self, icon: Image) -> Result<()>
where
Expand Down
1 change: 1 addition & 0 deletions crates/deskulpt-core/src/window/script.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! Window initialization scripts.

use anyhow::Result;
use serialize_to_javascript::{default_template, DefaultTemplate, Template};

Expand Down
1 change: 0 additions & 1 deletion crates/deskulpt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ pub fn run() {

app.create_manager(&settings)?;
app.create_canvas(&settings)?;

app.create_tray(DESKULPT_ICON)?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion packages/apis/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function cleanDir(path: string) {
let dir: Dir;
try {
dir = opendirSync(path);
} catch (err: unknown) {
} catch (err) {
if (err instanceof Error && "code" in err) {
switch (err.code) {
case "ENOENT":
Expand Down
2 changes: 1 addition & 1 deletion packages/react/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function cleanDir(path: string) {
let dir: Dir;
try {
dir = opendirSync(path);
} catch (err: unknown) {
} catch (err) {
if (err instanceof Error && "code" in err) {
switch (err.code) {
case "ENOENT":
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function cleanDir(path: string) {
let dir: Dir;
try {
dir = opendirSync(path);
} catch (err: unknown) {
} catch (err) {
if (err instanceof Error && "code" in err) {
switch (err.code) {
case "ENOENT":
Expand Down
4 changes: 1 addition & 3 deletions packages/ui/src/jsx-runtime.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import { Fragment, jsx, jsxs } from "@emotion/react/jsx-runtime";

export { jsx, jsxs, Fragment };
export { Fragment, jsx, jsxs } from "@emotion/react/jsx-runtime";