Skip to content

add linux support 🚀 #32

@ParthJadhav

Description

@ParthJadhav

Changes required:

  1. Changing this to include linux release.

    "targets": ["app"],

  2. Changing the paths below to work for Linux file system, Might need to research a bit on how to add platform specific logic. Creating a struct with the platform specific paths would be a good idea.

    pub async fn handle_input(input: String) -> (Vec<String>, f32, i32) {
    let mut result: Vec<String>;
    let mut result_type: ResultType;
    let start_time = Instant::now();
    if !input.starts_with("/") {
    result = search(
    input.as_str(),
    vec![
    "/Applications",
    "/System/Applications",
    "/System/Applications/Utilities",
    ],
    Some(".app"),
    Some(1),
    );
    similarity_sort(&mut result, input.as_str());
    result_type = ResultType::Applications;
    } else {
    result = search(
    input.trim_start_matches("/"),
    vec!["/Users/"],
    None,
    Some(10000),
    );
    println!("{:?}", result);
    result_type = ResultType::Files;
    }
    if result.len() == 0 {
    let calculation_result = calculate(input.as_str());
    if calculation_result != "" {
    result.push(calculation_result);
    result_type = ResultType::Calculation;
    }
    }
    let time_taken = start_time.elapsed().as_secs_f32();
    return (result, time_taken, result_type as i32);
    }

  3. Might need to update the command below to support opening apps on linux.

    #[tauri::command]
    pub fn open_command(path: &str) {
    Command::new("open")
    .arg(path.trim())
    .spawn()
    .expect("failed to execute process");
    }

  4. Below Path may also need updation:

    #[tauri::command]
    pub fn launch_on_login(enable: bool) -> bool {
    let auto = AutoLaunchBuilder::new()
    .set_app_name("verve")
    .set_app_path("/Applications/verve.app")
    .build()
    .unwrap();

  5. Might need to figure out how to derive icons on linux systems...

    pub fn convert_all_app_icons_to_png() {
    let result: Vec<String> = SearchBuilder::default()
    .location("/Applications")
    .more_locations(vec![
    "/System/Applications",
    "/System/Applications/Utilities",
    ])
    .depth(1)
    .ext(".app")
    .ignore_case()
    .build()
    .collect();
    for app_path in result {
    let app_name = app_path.split("/").last().unwrap();
    let icon_path = get_icon_path(&app_path);
    if icon_path != "" {
    convert_and_store_icons(&icon_path, app_name);
    }
    }
    }

  6. This shortcut might need to be updated to META + Shift + G

    shortcut: String::from("Command+Shift+G"),

    shortcutArray = ["Command", "Shift", "G"];

    .map((key) => key)
    .join(" + ")
    .replace("Meta", "")
    .replace("Command", "")
    .replace("Control", "")
    .replace("Alt", "")
    .replace("Shift", "")

There might be more changes, Depending on the arising issues. Please do ping below if you want to create sub-issues for all of those...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions