Noitidart / MouseControl

ff-addon: Enables user-defined "natural mouse combinations" to trigger customizable functions.
https://addons.mozilla.org/en-US/firefox/addon/mousecontrol/?src=github
14 stars 2 forks source link

version 2.0 pull #1

Closed tumpio closed 7 years ago

tumpio commented 10 years ago

Hello, any change to get the v2.0 development out?

I would like to contribute to it as much as I could.

Noitidart commented 10 years ago

Hey man thanks very much for this. I want to get back to it real soon. Let me get back to you this weekend. What all were you thinking of contributing? The reason I was hesitant to get back on it, is because if I dont tap into the OS mouse hook, we see that right clicking is glitchy no? And I can't figure out how to mouse hook into the OS like MozGest Redox (http://optimoz.mozdev.org/gestures/installation.html)

. I attached it here.

What are your thoughts?

tumpio commented 10 years ago

Glad to hear that it is still on going project!

I'm afraid I don't have the knowledge of OS mouse hooking. Is the current problem with right click mouse event?

I think this addon shares the same problem: https://addons.mozilla.org/firefox/addon/tab-kit-mouse-gestures/reviews/561438/

I don't see your attachment.

Noitidart commented 10 years ago

Yeah man have you noticed that ever?

On Fri, Jun 13, 2014 at 12:18 AM, tumpio notifications@github.com wrote:

Glad to hear that it is still on going project!

I'm afraid I don't have the knowledge of OS mouse hooking. Is the current problem with right click mouse event?

I think this addon shares the same problem:

https://addons.mozilla.org/fi/firefox/addon/tab-kit-mouse-gestures/reviews/561438/

— Reply to this email directly or view it on GitHub https://github.com/Noitidart/MouseControl/issues/1#issuecomment-45982586 .

tumpio commented 10 years ago

I searched similar addons with right mouse click gestures and they seem to alter the context menu state.

For example this addon works this way: https://addons.mozilla.org/firefox/addon/tabflip/

TabFlip modifies when the context-menu appears on Macs so it doesn't get in the way when flipping tabs. Instead of appearing upon pressing the mouse button, the context-menu will appear upon releasing.

I think the same goes for FireGestures addon.

It doesn't sound a nice solution but maybe there isn't any better?

Noitidart commented 10 years ago

Wow thanks man for your awesome investigation. Let me get the v2.0 source onto github so you can check out how its going. Right now its jus tthe HTML for the options page

On Fri, Jun 13, 2014 at 10:26 AM, tumpio notifications@github.com wrote:

I searched similar addons with right mouse click gestures and they seem to alter the context menu state.

For example this addon works this way: https://addons.mozilla.org/firefox/addon/tabflip/

TabFlip modifies when the context-menu appears on Macs so it doesn't get in the way when flipping tabs. Instead of appearing upon pressing the mouse button, the context-menu will appear upon releasing.

I think the same goes for FireGestures addon.

— Reply to this email directly or view it on GitHub https://github.com/Noitidart/MouseControl/issues/1#issuecomment-46037779 .

Noitidart commented 9 years ago

Hey man here is the updated v2.0 repo: https://github.com/Noitidart/MouseControl-v2.0-temp I'm working on getting the preference page done first. If you pull this repo, you can install it, and then click on the "Options" button from the addon manager and it will open a tab with the prefs. Can use GitHub FF Extension Installer

By any chance are you an expert with graphics? http://forums.mozillazine.org/viewtopic.php?f=19&t=2853293&p=13669637

With 2.0 I'm also allowing users to create and share custom scripts which can be downloaded from the website for it: https://github.com/Noitidart/MouseControl-Network

tumpio commented 9 years ago

Great! I'll try to test it this weekend. How about these mouse icons or similar: https://www.iconfinder.com/icons/64478/mouse_icon https://www.iconfinder.com/icons/64479/left_mouse_select_icon https://www.iconfinder.com/icons/64480/mouse_right_select_icon https://www.iconfinder.com/icons/64481/mouse_scroll_select_icon

Noitidart commented 9 years ago

Those are absolutely spectacular!!! For a start I'll go ahead and hook those up. Thanks for such a great find!! I tried finding something and couldn't. I will need to edit them a bit, like add whiskers to indicate click. And add an arrow to indicate which way the scroll is going. Superb man thx

Noitidart commented 8 years ago

You gotta forgive my delay. I had a major breaktrhough. Solved the mouse watching of all buttons (not just the three standard) on OS X and Windows (on linux too i know what to do, but i didnt do the work there yet, need to it shouldnt be as hard). Got the ctypes working from off the main thread. This has got me rolling on dev.

