-
-
Notifications
You must be signed in to change notification settings - Fork 792
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
Handle ignore unignore URL actions #1505
Conversation
Thanks for looking to contribute. Rather than adding these as window actions, I recommend adding a new url query parameter that will call Maybe something like |
What about adding a query pram for the app bundle id, so that even if IntelliJ is in background for some reason it can execute this action without affecting another app. |
Sure! This looks good to me, but I can hold off on merging if you wanted to add in the bundleId query param. |
OK I'll do it shortly. |
Added |
Rectangle/AppDelegate.swift
Outdated
@@ -555,17 +555,34 @@ extension AppDelegate { | |||
func getUrlName(_ name: String) -> String { | |||
return name.map { $0.isUppercase ? "-" + $0.lowercased() : String($0) }.joined() | |||
} | |||
func getAppBundleId(_ components: URLComponents) -> String? { | |||
let appBundleId = (components.queryItems?.first { $0.name == "app-bundle-id" })?.value | |||
return if appBundleId == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this change here. Sorry to beleaguer this, but I figure we might as well get this tidied up.
- What we have now can also be rewritten as
return appBundleId ?? ApplicationToggle.frontAppId
(hence one of the reasons why you don't typically seeif
come afterreturn
) - However, this would still be the same as
return appBundleId
since once we get toApplicationToggle
, we would be providing theApplicationToggle.frontAppId
at that time in the case ofappBundleId
being nil. - If we want to account for
app-bundle-id=
in the URL, then we would have to check thatappBundleId != nil && appBundleId.isEmpty
(depending on if we do indeed get back an empty string in that case - I didn't test it).
I'm still ok either way on doing the empty string check, but it still makes the most sense to me to at the very least change this to return appBundleId
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I pushed a change in the train yesterday as a reflex, (if anything happen to the laptop).
I agree with your points; my original goal is indeed the third point.
7c08e20
to
1304d0a
Compare
I wanted to make sure that I'm not holding things up here - let me know when you're ready for me to take another look (no pressure or anything). |
@rxhanson Hi, I think I fixed the last open point. And yes I'd like another pass. Thank you very much! |
Apologies for the delay. I hope you don't mind, but I proposed my expected change directly in your branch in the interest of moving this along. Your last change still allowed for an empty app-bundle-id to result in the frontmost app being ignore/unignored. Feel free to roll back my proposal and give this another go if I misunderstood the goal. |
Looks good. Thanks for looking into it. I didn't write the validation because this empty value has no side effect as far as I know. It's just stored into the "hash set", and since no app can have an empty bundle id (I may be wrong here), this will never be looked up in this "hash set". |
Adds the support for
open -g "rectangle://execute-action?name=ignore-app"
open -g "rectangle://execute-action?name=unignore-app"