godbout / Scrolla.docs

Scroll with Vim motions under macOS
64 stars 0 forks source link

Selection border not showing for scrolling in `qlmanage` PDF preview #10

Open jannis-baum opened 1 year ago

jannis-baum commented 1 year ago

This might be a hardcore edge-case but who knows, maybe it'll uncover something else:

Running qlmanage -p <some PDF> and then using Scrolla to scroll the preview window works (it does scroll) but the selection border is missing. Interestingly enough, opening Quicklook from the Finder (i.e. pressing space on the same PDF) instead of running qlmanage directly does not have the issue.

godbout commented 1 year ago

seems that qlmanage opens something that has no AX access. the reason why you can still scroll is because currently you start Scrolla, it can't find any window, but it's still on. so the scroll sends events to whatever window is below. unfortunately that's going to go away with the new "flash" thing and "no window available" detection. so currently it somehow works, but it's a bug 😂️

QuickLook here works half. the scroll works, but the border is half drawn. weird.

jannis-baum commented 1 year ago

unfortunately that's going to go away with the new "flash" thing and "no window available" detection. so currently it somehow works, but it's a bug 😂️

Hahahha :( Have you found any other situations where this is the case? Maybe then it's good the way it is right now?

godbout commented 1 year ago

Hahahha :( Have you found any other situations where this is the case? Maybe then it's good the way it is right now?

that'll happen every time a scrollable area (including the main window) is not found. i guess for most apps it'll be ok. but maybe some popovers kinda apps? not sure yet.

for leaving it as it is, well, when i started i had two choices, one harder than the other one, but with better UX. that's the one you're experiencing now. grabbing scrollable area, and positioning the cursor there, to send scroll events to macOS. the other, easier, way would be to just send scroll events wherever the mouse cursor is. in your case with qlmanage, you were just lucky that the mouse cursor was at the right position (window below the cursor), which is why it worked. but how to move the cursor around? Wooshy? as we talked about it i think earlier, it's better i believe to have Scrolla has its own separate app.

now one thing that could be possible i guess, would be that if no window is found, then i draw a border over the whole screen, AND i don't move the mouse. so that you can send scroll events where the mouse is currently. that would solve your current specific issue (with the mouse cursor being at the right place), but as far as i'm concerned, i think it pollutes the UX for a very unstable benefit. like that'll be the only case where Scrolla doesn't move the cursor in the middle of an Area, and you have to be lucky that the mouse cursor is exactly where you need it... so i don't think it's a good solution.

jannis-baum commented 1 year ago

Yeah you're right! Good points. Better to have it explicitly not work at all than having something inconsistent.

Another situation that to me looks like it might be the same thing but will affect more people than not being able to scroll qlmanage is trying to scroll Spotlight results. Here I actually found something else as well: #11

godbout commented 1 year ago

Another situation that to me looks like it might be the same thing but will affect more people than not being able to scroll qlmanage is trying to scroll Spotlight results.

hmm. Spotlight has AX. ok so to solve #9, i've switched from grabbing the AX frontmost app focused window to grabbing the Workspace AX frontmost app focused window. this is because the AX frontmost will grab non activating panels like Alfred etc. while the Workspace will not. BUT NOW we have Spotlight that doesn't activate any frontmost app, but also that doesn't automatically disappear when we bring up another non activating panel like Alfred, Wooshy, Scrolla, etc...

so if i switch back, it's gonna bring other issues...

https://user-images.githubusercontent.com/121373/204031595-ff3805b7-bd58-4793-b329-1ed843ef4a99.mp4

i think the only way to take care of this is to check which app is the AX frontmost, and depending on the specific app (like Spotlight), returning different data...

godbout commented 1 year ago

hmm maybe the UX in the video above is "good enough"? like if you activate Scrolla on a non activating panel that disappears by itself, then it's the user's problem? 🤔️

that would help taking care of Spotlight without having to check explicitly on which app Scrolla is. but at the same time i haven't seen much app working the same as Spotlight.

godbout commented 1 year ago

actually, does it make any sense to scroll on Spotlight's results? no idea, i don't use it. but scrolling wouldn't allow you to pick a choice without the mouse later, no? isn't kV more useful here?

godbout commented 1 year ago

(also you can't use Wooshy on Spotlight because it takes care of the Workspace frontmost app too, like Scrolla 😂️)

jannis-baum commented 1 year ago

hmm maybe the UX in the video above is "good enough"? like if you activate Scrolla on a non activating panel that disappears by itself, then it's the user's problem?

I think this is reasonable!

BUT NOW we have Spotlight that doesn't activate any frontmost app, but also that doesn't automatically disappear when we bring up another non activating panel

Spotlight also used to work like that but it seems like they recently (probably Ventura) changed it to not disappear when focussing another non-activating panel. Actually I'm not entirely sure if that's intended from Apple's side because I feel like it creates bugs in other places as well😂

actually, does it make any sense to scroll on Spotlight's results? no idea, i don't use it. but scrolling wouldn't allow you to pick a choice without the mouse later, no? isn't kV more useful here?

I guess that's true. Unless someone wants to look at results without opening them. Which does sound like an odd scenario.

But the scroll with Scrolla and then click with Wooshy thing sounds like something that would actually be useful! Specifically when there are lots of results and you want the nice scrolling experience🙈

godbout commented 1 year ago

I think this is reasonable!

actually i'm going to do this on a per app basis. there seems to be only a few apps that don't disappear when another non activating panel shows up. currently i only see Spotlight and Things 3. then we get the best of both worlds without too much extra work.

Spotlight also used to work like that but it seems like they recently (probably Ventura) changed it to not disappear when focussing another non-activating panel. Actually I'm not entirely sure if that's intended from Apple's side because I feel like it creates bugs in other places as well😂

yeah. it does seem to create issues with the active app not receiving key events. i'm finding a lot of crappy stuff in Ventura actually. some really bad UX where in those new Settings thing, half of your typing doesn't get registered. that's pretty bad.

I guess that's true. Unless someone wants to look at results without opening them. Which does sound like an odd scenario.

But the scroll with Scrolla and then click with Wooshy thing sounds like something that would actually be useful! Specifically when there are lots of results and you want the nice scrolling experience🙈

yeah, gonna try to do that. that requires updates in the DisplayEngine used by all apps, and each individual AXEngine. this is doable, but i need to find a proper way to separate apps that need the workspace frontmostapp from the ones that need the ax frontmost app. not a technical difficulty, more of an organizational one.