The ctypes is awesome solution because it allows me to detect all mouse buttons, and also solves that nasty context menu issue on osx and linux (where if your mouse is not over the open context menu wheel events wont work etc)

Also solved the functionalization issue of the prefs panel, switched to angular. Now I'm super rolling.

This sucker is my target right now. v1.5 has been failing me so I'm getting kicked into gear to get this up and out.

v2.0 will be truly cross platform, and truly customizable. Functions are also cusotmizable. Can create custom user functions too. With e10s compatability. Man I'm excited. Had so many minor annoying issues on this I didn't work on it. Now I just blasted through. :D

The custom scripts wont be shared via a website, but ill just server it to a frame within the preferences panel. So it will be talking to server, but within the preferences page. Designing a new website for sharing is not so intuitive to users and also it doesnt match the theme. So building the website into the preferences page is totally easy fast and looks fantastic.

Noitidart commented 8 years ago

Ok phew! Finally made some major progress.

Please try installing v2 now, the advanced mouse control is not there, like hold, multi click, and blocking events you expect not to happen. But you can edit configurations, record mouse on it, hit apply, and then it works. Please test if you can for me. :)

Before working on the advanced control/blocking events, I'm going to now shift gears to work on mouse monitoring on linux. :)

tumpio commented 8 years ago

This is awesome news! I will test it this week end!

tumpio commented 8 years ago

I installed it just a moment ago and I'm currently running it. The new preferences page looks very nice! All the settings seems to work and so does the export and import functionality.

I'm running it on linux, so I think the mouse action recording doesn't work yet, at least it doesn't give any feedback, other than "ok mouse left" and "ok mouse over it" in browser console.

But this is way cooler than what I was expecting! :+1: I was just hoping for cross platform compatibility :)

Noitidart commented 8 years ago

Ah yeah the Linux mouse stuff I'm working on right now as we speak :)

Thanks so much for the cooler then expected comment :D

Are you familiar with X11 on Linux? I'm trying to find a way to listen for mouse events and also block them. If you install the latest mousecontrol you'll see i createa window and any events over that window get logged in console, but i need this for system wide, or at least just firefox wide.

tumpio commented 8 years ago

Oh, I see that now. hmm I'm trying to test it but Firefox crashes after few clicks on the blank window when I have browser console opened.

Noitidart commented 8 years ago

Yeah its horribly in test mode right now on linux :p

tumpio commented 8 years ago

well, this gets printed out:

ev: XButtonEvent(5, ctypes.UInt64("9"), 0, Display.ptr(ctypes.UInt64("0x7fa649cf4000")), ctypes.UInt64("16777217"), ctypes.UInt64("1200"), ctypes.UInt64("0"), ctypes.UInt64("17509408"), 105, 199, 105, 228, 1040, 3, 1) MMSyncWorker.js:791:6
rez_XNextEvent: 0 MMSyncWorker.js:790:6
ev: XButtonEvent(4, ctypes.UInt64("9"), 0, Display.ptr(ctypes.UInt64("0x7fa649cf4000")), ctypes.UInt64("16777217"), ctypes.UInt64("1200"), ctypes.UInt64("0"), ctypes.UInt64("17509469"), 105, 199, 105, 228, 16, 1, 1) MMSyncWorker.js:791:6
rez_XNextEvent: 0 MMSyncWorker.js:790:6

XButtonEvent 5 is right click and 4 left click. Googling brought me to these: http://menehune.opt.wfu.edu/Kokua/Irix_6.5.21_doc_cd/usr/share/Insight/library/SGI_bookshelves/SGI_Developer/books/XLib_PG/sgi_html/ch09.html https://tronche.com/gui/x/xlib/events/keyboard-pointer/keyboard-pointer.html

tumpio commented 8 years ago

Some more and a working example: http://user.xmission.com/~georgeps/documentation/tutorials/forReview-3.html

Noitidart commented 8 years ago

