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

"Hold" option also for side buttons [enhancement] #54

Closed
antoniomcr96 opened this issue Dec 5, 2020 · 15 comments
Closed

"Hold" option also for side buttons [enhancement] #54

antoniomcr96 opened this issue Dec 5, 2020 · 15 comments

Comments

@antoniomcr96
Copy link

antoniomcr96 commented Dec 5, 2020

Description

It would be cool if it was possible to select a behavior when holding side buttons.
This, for example, could allow to:

  • click side buttons to go back and forward;
  • hold them to move between spaces
    and viceversa

Rationale

Side buttons are very useful and this could be, with #29 a good way to allow to do multiple actions.
I think and hope this enhancement would be easy for you to realize.

image

well I see that maybe the work is already done but it isn't activated.

Thanks for all your work

@noah-nuebling noah-nuebling changed the title "Hold" option also for side buttons "Hold" option also for side buttons [enhancement] Mar 2, 2021
@noah-nuebling
Copy link
Owner

noah-nuebling commented Mar 2, 2021

Hey there @antoniomcr96, thanks for your feedback! As you noticed, I tested this functionality, but I thought it felt weird to use so I left it out.

For example think about if you wanted to move 2 or 3 spaces to the left/right, which I often do - you'd have to click and hold and then wait for it to trigger 2 or 3 times. It just feels a little cumbersome.
When I made this UI, I wanted it to be as simple as possible and only include options that feel really good to use.

I'd love to develop a new UI, which let's you remap your buttons however you want, at some point, but I don't want to promise anything, cause I don't have that much time to work on this unfortunately.
I've already experimented with the potential backend code for such a system in the 2.0.0 branch though, if you want to take a look.

@noah-nuebling
Copy link
Owner

I think you'll be pleased to know this is now possible in the new 2.0.0 Beta! It's still an early version and lots may change, so be sure to let me know if you have any thoughts or ideas for improvement for it! :)

@antoniomcr96
Copy link
Author

@noah-nuebling sorry, but for me it doesn't work. I had the version with the prefpane. Now if I download the app version and I open it it doesn't ask for accessibility permission and it doesn't work. I tried to restart. Any idea?

@noah-nuebling
Copy link
Owner

noah-nuebling commented Mar 31, 2021

Ah yeah there have been issues for some users when upgrading from the old prefpane version.

I can't tell what's going on on your system exactly, but here are some things that might help:

  1. Using this terminal command and restarting your machine:
    /bin/launchctl bootout gui/${UID} ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist; rm ~/Library/LaunchAgents/com.nuebling.*
    
  2. Disabling the old prefpane version, then deleting it, and then restarting your machine.

I hope that helps and sorry for the troubles, I'll look into making upgrading rock solid soon.

Btw which version of Mac Mouse Fix were you using before, and which macOS are you using? I've heard about these issues from one other user but for most it seems to work fine, so that would really help narrow down what might be the cause of these issues.

@antoniomcr96
Copy link
Author

Didn't work, unfortunately.
While I was looking for a solution, I removed Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist before you wrote your answer, so /bin/launchctl bootout gui/${UID} ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist doesn't work. Is there any way to regenerate that file?

I had mouse fix 0.9.1 (prefpane) and I have macOS Big Sur 12.2.3
Neither the app nor the prefpane work anymore

@noah-nuebling
Copy link
Owner

noah-nuebling commented Mar 31, 2021

Thanks for your feedback! I just spent some time trying to reproduce the issue upgrading from 0.9.1 to 1.0.3, and it doesn't seem to occur for me at all. I'm also on Big Sur 11.2.3. This is really weird and I don't know why this is happening.

It's really late where I'm from and I'll head to bed now, but I'll tend to you issue as soon as I can. I think I'll be able to tomorrow.

In the mean time you can try this terminal command:

launchctl remove mouse.fix.helper; launchctl remove com.nuebling.mac-mouse-fix.helper;

It should basically do the same thing as as the bootout command above but it doesn't require the plist file to exist.
After that re-enable the new version of Mac Mouse Fix and it might work again.

If that doesn't help, you could try a hard reset of everything that I think might be related to the issue:

  1. Delete all versions of Mac Mouse Fix
  2. Run this terminal command
launchctl remove mouse.fix.helper; launchctl remove com.nuebling.mac-mouse-fix.helper; rm ~/Library/LaunchAgents/com.nuebling.*
  1. Restart your computer

If you find the time it would also be really awesome if you filed a bug report and attached some console logs. That might be really insightful when it comes to fixing the bug.

I really hope this helps, sorry again for the trouble and thanks for helping to make Mac Mouse Fix better!

@noah-nuebling
Copy link
Owner

Oh and if you're looking for alternative in the mean time I can warmly recommend SteerMouse for the button mapping capabilities and MOS for the smooth scrolling.

@noah-nuebling
Copy link
Owner

noah-nuebling commented Apr 1, 2021

