-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from RyKilleen/refactor-files
refactor: reorg, replace extra clones with references, remove comments
- Loading branch information
Showing
8 changed files
with
84 additions
and
81 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use tauri::{AppHandle, Manager}; | ||
|
||
pub fn focus_window(app: &AppHandle, label: String) -> Result<(), tauri::Error> { | ||
let window = app.get_window(&label).unwrap(); | ||
window.show()?; | ||
window.unminimize()?; | ||
window.set_focus()?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
extern crate open; | ||
use serde::{Deserialize, Serialize}; | ||
use std::{env, path::Path}; | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct Step { | ||
pub value: String, | ||
} | ||
|
||
#[derive(Debug, Serialize, Deserialize, Clone)] | ||
pub struct Workflow { | ||
pub name: String, | ||
pub steps: Vec<Step>, | ||
} | ||
|
||
// On Windows, some apps expect a relative working directory (Looking at you, OBS....) | ||
pub fn open_app(path: &str) { | ||
let path = Path::new(&path); | ||
let dir = path.parent().expect("Path doesn't exist"); | ||
env::set_current_dir(dir).expect("Couldn't set current dir"); | ||
open::that(path).expect("Dang") | ||
} | ||
|
||
pub fn run_step(path: &str) { | ||
if path.contains("https") { | ||
open::that_in_background(&path); | ||
} else { | ||
open_app(&path); | ||
} | ||
} |