Thanks so much @tumpio ! :) Those are great articles and help me understand a bit more. I need to try to make it not be limited within the msg window created, and also need to figure out how to block events :(

tumpio commented 8 years ago

http://stackoverflow.com/questions/30238155/linux-x11-window-manager-blocking-mouse-events http://stackoverflow.com/questions/3528304/xlib-getting-events-of-a-child-window?rq=1

Any help from these? They don't have much info though.. How did you solve this on Mac?

Noitidart commented 8 years ago

Yep XGrabPointer is the direction I need to go. When I call it though it keeps failing with message AlreadyGrabbed which is so confusing.

On Mac a bunch of this, just searching stack and github source codes lol.

Noitidart commented 8 years ago

I got it working with gdk_window_add_filter however we want to avoid this, we want to use X. gdk uses X, do you have any ideas on how to find out what X functions gdk_window_add_filter is calling?

tumpio commented 8 years ago

Not really other than trying to look them from the source: https://root.cern.ch/doc/master/gdkwindow_8c_source.html#l00115

Noitidart commented 8 years ago

Oh dang that's real useful I was looking for something like that, I'll keep digging thanks man!

Noitidart commented 8 years ago

Hi @carlin-q-scott by any chance would you know how to monitor the mouse events from another thread (ChromeWorker)? As you did for keys in Media Keys?

Noitidart commented 8 years ago

Alright @tumpio I gave up on the thread method, I tried for a month, I tried GTK, X11, and XCB (layero on of x11), but none of them work from another thread. Everyone kept telling me to go mainthread but I was sturbborn I wanted to match the Windows and OS X method, to be able monitor from another thread. Anyways it didn't work out so I am forced to settle on mainthread for Linux.

So with rev54 and rev55 - https://github.com/Noitidart/MouseControl/commit/f5b23d20c19871ee9312ffd2ee8c05b99a16c599 - I landed ability to track mouse. So you can now try opening up options and try recording. Try the combination, it should trigger the function. :)

I wasn't able to test horizontal wheel, if you have a horizontal wheel please test.

I need to now hook up blocking, and trigger mouse buttons, so button events dont cause menu to open and other actions. :)

carlin-q-scott commented 8 years ago

@Noitidart sorry I couldn't help with this. My add-on uses an interface specific to media playback in Linux so there's no overlap with mouse tracking.

Noitidart commented 8 years ago

Ah, thanks @carlin-q-scott really appreciate your input!

tumpio commented 8 years ago

@Noitidart I tried it now. I'm not sure if the recording works for me, at least I can't trigger anything.

Here is a browser log when opening MouseControl options: https://gist.github.com/tumpio/f21c5c75c18ea18f87b2

and a log when trying mouse recording: https://gist.github.com/tumpio/ea1d39d5a0425c26d669

Noitidart commented 8 years ago

@tumpio thanks for that test and the detaield logs.

Can you try to - open addon manager - uninstall the old version - close the addon manager tab - install the addon - then try please?

The GitHubExtensionInstaller addon doesnt work anymore as GitHub updated their layout, so I had to manually make it an xpi like this:

Here is a youtube vid of me trying it out:

https://www.youtube.com/watch?v=y8lcw3dUO1Q

What is your linux distro details by the way?

Noitidart commented 8 years ago

Hey @tumpio did you get a chance to test out fresh install from github? I was just hoping for some confidence that it does work for sure on Linux by your tests. If it doesnt work then Ill get to debugging :)

tumpio commented 8 years ago

@Noitidart sorry. I tested it now again. I found out that it works on the current Firefox but not in Firefox developer edition / aurora.

Noitidart commented 8 years ago

Whoa no way thanks for that awesome testing! Ill look into that!

Noitidart commented 8 years ago

Hey @tumpio I finalllly fixed it I think. I tested it in Fx45 and the old way worked, but then I tested in Fx48 and it didn't work. It seems in Fx48 I have to use gdk3 instead of gdk2. So I made it test firefox version. If it's greater then 45 then it uses gdk3. Can you please test out the latest commit.

The about page is broken right now due to a change - https://bugzilla.mozilla.org/show_bug.cgi?id=1254752#c42

But the logging to the console of the mouse buttons should work in 46 and 47 if you could test whichever version you have that would be so cool!

Thanks man!

Also it's usable for basic mouse combintations, down/up/click (multi/dbl click and holding doesnt work yet)

Noitidart commented 8 years ago

Tested it in Fx46 and 47 it works :) thank god! that was a doozy i didnt realize what the heck was going on

about:mousecontrol is broken in Fx47+ have to use chrome://mousecontrol/content/ng-prefs.xhtml for now, working on fixing this.

Noitidart commented 8 years ago

Alriiiighty finally check it out v2.0a.rev117 is working as expected. Default configurations aren't set up. If you have old config then make sure to hit "Restore Defaults". :)

Noitidart commented 8 years ago

When I customize it to be exactly like MouseControl v1.5 defaults this my config screenshot:

Can you please take a screenshot of your default config. I don't know if all Linux have the same B# it will help me setup the default buttons. Like in the screenshots below we see Mac and Windows button numbers match up. But for Ubuntu they were different.