Hey so I read up a little more on how this whole login item mechanism works and this terminal command should prevent any conflicts there are with old versions of Mac Mouse Fix from what I understand.

launchctl remove mouse.fix.helper; rm ~/Library/LaunchAgents/com.nuebling.*

If that still doesn't work, that's really weird and I have no real clue what might be causing the issue.
Console logs could be really helpful in that case.

noah-nuebling added a commit that referenced this issue Apr 2, 2021
…the helper app is registered with launchd and then cleans that old stuff.

I hope this will prevent some issues that people had when upgrading from the old prefpane version to the new app  version.

From the few reports I've gotten, it seemed like there was some sort of conflict with the old and the new version both being registered with launchd. I couldn't reproduce the issues, but I think this has a pretty good chance of fixing that.

If we then also implement automatic untranslocation of the app, I hope that will make upgrading very solid.

For reports, see:
- The end of this gh issue thread: #54 (comment)
- The mail by Jeff starting with "I attached the system log."
@noah-nuebling
Copy link
Owner

noah-nuebling commented Apr 2, 2021

@antoniomcr96 Did you run the app right from the Downloads folder by any chance? There is a security mechanism in macOS where apps are run in a sort of quarantine if they aren't moved to a different place after Downloading (It's called App Translocation). I think that might have been causing your issues.

Here's a new build of the app which can autodetect and remove this App Translocation and which also attempts to resolve a number of conflicts with older versions.

Mac.Mouse.Fix.app.zip

I hope that helps and let me know if you have any more troubles!

@antoniomcr96
Copy link
Author

Sorry for the delayed reply. Nothing to do, unfortunately (I tried the terminal command and your new version), it doesn't ask for the permissions. I don't know if restoring my system would be worth it, I'll think about it. Anyway thanks for all your work!!

@noah-nuebling
Copy link
Owner

Hey no worries at all. I‘m sorry you‘re still experiencing issues.

I was in contact with one other person who had super similar issues and they could start the new version of the app after moving it to the Applications folder.

So the fact that it‘s not working in your case is really quite weird.

I have no lead as to what might be causing it in your case so I‘m not sure what I could do to fix it.

If you could send some Console Logs containing „Mouse Fix“ occurring at the time you open the App and at the time you click the “Enable Mac Mouse Fix” checkbox, I’d definitely look into that, and I think it might reveal some crucial information.

If you would like me to describe the process of finding these Console Logs in more detail, please let me know! It’s pretty confusing if you haven’t worked with it before.

Thanks for being persistent and for getting back to me!

@antoniomcr96
Copy link
Author

Thanks for the idea, this is the log for you:

default	22:44:30.407644+0200	Mac Mouse Fix	Removing AuthorizeAccessibilityView
default	22:44:31.291321+0200	Mac Mouse Fix	repairing User Agent Config File
default	22:44:31.292057+0200	Mac Mouse Fix	launchdPlistExists 0, launchdPlistIsCorrect: 1
default	22:44:31.292145+0200	Mac Mouse Fix	repairing file...
default	22:44:31.292716+0200	Mac Mouse Fix	Cleaning up stuff from previous versions
default	22:44:31.297683+0200	Mac Mouse Fix	Strange Helper: not found
default	22:44:31.297768+0200	Mac Mouse Fix	Removing legacy launchd plist
default	22:44:31.297913+0200	Mac Mouse Fix	No legacy launchd plist file found at: /Users/antonio/Library/LaunchAgents/com.nuebling.mousefix.helper.plist
default	22:44:31.302649+0200	Mac Mouse Fix	launchctl terminated with stdout/stderr: Bootstrap failed: 5: Input/output error
, error: (null)

Any idea?

@noah-nuebling
Copy link
Owner

noah-nuebling commented Apr 11, 2021

Hey @antoniomcr96., sorry for answering so late.

That's great that you attached a log!

The line

launchctl terminated with stdout/stderr: Bootstrap failed: 5: Input/output error

is a very important hint as to what is going wrong. But it doesn't tell us much about the specifics unfortunately.

Without going into the details here are some things you could test if you find the time to gain us more information about what's going on:

  1. Check if a file exists at ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist, and if so, post it here
  2. Run the terminal command launchctl list mouse.fix.helper and post the output
  3. Run the terminal command launchctl bootstrap gui/${UID} ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist and post the output

Thank you for your help!


Explanation

There is another application bundled with the main Mac Mouse Fix app called Mac Mouse Fix Helper. Mac Mouse Fix Helper is the process that actually does the heavy lifting and provides all of the useful functions. The main Mac Mouse Fix app itself is basically just a user interface to configure and setup the Mac Mouse Fix Helper app.

What Mac Mouse Fix actually does when you click the Enable Mac Mouse Fix checkbox, is tell a system process called launchd to run the app Mac Mouse Fix Helper in the background and when you start up your computer.

This call to launchd fails on your system for some reason. Therefore Mac Mouse Fix Helper never runs.

