-
-
Notifications
You must be signed in to change notification settings - Fork 778
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
base: main
Are you sure you want to change the base?
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
Adds the support for
open -g "rectangle://execute-action?name=ignore-app"
open -g "rectangle://execute-action?name=unignore-app"