Ubuntu 15.10

Mac OS X 10.1

Windows 10

Noitidart commented 8 years ago

Uploaded alpha to the dev channel on AMO please check it out and share feedback :) - https://addons.mozilla.org/en-US/firefox/addon/mousecontrol/versions/beta

tumpio commented 8 years ago

Here is a screen shot from Fedora linux: 2016-04-03-052701_1366x768_scrot 1

tumpio commented 8 years ago

It seems in Fx48 I have to use gdk3 instead of gdk2. So I made it test firefox version. If it's greater then 45 then it uses gdk3.

Could you somehow check the active gtk version? I'm thinking if Linux distribution packagers can still choose to use gtk2 instead of gtk3 when Fx47-48 is released.

Edit: some info here: https://bugzilla.mozilla.org/show_bug.cgi?id=627699#c298 At least currently it is possible.

tumpio commented 8 years ago

Uploaded alpha to the dev channel on AMO please check it out and share feedback :) - https://addons.mozilla.org/en-US/firefox/addon/mousecontrol/versions/beta

Great job! It is working well on the Firefox developer edition! I'll let you know if I encounter any problems.

tumpio commented 8 years ago

Do you have to leave the area after doing a mouse combo? I'm trying to do a two button combo but releasing it in the area resets it to the last button clicked.

hmm, would more than two button combos be possible? Like clicking multiple mouse buttons in right order to do a some action. I'm not sure if I would use them, but it would allow to have more mouse actions :)

tumpio commented 8 years ago

Or maybe the combo creation could be done by dragging mouse icons that represent click actions in order to create a combo.

Noitidart commented 8 years ago

Thanks for that gtk2 gtk3 bug and info! I'll investigate in that direction.

Yeah the recording is tricky. Leaving the area and then releasing the buttons is the way to do it right now. Clicking multiple buttons will work. But you cant do like left right left. The controls are not history controls. They are one hand instant combos. For the natural kind of feel. Changing to do history would be a big difference. :(

What is the exact combo you are trying to do? I can record a screencast on how to record it and share to youtube. I think the video will help others out there until we can create a more intuitive recording mechanism. I didn't like that drag and drop as people might drag and drop "unnatural" order combination. :(

Noitidart commented 7 years ago

Hey @tumpio I tried hard but I could not get v2.x approved publicly. So I have release it unlisted. I updated the public listing. And sent an update to MouseControl so it shows the prompt and tells them where to download v2.x

You can grab it here - https://github.com/Noitidart/MouseControl/releases/tag/v2.0-unlisted

Here is the prompt given in the update:

Here is the notes on the public listing:

tumpio commented 7 years ago

@Noitidart sorry for the late reply as usual. I have used the new 2.0 version about a week now on my work machine where I have Fedora Linux installed. It has been working very well and most importantly the issues with the right click context menu is gone for good! :+1:

You have worked very hard for this and shown big love to your users! I would like to make a donation to show up my gratitude. Do you have a paypal account?

Some thought about the new version:

I think this Issue can be now closed! Thanks again! :)

Noitidart commented 7 years ago

@Noitidart sorry for the late reply as usual. I have used the new 2.0 version about a week now on my work machine where I have Fedora Linux installed. It has been working very well and most importantly the issues with the right click context menu is gone for good! 👍

Yahoo!!!

You have worked very hard for this and shown big love to your users! I would like to make a donation to show up my gratitude. Do you have a paypal account?

You have done sooo much for me, motivating me, and getting me this far. You even tried to do development. You definitely did testing. I can't take from you, you really really helped me. Thank you so much for this thoughts!

  • I also didn't like much about the "forced" update. It was just bit unexpected behavior for an addon. Maybe just a notice "Please Update" would have been better in my opinion. But it's not big deal since I wanted to update anyway :)

v1.x is causing major issues on e10s :( It is even blocking e10s update. Indepdnent of e10s, it has major issues with the zoom functionality, I was overiding the global zoom behavior. AMO really wanted me to get people off it. :(

  • If Mozilla is not going to allow the usage of eval, I was thinking that how about creating a framework for command library add-ons that can add new commands and actions to MouseControl. There could be a skeleton add-on that users can use to create new methods and share these addons in AMO. What do you think about this idea?

I'm trying to re-write this as a webextension, I'm working on the learning C++ as native messaging will have to be used. I am just writing up a Linux exe and then I should be able o get started. With that though they will allow eval and chrome.tabs.executeScript which is eval in sandbox :) I hope to set up repo and connect mousecontrol to it so people can browse and discover new community provided commands :)