There are 2 steps to telling launchd to run Mac Mouse Fix Helper:

First you need to create a so-called "launchd.plist file".
A "launchd.plist file" contains a bunch of information which tells launchd to run some executable under certain circumstances and with specific parameters. The "launchd.plist file" for Mac Mouse Fix Helper should be at
~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist, and it tells launchd to keep "Mac Mouse Fix Helper" running so long as the "launchd.plist file" is loaded.

These "launchd.plist file"s are automatically loaded by launchd at startup, or you can load them while the computer is already running with the terminal command launchctl bootstrap gui/${UID} ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist.

  • ^ The bootstrap command enables Mac Mouse Fix by loading the "launchd.plist file"
    Should you need to disable Mac Mouse Fix from the command line, use launchctl bootout gui/${UID} ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist, or if that doesn't work use launchctl remove mouse.fix.helper. After calling these delete the file at ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist to prevent this "launchd.plist file" from being loaded by launchd at the next system startup, causing Mac Mouse Fix Helper to run again.

Now when you click the checkbox to start the Helper app, what happens is that, first the "launchd.plist file" is created and then the bootstrap command is called to load the "launchd.plist file" and therefore start the Helper App. On your system, this terminal command apparently fails when called by Mac Mouse Fix and it produces the launchctl terminated with stdout/stderr: Bootstrap failed: 5: Input/output error error message.

The launchctl list mouse.fix.helper command tells you with which parameters the Mac Mouse Fix Helper "launchd.plist file" is loaded with or if it is loaded at all.

Thanks again for helping out!

@antoniomcr96
Copy link
Author

antoniomcr96 commented Jul 14, 2021

Sorry, but I read this post too late.
Thanks for all the explanation.
~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist doesn't exist, and

antonio@thinkpad-l390-yoga ~ % launchctl list mouse.fix.helper
Could not find service "mouse.fix.helper" in domain for port
sudo launchctl bootstrap gui/${UID} ~/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist
/Users/antonio/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist: No such file or directory
Bootstrap failed: 2: No such file or directory

I am trying the latest beta. If I try to click the checkbox "Enable Mac Mouse Fix" it doesn't work, but I have new logs:

2021-07-14 20:22:46.396961+0200 0x390b     Activity    0xc6f5               1360   0    Mac Mouse Fix: (AppKit) trackMouse send action on mouseUp
2021-07-14 20:22:46.401200+0200 0x390b     Default     0xc6f7               1360   0    Mac Mouse Fix: repairUserAgentConfigFile() -- Data Serialization Error: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “com.nuebling.mac-mouse-fix.helper.plist” in the folder “LaunchAgents”." UserInfo={NSFilePath=/Users/antonio/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist, NSUserStringVariant=Folder, NSUnderlyingError=0x60000072e5e0 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}
2021-07-14 20:22:46.405376+0200 0x390b     Default     0xc6f7               1360   0    Mac Mouse Fix: No legacy launchd plist file found at: /Users/antonio/Library/LaunchAgents/com.nuebling.mousefix.helper.plist
2021-07-14 20:22:46.411198+0200 0x38da     Default     0x0                  1      0    launchd: [gui/501 [100006]:] Bootstrap by launchctl[1368] for /Users/antonio/Library/LaunchAgents/com.nuebling.mac-mouse-fix.helper.plist failed (2: No such file or directory)

I don't know why, it seems like the app doesn't have the permission to create the plist. Is It useful for you?

EDIT: It seems that the problem was solved!!! @noah-nuebling
Following this conversation: https://groups.google.com/g/tunnelblick-discuss/c/bCDPjZKg-Gg?pli=1 I found out that my LaunchAgents folder wasn't owned by me but by root account:
drwxr-xr-x@ 5 root staff 160 10 Giu 10:13 LaunchAgents

The problem was caused by a plist (one of these three):

antonio@thinkpad-l390-yoga /Applications % ls -l ~/Library/LaunchAgents
total 24
-rwxr-xr-x@ 1 root  staff  589 26 Mag 14:28 SleepOnLowBattery.plist
-rw-r--r--@ 1 root  staff  811  4 Mar 23:30 com.google.keystone.agent.plist
-rw-r--r--@ 1 root  staff  917  4 Mar 23:30 com.google.keystone.xpcservice.plist

That changed the ownership to root account.

I changed the owner to my account again: antonio@thinkpad-l390-yoga /Applications % sudo chown antonio:staff ~/Library/LaunchAgents
And now macmousefix beta works as it should.
Thanks for all your help! Your app is very useful and well-done

@noah-nuebling
Copy link
Owner

Hey @antoniomcr96, thanks for the feedback! I'm glad that the app is working for you again and that you're enjoying it!

Prompted by your message, I just built a mechanism which which attempts to repair the permissions on the ~/Library/LaunchAgents folder automatically, to avoid issues like yours for the future. I released this new feature in the latest 2.0.0 Beta 12.

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

No branches or pull requests

2 participants