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

Feature request: map mouse actions to mouse actions in macOS #1470

Open
nivzelber opened this issue Jan 8, 2025 · 4 comments
Open

Feature request: map mouse actions to mouse actions in macOS #1470

nivzelber opened this issue Jan 8, 2025 · 4 comments
Labels
enhancement New feature or request macos Issue pertains to macos; jtroo has no macOS devices and does not maintain the support for this OS.

Comments

@nivzelber
Copy link

Is your feature request related to a problem? Please describe.

I want to be able to map ctrl+click to command+click on mac (to function like windows).

However this is not a valid config:

(defcfg
  process-unmapped-keys yes
)

(defsrc
    mlft
)

(deflayermap (base)
    C-mlft M-mlft
)

Describe the solution you'd like.

Mapping of mouse buttons just like keyboard buttons

Describe alternatives you've considered.

Creating a new layer based on pressing ctrl that maps mlft to M-mlft, but this does not work from the same reason

Additional context

No response

@nivzelber nivzelber added the enhancement New feature or request label Jan 8, 2025
@RodsonMatos
Copy link

RodsonMatos commented Jan 8, 2025

Try this

(defcfg
  process-unmapped-keys yes
)

(defsrc
    mlft
)

(deflayer
    C-mlft M-mlft
)

@jtroo
Copy link
Owner

jtroo commented Jan 9, 2025

This is only supported for Linux and Windows-Interception today.

@jtroo jtroo changed the title Feature request: map mouse actions to mouse actions Feature request: map mouse actions to mouse actions in macOS Jan 9, 2025
@jtroo jtroo added the macos Issue pertains to macos; jtroo has no macOS devices and does not maintain the support for this OS. label Jan 9, 2025
@mayurankv
Copy link

Do you have any advice on where to start if I wanted to try tackling this? (Reasonable dev experience but not with rust or karabiner specifically).

@jtroo
Copy link
Owner

jtroo commented Jan 11, 2025

Would need to add handling in the area of input handling.

let event = kb.read().map_err(|e| anyhow!("failed read: {}", e))?;
let mut key_event = match KeyEvent::try_from(event) {

kanata/src/oskbd/macos.rs

Lines 158 to 161 in 75b2327

impl TryFrom<KeyEvent> for InputEvent {
type Error = ();
fn try_from(item: KeyEvent) -> Result<Self, Self::Error> {

pub fn read(&mut self) -> Result<InputEvent, io::Error> {
let mut event = DKEvent {
value: 0,
page: 0,
code: 0,
};
wait_key(&mut event);
Ok(InputEvent::new(event))
}

The karabiner provider dependency will likely need modification also.
https://github.com/psych3r/driverkit/blob/90df32d69f03914591a932cc6465bdb9e0924ebc/c_src/driverkit.cpp#L346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request macos Issue pertains to macos; jtroo has no macOS devices and does not maintain the support for this OS.
Projects
None yet
Development

No branches or pull requests

4 participants