-
Notifications
You must be signed in to change notification settings - Fork 58
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
Change focus when only screen changes #11
Comments
Interesting idea. This is not currently a feature, so I would have to think how difficult this is. For example I am not sure if Apple its APIs allow you to query on which screen the mouse is currently hovering. On the code level, Apple abstracts over multiple screens by adding all screen dimensions together, combining them into one large screen. But there may be other ways to figure out on which screen the mouse is. |
I thought some more about your idea. It seems iterating over the screens field in NSScreen to figure out which screen frame the mouse is currently in might do the trick. I am quite busy ATM however, so it might take a while before I can look into this further. |
Have you implemented this feature yet? |
@R4dix |
@yavuzkoca @R4dix To try this out, unzip the downloaded branch, and run:
Be sure to first stop any previous instances or they will interfere with this one. If you are curious what changed, you can take a look here |
Thanks mate i will check it out immediately 👍 |
@R4dix |
@R4dix hi there! |
My main purpose for this was using the inspector of Google Chrome without a second click and for this yes it works. |
@R4dix thanks! this is very helpful to know. I will see then if this can still be improved and at some point this might make it to the master branch |
It seems to be working fine, sometimes it does not recognizes that the cursor changes screen but that's rare and seems to only happen when the cursor is moved fast or when it hovers a notification banner before hovering a window. |
@AngryKiller thanks also for this feedback :) |
Thanks @sbmpost for pointing me to the same feature request. I have tested the test branch linked here, and this is what I observed: The desired functionality works only when the app is maximised to the whole screen. Behaviour below (On the same screen, |
Thanks for this capture. Which osx version are you running? And are you sure that while testing, you were not running 2 AutoRaise instances at the same time? Can be checked with: ps -aux | grep -v "AutoRaise" It should return at most 1 running instance. |
Thanks for pointing this out. The earlier process was indeed running. |
@hasantahir |
@hasantahir |
Yes exactly. I couldn't record the second screen simultaneously but raising the browser window causes apps to lose focus on the first screen. Also correct, neither of the browser windows are operating in the full screen mode, just maximised. |
So you may see the effect that the application is activated as a whole and therefore on both screens at once as it is the same application. I am not sure if this can be changed. It might... Will have to investigate this. |
If you are on OSX 11.6 or higher, you should change the "activate" code to this:
As far as I know, activating the application as a whole is the only way to set the keyboard focus to a certain window.
This however is exactly what this tool is doing :-). From then on, it is up to the activated application to decide what happens. For instance it seems that both Chrome and Safari raise all of their windows if they are on different screens whereas Firefox and TextEdit do not. Being application specific, there is not much this tool can do about it unfortunately. |
@sbmpost thanks for kindly digging into this. I'll try to change my habits :-). Have also noticed that the |
Just wondering if there is a way to exploit Mission control for the per-window (item) type focusing on multiple screens. |
@hasantahir @yavuzkoca @R4dix @AngryKiller |
Fully agree. Thoroughly enjoying v3.7 with the Thanks, @sbmpost! |
@sbmpost Hi! Just found your app yesterday, and I'm loving it, thanks for building this. The "change focus only screen changes" option is still very important for me. I've download the app because of this. I tried to use this alternative branch, but the bug that @hasantahir said is happening to me (all the windows unraise when the screen changes). I tried to modify the code you proposed, but still, it wasn't working. I also tried to activate the focus option on this branch and unable the raise option, but this didn't workout (even building the app with the flag). Do you have any idea how could I achieve this? For me, either a option for focus only when changing screen or raise only when changing screen would work fine. Thanks! |
@umtiagopereira @yavuzkoca @hasantahir @R4dix @AngryKiller
|
To disable, simply omit/remove the warpX and warpY settings. |
Fixed! Thanks |
Hi, I have an extra screen besides my laptop and would like the mouse pointer focused on the app in different screen I switch to it by using alt-tab. Otherwise, I have to move the mouse to the focused app across screen which is a pain. Is the focus-only-on-change-screen branch I need? |
@shijialee, what do you want is that when you change to a window in another screen using alt-tab, the mouse pointer automatically moves to this new screen? If so, I don't think you can do this right now. Maybe you could try the warp settings, but the problem is that your mouse would move every time you changed to a new window, even on the same screen. For something like this to be possible, we would need a feature like "warp only on change screen." |
@umtiagopereira Yes. You understood me correctly. I got a HD cured screen which make moving mouse more pain. tried warpX warpY setting and the mouse pointer is not moving. |
Assuming you only want to focus/raise on change of display, then for this branch, the cmd-tab key combination should still warp the mouse correctly if warpX and warpY settings are enabled. If this doesn't happen, then there might be a bug. I will check and report back to see if this is the case. |
I didn't try the branch before. Now I did. The branch works beautifully with |
Can You include this in app version? This is EXACTLY what i need |
I can but I don't know when because I am very much occupied at the moment. Thanks however for this feedback so I know it is worth including indeed ;-) |
Its okay! Please try to add it as and when u r free! Btw, can you do something like add delay while shifting through windows in the same screen but 0 delay and direct focus on the window on another screen as soon as you change your screen(external monitor)?
… On Feb 2, 2024, at 2:59 PM, Stefan Post ***@***.***> wrote:
@ishaanrathodd <https://github.com/ishaanrathodd>
I can but I don't know when because I am very much occupied at the moment. Thanks however for this feedback so I know it is worth including indeed ;-)
—
Reply to this email directly, view it on GitHub <#11 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AVTRTKPEFZVJNCM35PX3AGTYRSWWBAVCNFSM4T4RVOSKU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOJSGM2DANZYGQ3Q>.
You are receiving this because you were mentioned.
|
For the upper command line version, if it is possible, can you give me a detailed step by step process on how to enable change focus only when changing screens and also only enabling focus change and not raise window? and if anything goes wrong how to delete it. It would be a great help! |
This is an interesting idea. Then to disable it completely for the same screen the delay could be set to zero. I will consider adding this when time allows me to. |
The README should provide you with all the information you need. Please give that a try and if that fails, I am here to help. |
i did definitely read the readme but as far as the command line version goes, im so lost. I tried using it through command line but im not sure how to do it as it doesnt seem to recognise autoraise. Other than that i have doubts on how to reset to default values or disable ceratin features like warp through command line. |
thank you :) |
In that case perhaps it is better if I compile a UI version. Will do that sometime coming week |
Alright! Honestly the real use case for this app (my pov) is genuinely just avoiding that extra click when we want visible apps open at the same time on the visible screens and browse between them without that extra click to focus. Doesn't really make sense to enable focus on window change in the SAME display because its very inconvenient, sometimes you want to copy text from a window but if the cursor is out of window you do not notice it and the operation is not completed as some other window is focused by then, etc. There are many loop holes i found in this implementation and to keep it turned off as of now seems the best option for me. Triggering "focus follows cursor" ONLY WHEN CHANGING DISPLAY seems the best use case (i think people just use command tab to shift between windows focus in the SAME display because you really don't have that much space to keep all windows visible at the same time in the same display so "focus follows cursor" doesnt make sense in just 1 display.) This is my point of view, people might still make use out of the available features. Triggering focus follows cursor only when the cursor changes screens and then again turning the "focus follows cursor" feature off until the cursor moves to a different screen is an incredible feature and would really be useful, delay should obviously be 0 for prompt action. Thank you so much for understanding my use case! Would be waiting to try this feature soon! |
I guess it is a matter of taste. Personally I have the focus only feature enabled (without raise) for every window regardless of the display it is in. The loop holes you describe are not so much an issue for me, maybe because I got very used to how it works now. About the binary version: this is still on my todo list but I got ill these last 2 days with a nasty fever. Fortunately today I feel a lot better already but I will have to postpone the binary until next week. Thanks for taking the time to explain your use case. It is good to know how AutoRaise is being used so it can be improved upon :-) |
sure ofcourse! this was my pov. I would wait until next week no problem! The app is really useful. |
The binary has been updated in this branch. |
WORKS! Thank you so muchhhh man! |
I've tested this a little and it seems I can only use this with window raising, not only focus change. I'm starting with ./AutoRaise -delay 2. |
There are a few things. If i have one external monitor and i have youtube in fullscreen mode, and i move my cursor from there to main screen of laptop, the focus doesnt shift. I understand this also happens if a popup window from an app (like settings pane) also produces the same problem. Is this a system problem as it doesnt seem like a bug and is very consistent across? Focus only activates if im moving from one window to other without having opened any pop up windows of either apps. |
Those things will have to be looked at. Having AutoRaise only enabled on screen change introduces various side effects. It is for this reason it never became part of the main branch. This branch is more an experimental one. Still there seems to be a demand for this feature so it could be worth adding it. I am very busy however so it may take some time. |
Try with: ./AutoRaise -focusDelay 1
With Xcode. In addition it requires an Apple Developer ID to get it signed and notorized. It is quite a hassle. However the UI code can be found in the AutoRaise-UI repository. |
This yields the same behaviour, all windows are raised, not just focused. If I use I'll check out the UI, thanks. |
Which tells me that the AutoRaise binary you are running hasn't been compiled with the EXPERIMENTAL_FOCUS_FIRST flag enabled. This is further documented in the README. In short:
|
Ah, sorry for the confusion then - it does work fine now! |
I have two monitors and I only want to change the focus when mouse switches between the screens, not the apps. Is there any feature for this purpose?
The text was updated successfully, but these errors were encountered: