Grab URL if front-most-facing application is a Browser on macOS #1249
Replies: 2 comments
-
Hey @dougpagani, Thank you for the feedback!
The new v2 introduced support for the window titles that was missing in the previous version, so we could consider this one solved :)
Thanks! This is interesting. Given that Espanso polls the active application for this information (exec, title, class) approximately every second, this approach might have a negative impact on performance, so we should think about a way to mitigate the overhead. Perhaps, we could scan the URL only if certain conditions are met (like the window title being equal to something), but that would possibly require a significant change to the detection logic :)
Do you think having the window title might solve this problem? Cheers :) |
Beta Was this translation helpful? Give feedback.
-
Hi @federico-terzi (This post is purely for your knowledge, and so to save you some time, I time-linked the video -- it's a quick 1-minute show of the steno system's macros. I know you're in "stepping away" mode with the project, but I figured I'd close a good conversation now that I found a very high-efficiency analogue demo for you as a matter of general knowledge.) , I can't find the other conversation we had a while ago where I had asked for a mechanism to be able to back-query the last expansion - and you asked something like "can you show/explain an example of why that would be useful?" I just came across a very succinct demo of what I think is mostly perfect design of handling of "User-Bankable apps", which Espanso is very much so one of, in this video on a steno system: https://youtu.be/hLgf-Zkte48?si=INQ4WdNijuYog8ri&t=1m BANKINGS META COMMANDS: In my opinion, to satisfy "fluent self-growth", it is only missing an "EDIT translation", which could just be overloaded behavior of "ADD", such that the last stroke is opened & hoisted for fixing. I've built a lot of applets like Espanso, and I've found that the highest bandwidth comes from when you have a context-aware I wanted to expose the "last candidate" for an expansion because this would enable an ADD-FROM-LAST. I do this for virtually everything and it makes for good software design, especially software meant for other software developers. "alias-last()" on the shell would be another easily understood example of this. Sure, the key logging thing is somewhat of a concern, but it only expands the scope of memory from 1 word to 2, so I really don't think it's that much more of a security risk. If you could query the last trigger from the CLI-tool, you could easily write a system shortcut to pull up & navigate to the YAML entry & quickly edit it. Would reduce expansion-iteration time from ~1 minute per fixup to ~2 seconds. And extension/growth of the expansions bank would be likewise, incredibly easy, but this doesn't require much help from Espanso if it isn't built-in, as you can just use clipboard content + zenity-GUI-prompt-script which prefills the expansion and prompts for you to fill the trigger (then auto-formatting the YAML entry and dumping it into a valid search-path file as appended text). |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I'm not sure this is a problem or if it's abnormal behavior, but on macos, from
espanso detect
, I get:If you'll notice, the bundle id is used for the window title. This is the same for all apps I've tried w/
espanso detect
running.Describe the solution you'd like
There are two additional pieces of information that could be garnered from macos:
1. Title, for all apps
I'm not sure if there's a reason why this hasn't been developed, but this info is accessible via
kCGWindowName
in macos:... which will yield something like:
windowTitle: 'Unicorns - Google Search'
2. URL, if it is a browser
And then for URL, that can be obtained via
osascript
(CAVEAT: this is not a fast call likekCGWindowName
afaik):... which will yield something like:
url: 'https://sindresorhus.com/unicorn'
Describe alternatives you've considered
n/a
Additional context
This would add value since we're moving towards a world of webapps where the front-most app is virtually indistinguishable from the point of view of bundle-id's and such, but is really quite different.
Beta Was this translation helpful? Give feedback.
All reactions