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

bunch of improvements: MacOS Stylus, Virtual Key, Reconnect, etc. #276

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

lyonbot
Copy link

@lyonbot lyonbot commented Jul 12, 2024

  • MacOS: support emulating stylus pen, with basic pressure support
  • Web Client: support "virtual key" -- floating button to send keys
  • Web Client: reconnect without reload page
  • Web Client: improve point sampling rate with getCoalescedEvents()
  • refactoring: use sass and esbuild to build frontend stuff

SharedScreenshot

@electronstudio
Copy link

I made a build incorporating your patch along with the other patches here https://github.com/electronstudio/WeylusCommunityEdition

@lyonbot
Copy link
Author

lyonbot commented Jul 20, 2024

@electronstudio the "virtual key" feature just got updated -- user may design multiple layout profiles, and sync between clients now.

@electronstudio
Copy link

@lyonbot ok i'll update soon. I have Mac and Linux builds, but I would really like to get a Windows build working. Does my Mac build run? I don't have a Mac to test it.

@lyonbot
Copy link
Author

lyonbot commented Jul 20, 2024

Tested with two MBP:

  • M1 chip: need sudo xattr -dr com.apple.quarantine ~/Downloads/Weylus.app then it works, but with some weird bug (i think it's bug from autopilot-rs -- can be fixed later)
  • Intel chip: not works, the CI build is in ARM arch.

@electronstudio
Copy link

I assume the xttr thing is unavoidable unless someone signs the app with a dev certificate?

I think there is still one x64 image available on Github Actions so I can do an x64 build with that.

@lyonbot
Copy link
Author

lyonbot commented Jul 20, 2024

I assume the xttr thing is unavoidable unless someone signs the app with a dev certificate?

Yes, and i think a simple shell command is okay to most users.

I think there is still one x64 image available on Github Actions so I can do an x64 build with that.

Found a solution and will test again later.

And as for the weird mouse bug, still reviewing autopilot-rs 's code.

@lyonbot
Copy link
Author

lyonbot commented Jul 20, 2024

heck! a fork of autopilot-rs is still required :(

@electronstudio
Copy link

I'm having a couple of problems building on Windows. First, Windows doesn't have bash shell. I think I've fixed this by changing your build_www function (but there might be a nicer way, I don't know Rust):

fn build_www() {
    let www_dir = Path::new("www");

    #[cfg(not(target_os = "windows"))]
    let shell = "bash";

    #[cfg(not(target_os = "windows"))]
    let shell_flag = "-c";

    #[cfg(target_os = "windows")]
    let shell = "cmd";

    #[cfg(target_os = "windows")]
    let shell_flag = "/c";


    // try `pnpm` first, then `npm`
    if !www_dir.join("node_modules").exists() {
        let pnpm_install_success = match Command::new(shell)
            .args([shell_flag, "pnpm install"])
            .current_dir(www_dir)
            .status()
        {
            Ok(e) => e.success(),
            Err(_) => false,
        };

        if !pnpm_install_success {
            let npm_install_result = Command::new(shell)
                .args([shell_flag, "npm install"])
                .current_dir(www_dir)
                .status()
                .expect("Failed to run npm or pnpm!");

            if !npm_install_result.success() {
                panic!(
                    "Failed to install npm dependencies! npm exited with code {}",
                    npm_install_result.code().unwrap_or(-1)
                );
            }
        }
    }

    let build_result = Command::new(shell)
        .args([shell_flag, "npm run build"])
        .current_dir(www_dir)
        .status()
        .expect("Failed to build www!");

    if !build_result.success() {
        panic!(
            "Failed to build www! npm exited with code {}",
            build_result.code().unwrap_or(-1)
        );
    }
}

@electronstudio
Copy link

Second, I get three cases of

error[E0004]: non-exhaustive patterns: `PointerEventType::ENTER` and `PointerEventType::LEAVE` not covered

in autopilot_device_win.rs

I could fix them by making it return 0 or whatever in those cases but I don't know if that is safe to do.

@lyonbot
Copy link
Author

lyonbot commented Jul 30, 2024

Second, I get three cases of

error[E0004]: non-exhaustive patterns: `PointerEventType::ENTER` and `PointerEventType::LEAVE` not covered

in autopilot_device_win.rs

I could fix them by making it return 0 or whatever in those cases but I don't know if that is safe to do.

Can be ignored as NO-OP. These EventType are for MacOS tablet events only (yet).

@electronstudio
Copy link

Thanks, windows build seems to be working.

@lyonbot
Copy link
Author

lyonbot commented Aug 10, 2024

@electronstudio
added some fixes to make stylus work more smoothly!

The experience improves significantly on my budget Win tablet + Krita app on MacOS

image

@electronstudio
Copy link

Cool, added and sent you a PR with what I'm changing to get it to build on Windows.

fixes to allow building on windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants